Skip to content

Commit 9e73793

Browse files
mollyibotcopybara-github
authored andcommitted
Add webcrypto api.
PiperOrigin-RevId: 673899692
1 parent d827ee7 commit 9e73793

File tree

4 files changed

+141
-0
lines changed

4 files changed

+141
-0
lines changed

BUILD

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,3 +87,8 @@ jsinterop_generator(
8787
name = "elemental2-indexeddb",
8888
exports = ["//java/elemental2/indexeddb"],
8989
)
90+
91+
jsinterop_generator(
92+
name = "elemental2-webcrypto",
93+
exports = ["//java/elemental2/webcrypto"],
94+
)

java/elemental2/webcrypto/BUILD

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# This package contains the build rule to build elemental2-dom.
2+
load(
3+
"//build_defs/internal_do_not_use:elemental_utils.bzl",
4+
"patch_extern_file",
5+
)
6+
load("@com_google_jsinterop_generator//:jsinterop_generator.bzl", "jsinterop_generator")
7+
8+
package(
9+
default_applicable_licenses = ["//:license"],
10+
default_visibility = [
11+
"//:__subpackages__",
12+
],
13+
# Apache2
14+
licenses = ["notice"],
15+
)
16+
17+
patch_extern_file(
18+
name = "w3c_webcrypto_patched",
19+
src = "//third_party:w3c_webcrypto.js",
20+
patch_file = "w3c_webcrypto.js.diff",
21+
)
22+
23+
filegroup(
24+
name = "externs",
25+
srcs = [
26+
":w3c_webcrypto_patched",
27+
],
28+
)
29+
30+
jsinterop_generator(
31+
name = "webcrypto",
32+
srcs = [":externs"],
33+
# override auto generated js_deps since modified externs cause conflicts
34+
externs_deps = [],
35+
deps = [
36+
"//java/elemental2/core",
37+
"//java/elemental2/promise",
38+
],
39+
)
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
299c299
2+
< webCrypto.RsaKeyGenParams;
3+
---
4+
> webCrypto.RsaKeyGenParams = function() {};
5+
315c315
6+
< webCrypto.RsaHashedKeyGenParams;
7+
---
8+
> webCrypto.RsaHashedKeyGenParams = function() {};
9+
327c327
10+
< webCrypto.RsaKeyAlgorithm;
11+
---
12+
> webCrypto.RsaKeyAlgorithm = function() {};
13+
343c343
14+
< webCrypto.RsaHashedKeyAlgorithm;
15+
---
16+
> webCrypto.RsaHashedKeyAlgorithm = function() {};
17+
355c355
18+
< webCrypto.RsaHashedImportParams;
19+
---
20+
> webCrypto.RsaHashedImportParams = function() {};
21+
367c367
22+
< webCrypto.RsaPssParams;
23+
---
24+
> webCrypto.RsaPssParams = function() {};
25+
379c379
26+
< webCrypto.RsaOaepParams;
27+
---
28+
> webCrypto.RsaOaepParams = function() {};
29+
391c391
30+
< webCrypto.EcdsaParams;
31+
---
32+
> webCrypto.EcdsaParams = function() {};
33+
410c410
34+
< webCrypto.EcKeyGenParams;
35+
---
36+
> webCrypto.EcKeyGenParams = function() {};
37+
422c422
38+
< webCrypto.EcKeyAlgorithm;
39+
---
40+
> webCrypto.EcKeyAlgorithm = function() {};
41+
434c434
42+
< webCrypto.EcKeyImportParams;
43+
---
44+
> webCrypto.EcKeyImportParams = function() {};
45+
446c446
46+
< webCrypto.EcKeyDeriveParams;
47+
---
48+
> webCrypto.EcKeyDeriveParams = function() {};
49+
458c458
50+
< webCrypto.AesCtrParams;
51+
---
52+
> webCrypto.AesCtrParams = function() {};
53+
474c474
54+
< webCrypto.AesKeyAlgorithm;
55+
---
56+
> webCrypto.AesKeyAlgorithm = function() {};
57+
486c486
58+
< webCrypto.AesKeyGenParams;
59+
---
60+
> webCrypto.AesKeyGenParams = function() {};
61+
498c498
62+
< webCrypto.AesDerivedKeyParams;
63+
---
64+
> webCrypto.AesDerivedKeyParams = function() {};
65+
510c510
66+
< webCrypto.AesCbcParams;
67+
---
68+
> webCrypto.AesCbcParams = function() {};
69+
522c522
70+
< webCrypto.AesGcmParams;
71+
---
72+
> webCrypto.AesGcmParams = function() {};
73+
542c542
74+
< webCrypto.HmacImportParams;
75+
---
76+
> webCrypto.HmacImportParams = function() {};
77+
558c558
78+
< webCrypto.HmacKeyAlgorithm;
79+
---
80+
> webCrypto.HmacKeyAlgorithm = function() {};
81+
574c574
82+
< webCrypto.HmacKeyGenParams;
83+
---
84+
> webCrypto.HmacKeyGenParams = function() {};
85+
590c590
86+
< webCrypto.HkdfParams;
87+
---
88+
> webCrypto.HkdfParams = function() {};
89+
610c610
90+
< webCrypto.Pbkdf2Params;
91+
---
92+
> webCrypto.Pbkdf2Params = function() {};

third_party/BUILD

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,11 @@ extern(
227227
path = "browser/w3c_worklets.js",
228228
)
229229

230+
extern(
231+
name = "w3c_webcrypto.js",
232+
path = "browser/w3c_webcrypto.js",
233+
)
234+
230235
extern(
231236
name = "webgl",
232237
path = "browser/webgl.js",

0 commit comments

Comments
 (0)