react-native-quick-crypto 0.6.0 → 0.7.0-rc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (196) hide show
  1. package/README.md +70 -18
  2. package/android/CMakeLists.txt +58 -61
  3. package/android/build.gradle +105 -53
  4. package/android/gradle/wrapper/gradle-wrapper.properties +1 -1
  5. package/android/gradle.properties +5 -5
  6. package/android/src/main/{AndroidManifest.xml → AndroidManifestNew.xml} +1 -2
  7. package/cpp/Cipher/MGLCipherHostObject.cpp +31 -5
  8. package/cpp/Cipher/MGLGenerateKeyPairInstaller.cpp +21 -31
  9. package/cpp/Cipher/MGLGenerateKeyPairSyncInstaller.cpp +4 -17
  10. package/cpp/Cipher/MGLPublicCipher.h +1 -1
  11. package/cpp/Cipher/MGLPublicCipherInstaller.h +6 -6
  12. package/cpp/Cipher/MGLRsa.cpp +224 -11
  13. package/cpp/Cipher/MGLRsa.h +13 -3
  14. package/cpp/Hash/MGLHashHostObject.cpp +1 -1
  15. package/cpp/Hash/MGLHashInstaller.cpp +2 -4
  16. package/cpp/JSIUtils/MGLJSIMacros.h +10 -0
  17. package/cpp/JSIUtils/MGLThreadAwareHostObject.h +1 -1
  18. package/cpp/MGLKeys.cpp +415 -471
  19. package/cpp/MGLKeys.h +70 -2
  20. package/cpp/MGLQuickCryptoHostObject.cpp +9 -0
  21. package/cpp/Random/MGLRandomHostObject.cpp +9 -2
  22. package/cpp/Sig/MGLSignHostObjects.cpp +1 -1
  23. package/cpp/Utils/MGLUtils.cpp +104 -32
  24. package/cpp/Utils/MGLUtils.h +172 -143
  25. package/cpp/Utils/node.h +13 -0
  26. package/cpp/webcrypto/MGLWebCrypto.cpp +63 -0
  27. package/cpp/webcrypto/MGLWebCrypto.h +34 -0
  28. package/cpp/webcrypto/crypto_ec.cpp +334 -0
  29. package/cpp/webcrypto/crypto_ec.h +65 -0
  30. package/ios/QuickCrypto.xcodeproj/project.pbxproj +4 -4
  31. package/lib/commonjs/@types/crypto-browserify.d.js.map +1 -1
  32. package/lib/commonjs/Cipher.js +53 -194
  33. package/lib/commonjs/Cipher.js.map +1 -1
  34. package/lib/commonjs/Hash.js +29 -29
  35. package/lib/commonjs/Hash.js.map +1 -1
  36. package/lib/commonjs/Hashnames.js +75 -0
  37. package/lib/commonjs/Hashnames.js.map +1 -0
  38. package/lib/commonjs/Hmac.js +6 -29
  39. package/lib/commonjs/Hmac.js.map +1 -1
  40. package/lib/commonjs/NativeQuickCrypto/Cipher.js +3 -5
  41. package/lib/commonjs/NativeQuickCrypto/Cipher.js.map +1 -1
  42. package/lib/commonjs/NativeQuickCrypto/NativeQuickCrypto.js +11 -20
  43. package/lib/commonjs/NativeQuickCrypto/NativeQuickCrypto.js.map +1 -1
  44. package/lib/commonjs/NativeQuickCrypto/hash.js.map +1 -1
  45. package/lib/commonjs/NativeQuickCrypto/hmac.js.map +1 -1
  46. package/lib/commonjs/NativeQuickCrypto/pbkdf2.js.map +1 -1
  47. package/lib/commonjs/NativeQuickCrypto/random.js.map +1 -1
  48. package/lib/commonjs/NativeQuickCrypto/sig.js.map +1 -1
  49. package/lib/commonjs/NativeQuickCrypto/webcrypto.js +6 -0
  50. package/lib/commonjs/NativeQuickCrypto/webcrypto.js.map +1 -0
  51. package/lib/commonjs/QuickCrypto.js +5 -14
  52. package/lib/commonjs/QuickCrypto.js.map +1 -1
  53. package/lib/commonjs/Utils.js +360 -48
  54. package/lib/commonjs/Utils.js.map +1 -1
  55. package/lib/commonjs/aes.js +324 -0
  56. package/lib/commonjs/aes.js.map +1 -0
  57. package/lib/commonjs/constants.js +1 -2
  58. package/lib/commonjs/constants.js.map +1 -1
  59. package/lib/commonjs/ec.js +288 -0
  60. package/lib/commonjs/ec.js.map +1 -0
  61. package/lib/commonjs/index.js +6 -10
  62. package/lib/commonjs/index.js.map +1 -1
  63. package/lib/commonjs/keys.js +280 -48
  64. package/lib/commonjs/keys.js.map +1 -1
  65. package/lib/commonjs/pbkdf2.js +44 -18
  66. package/lib/commonjs/pbkdf2.js.map +1 -1
  67. package/lib/commonjs/random.js +49 -68
  68. package/lib/commonjs/random.js.map +1 -1
  69. package/lib/commonjs/rsa.js +329 -0
  70. package/lib/commonjs/rsa.js.map +1 -0
  71. package/lib/commonjs/sig.js +13 -54
  72. package/lib/commonjs/sig.js.map +1 -1
  73. package/lib/commonjs/subtle.js +271 -0
  74. package/lib/commonjs/subtle.js.map +1 -0
  75. package/lib/module/@types/crypto-browserify.d.js.map +1 -1
  76. package/lib/module/Cipher.js +53 -188
  77. package/lib/module/Cipher.js.map +1 -1
  78. package/lib/module/Hash.js +27 -21
  79. package/lib/module/Hash.js.map +1 -1
  80. package/lib/module/Hashnames.js +71 -0
  81. package/lib/module/Hashnames.js.map +1 -0
  82. package/lib/module/Hmac.js +4 -21
  83. package/lib/module/Hmac.js.map +1 -1
  84. package/lib/module/NativeQuickCrypto/Cipher.js +3 -4
  85. package/lib/module/NativeQuickCrypto/Cipher.js.map +1 -1
  86. package/lib/module/NativeQuickCrypto/NativeQuickCrypto.js +11 -17
  87. package/lib/module/NativeQuickCrypto/NativeQuickCrypto.js.map +1 -1
  88. package/lib/module/NativeQuickCrypto/hash.js.map +1 -1
  89. package/lib/module/NativeQuickCrypto/hmac.js.map +1 -1
  90. package/lib/module/NativeQuickCrypto/pbkdf2.js.map +1 -1
  91. package/lib/module/NativeQuickCrypto/random.js.map +1 -1
  92. package/lib/module/NativeQuickCrypto/sig.js.map +1 -1
  93. package/lib/module/NativeQuickCrypto/webcrypto.js +2 -0
  94. package/lib/module/NativeQuickCrypto/webcrypto.js.map +1 -0
  95. package/lib/module/QuickCrypto.js +2 -0
  96. package/lib/module/QuickCrypto.js.map +1 -1
  97. package/lib/module/Utils.js +319 -33
  98. package/lib/module/Utils.js.map +1 -1
  99. package/lib/module/aes.js +317 -0
  100. package/lib/module/aes.js.map +1 -0
  101. package/lib/module/constants.js.map +1 -1
  102. package/lib/module/ec.js +282 -0
  103. package/lib/module/ec.js.map +1 -0
  104. package/lib/module/index.js +7 -4
  105. package/lib/module/index.js.map +1 -1
  106. package/lib/module/keys.js +279 -43
  107. package/lib/module/keys.js.map +1 -1
  108. package/lib/module/pbkdf2.js +44 -13
  109. package/lib/module/pbkdf2.js.map +1 -1
  110. package/lib/module/random.js +46 -54
  111. package/lib/module/random.js.map +1 -1
  112. package/lib/module/rsa.js +323 -0
  113. package/lib/module/rsa.js.map +1 -0
  114. package/lib/module/sig.js +13 -46
  115. package/lib/module/sig.js.map +1 -1
  116. package/lib/module/subtle.js +265 -0
  117. package/lib/module/subtle.js.map +1 -0
  118. package/lib/typescript/src/Cipher.d.ts +72 -0
  119. package/lib/typescript/src/Cipher.d.ts.map +1 -0
  120. package/lib/typescript/{Hash.d.ts → src/Hash.d.ts} +8 -7
  121. package/lib/typescript/src/Hash.d.ts.map +1 -0
  122. package/lib/typescript/src/Hashnames.d.ts +11 -0
  123. package/lib/typescript/src/Hashnames.d.ts.map +1 -0
  124. package/lib/typescript/{Hmac.d.ts → src/Hmac.d.ts} +3 -3
  125. package/lib/typescript/src/Hmac.d.ts.map +1 -0
  126. package/lib/typescript/src/NativeQuickCrypto/Cipher.d.ts +34 -0
  127. package/lib/typescript/src/NativeQuickCrypto/Cipher.d.ts.map +1 -0
  128. package/lib/typescript/{NativeQuickCrypto → src/NativeQuickCrypto}/NativeQuickCrypto.d.ts +3 -0
  129. package/lib/typescript/src/NativeQuickCrypto/NativeQuickCrypto.d.ts.map +1 -0
  130. package/lib/typescript/src/NativeQuickCrypto/hash.d.ts +7 -0
  131. package/lib/typescript/src/NativeQuickCrypto/hash.d.ts.map +1 -0
  132. package/lib/typescript/src/NativeQuickCrypto/hmac.d.ts +6 -0
  133. package/lib/typescript/src/NativeQuickCrypto/hmac.d.ts.map +1 -0
  134. package/lib/typescript/{NativeQuickCrypto → src/NativeQuickCrypto}/pbkdf2.d.ts +2 -1
  135. package/lib/typescript/src/NativeQuickCrypto/pbkdf2.d.ts.map +1 -0
  136. package/lib/typescript/{NativeQuickCrypto → src/NativeQuickCrypto}/random.d.ts +2 -1
  137. package/lib/typescript/src/NativeQuickCrypto/random.d.ts.map +1 -0
  138. package/lib/typescript/{NativeQuickCrypto → src/NativeQuickCrypto}/sig.d.ts +5 -4
  139. package/lib/typescript/src/NativeQuickCrypto/sig.d.ts.map +1 -0
  140. package/lib/typescript/src/NativeQuickCrypto/webcrypto.d.ts +27 -0
  141. package/lib/typescript/src/NativeQuickCrypto/webcrypto.d.ts.map +1 -0
  142. package/lib/typescript/{QuickCrypto.d.ts → src/QuickCrypto.d.ts} +16 -8
  143. package/lib/typescript/src/QuickCrypto.d.ts.map +1 -0
  144. package/lib/typescript/src/Utils.d.ts +44 -0
  145. package/lib/typescript/src/Utils.d.ts.map +1 -0
  146. package/lib/typescript/src/aes.d.ts +5 -0
  147. package/lib/typescript/src/aes.d.ts.map +1 -0
  148. package/lib/typescript/{constants.d.ts → src/constants.d.ts} +1 -0
  149. package/lib/typescript/src/constants.d.ts.map +1 -0
  150. package/lib/typescript/src/ec.d.ts +5 -0
  151. package/lib/typescript/src/ec.d.ts.map +1 -0
  152. package/lib/typescript/{index.d.ts → src/index.d.ts} +33 -27
  153. package/lib/typescript/src/index.d.ts.map +1 -0
  154. package/lib/typescript/src/keys.d.ts +154 -0
  155. package/lib/typescript/src/keys.d.ts.map +1 -0
  156. package/lib/typescript/src/pbkdf2.d.ts +12 -0
  157. package/lib/typescript/src/pbkdf2.d.ts.map +1 -0
  158. package/lib/typescript/{random.d.ts → src/random.d.ts} +7 -6
  159. package/lib/typescript/src/random.d.ts.map +1 -0
  160. package/lib/typescript/src/rsa.d.ts +4 -0
  161. package/lib/typescript/src/rsa.d.ts.map +1 -0
  162. package/lib/typescript/{sig.d.ts → src/sig.d.ts} +3 -3
  163. package/lib/typescript/src/sig.d.ts.map +1 -0
  164. package/lib/typescript/src/subtle.d.ts +11 -0
  165. package/lib/typescript/src/subtle.d.ts.map +1 -0
  166. package/package.json +35 -30
  167. package/react-native-quick-crypto.podspec +5 -4
  168. package/src/Cipher.ts +103 -100
  169. package/src/Hash.ts +42 -6
  170. package/src/Hashnames.ts +91 -0
  171. package/src/Hmac.ts +3 -3
  172. package/src/NativeQuickCrypto/Cipher.ts +1 -0
  173. package/src/NativeQuickCrypto/NativeQuickCrypto.ts +2 -0
  174. package/src/NativeQuickCrypto/webcrypto.ts +46 -0
  175. package/src/QuickCrypto.ts +2 -0
  176. package/src/Utils.ts +409 -5
  177. package/src/aes.ts +365 -0
  178. package/src/ec.ts +351 -0
  179. package/src/keys.ts +428 -54
  180. package/src/pbkdf2.ts +84 -11
  181. package/src/random.ts +37 -24
  182. package/src/rsa.ts +396 -0
  183. package/src/sig.ts +3 -2
  184. package/src/subtle.ts +358 -0
  185. package/lib/commonjs/@types/stream-browserify.d.js +0 -2
  186. package/lib/commonjs/@types/stream-browserify.d.js.map +0 -1
  187. package/lib/module/@types/stream-browserify.d.js +0 -2
  188. package/lib/module/@types/stream-browserify.d.js.map +0 -1
  189. package/lib/typescript/Cipher.d.ts +0 -87
  190. package/lib/typescript/NativeQuickCrypto/Cipher.d.ts +0 -32
  191. package/lib/typescript/NativeQuickCrypto/hash.d.ts +0 -6
  192. package/lib/typescript/NativeQuickCrypto/hmac.d.ts +0 -5
  193. package/lib/typescript/Utils.d.ts +0 -23
  194. package/lib/typescript/keys.d.ts +0 -60
  195. package/lib/typescript/pbkdf2.d.ts +0 -9
  196. package/src/@types/stream-browserify.d.ts +0 -4
@@ -1 +1 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[]}
1
+ {"version":3,"names":[],"sourceRoot":"../../../src","sources":["NativeQuickCrypto/pbkdf2.ts"],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[]}
1
+ {"version":3,"names":[],"sourceRoot":"../../../src","sources":["NativeQuickCrypto/random.ts"],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[]}
1
+ {"version":3,"names":[],"sourceRoot":"../../../src","sources":["NativeQuickCrypto/sig.ts"],"mappings":""}
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ //# sourceMappingURL=webcrypto.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sourceRoot":"../../../src","sources":["NativeQuickCrypto/webcrypto.ts"],"mappings":""}
@@ -4,26 +4,17 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.QuickCrypto = void 0;
7
-
8
7
  var pbkdf2 = _interopRequireWildcard(require("./pbkdf2"));
9
-
10
8
  var random = _interopRequireWildcard(require("./random"));
11
-
12
9
  var _Cipher = require("./Cipher");
13
-
14
10
  var _sig = require("./sig");
15
-
16
11
  var _Hmac = require("./Hmac");
17
-
18
12
  var _Hash = require("./Hash");
19
-
20
13
  var _constants = require("./constants");
21
-
22
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
23
-
24
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
25
-
26
- const QuickCrypto = {
14
+ var _subtle = require("./subtle");
15
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
16
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
17
+ const QuickCrypto = exports.QuickCrypto = {
27
18
  createHmac: _Hmac.createHmac,
28
19
  Hmac: _Hmac.createHmac,
29
20
  Hash: _Hash.createHash,
@@ -39,9 +30,9 @@ const QuickCrypto = {
39
30
  generateKeyPairSync: _Cipher.generateKeyPairSync,
40
31
  createSign: _sig.createSign,
41
32
  createVerify: _sig.createVerify,
33
+ subtle: _subtle.subtle,
42
34
  constants: _constants.constants,
43
35
  ...pbkdf2,
44
36
  ...random
45
37
  };
46
- exports.QuickCrypto = QuickCrypto;
47
38
  //# sourceMappingURL=QuickCrypto.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["QuickCrypto.ts"],"names":["QuickCrypto","createHmac","Hmac","Hash","createHash","createCipher","createCipheriv","createDecipher","createDecipheriv","publicEncrypt","publicDecrypt","privateDecrypt","generateKeyPair","generateKeyPairSync","createSign","createVerify","constants","pbkdf2","random"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AAWA;;AACA;;AACA;;AACA;;;;;;AAEO,MAAMA,WAAW,GAAG;AACzBC,EAAAA,UAAU,EAAVA,gBADyB;AAEzBC,EAAAA,IAAI,EAAED,gBAFmB;AAGzBE,EAAAA,IAAI,EAAEC,gBAHmB;AAIzBA,EAAAA,UAAU,EAAVA,gBAJyB;AAKzBC,EAAAA,YAAY,EAAZA,oBALyB;AAMzBC,EAAAA,cAAc,EAAdA,sBANyB;AAOzBC,EAAAA,cAAc,EAAdA,sBAPyB;AAQzBC,EAAAA,gBAAgB,EAAhBA,wBARyB;AASzBC,EAAAA,aAAa,EAAbA,qBATyB;AAUzBC,EAAAA,aAAa,EAAbA,qBAVyB;AAWzBC,EAAAA,cAAc,EAAdA,sBAXyB;AAYzBC,EAAAA,eAAe,EAAfA,uBAZyB;AAazBC,EAAAA,mBAAmB,EAAnBA,2BAbyB;AAczBC,EAAAA,UAAU,EAAVA,eAdyB;AAezBC,EAAAA,YAAY,EAAZA,iBAfyB;AAgBzBC,EAAAA,SAAS,EAATA,oBAhByB;AAiBzB,KAAGC,MAjBsB;AAkBzB,KAAGC;AAlBsB,CAApB","sourcesContent":["import * as pbkdf2 from './pbkdf2';\nimport * as random from './random';\nimport {\n createCipher,\n createCipheriv,\n createDecipher,\n createDecipheriv,\n publicEncrypt,\n publicDecrypt,\n privateDecrypt,\n generateKeyPair,\n generateKeyPairSync,\n} from './Cipher';\nimport { createSign, createVerify } from './sig';\nimport { createHmac } from './Hmac';\nimport { createHash } from './Hash';\nimport { constants } from './constants';\n\nexport const QuickCrypto = {\n createHmac,\n Hmac: createHmac,\n Hash: createHash,\n createHash,\n createCipher,\n createCipheriv,\n createDecipher,\n createDecipheriv,\n publicEncrypt,\n publicDecrypt,\n privateDecrypt,\n generateKeyPair,\n generateKeyPairSync,\n createSign,\n createVerify,\n constants,\n ...pbkdf2,\n ...random,\n};\n"]}
1
+ {"version":3,"names":["pbkdf2","_interopRequireWildcard","require","random","_Cipher","_sig","_Hmac","_Hash","_constants","_subtle","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","QuickCrypto","exports","createHmac","Hmac","Hash","createHash","createCipher","createCipheriv","createDecipher","createDecipheriv","publicEncrypt","publicDecrypt","privateDecrypt","generateKeyPair","generateKeyPairSync","createSign","createVerify","subtle","constants"],"sourceRoot":"../../src","sources":["QuickCrypto.ts"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,GAAAF,uBAAA,CAAAC,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AAWA,IAAAG,IAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,UAAA,GAAAN,OAAA;AACA,IAAAO,OAAA,GAAAP,OAAA;AAAkC,SAAAQ,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAV,wBAAAU,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAAAI,GAAA,CAAAP,CAAA,OAAAQ,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,CAAA,IAAAd,CAAA,oBAAAc,CAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAjB,CAAA,EAAAc,CAAA,SAAAI,CAAA,GAAAR,CAAA,GAAAC,MAAA,CAAAE,wBAAA,CAAAb,CAAA,EAAAc,CAAA,UAAAI,CAAA,KAAAA,CAAA,CAAAX,GAAA,IAAAW,CAAA,CAAAC,GAAA,IAAAR,MAAA,CAAAC,cAAA,CAAAJ,CAAA,EAAAM,CAAA,EAAAI,CAAA,IAAAV,CAAA,CAAAM,CAAA,IAAAd,CAAA,CAAAc,CAAA,YAAAN,CAAA,CAAAH,OAAA,GAAAL,CAAA,EAAAG,CAAA,IAAAA,CAAA,CAAAgB,GAAA,CAAAnB,CAAA,EAAAQ,CAAA,GAAAA,CAAA;AAE3B,MAAMY,WAAW,GAAAC,OAAA,CAAAD,WAAA,GAAG;EACzBE,UAAU,EAAVA,gBAAU;EACVC,IAAI,EAAED,gBAAU;EAChBE,IAAI,EAAEC,gBAAU;EAChBA,UAAU,EAAVA,gBAAU;EACVC,YAAY,EAAZA,oBAAY;EACZC,cAAc,EAAdA,sBAAc;EACdC,cAAc,EAAdA,sBAAc;EACdC,gBAAgB,EAAhBA,wBAAgB;EAChBC,aAAa,EAAbA,qBAAa;EACbC,aAAa,EAAbA,qBAAa;EACbC,cAAc,EAAdA,sBAAc;EACdC,eAAe,EAAfA,uBAAe;EACfC,mBAAmB,EAAnBA,2BAAmB;EACnBC,UAAU,EAAVA,eAAU;EACVC,YAAY,EAAZA,iBAAY;EACZC,MAAM,EAANA,cAAM;EACNC,SAAS,EAATA,oBAAS;EACT,GAAGjD,MAAM;EACT,GAAGG;AACL,CAAC"}
@@ -3,33 +3,74 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
+ var _exportNames = {
7
+ setDefaultEncoding: true,
8
+ getDefaultEncoding: true,
9
+ kEmptyObject: true,
10
+ toArrayBuffer: true,
11
+ bufferLikeToArrayBuffer: true,
12
+ binaryLikeToArrayBuffer: true,
13
+ ab2str: true,
14
+ validateString: true,
15
+ validateFunction: true,
16
+ isStringOrBuffer: true,
17
+ validateObject: true,
18
+ validateInt32: true,
19
+ validateUint32: true,
20
+ hasAnyNotIn: true,
21
+ lazyDOMException: true,
22
+ validateMaxBufferLength: true,
23
+ normalizeAlgorithm: true,
24
+ validateBitLength: true,
25
+ validateByteLength: true,
26
+ validateKeyOps: true
27
+ };
6
28
  exports.ab2str = ab2str;
7
29
  exports.binaryLikeToArrayBuffer = binaryLikeToArrayBuffer;
30
+ exports.bufferLikeToArrayBuffer = bufferLikeToArrayBuffer;
8
31
  exports.getDefaultEncoding = getDefaultEncoding;
32
+ exports.hasAnyNotIn = hasAnyNotIn;
9
33
  exports.isStringOrBuffer = isStringOrBuffer;
10
34
  exports.kEmptyObject = void 0;
35
+ exports.lazyDOMException = lazyDOMException;
36
+ exports.normalizeAlgorithm = void 0;
11
37
  exports.setDefaultEncoding = setDefaultEncoding;
12
38
  exports.toArrayBuffer = toArrayBuffer;
39
+ exports.validateByteLength = exports.validateBitLength = void 0;
13
40
  exports.validateFunction = validateFunction;
14
41
  exports.validateInt32 = validateInt32;
42
+ exports.validateMaxBufferLength = exports.validateKeyOps = void 0;
15
43
  exports.validateObject = validateObject;
16
44
  exports.validateString = validateString;
17
45
  exports.validateUint32 = validateUint32;
18
-
19
46
  var _reactNativeBuffer = require("@craftzdog/react-native-buffer");
47
+ var _Hashnames = require("./Hashnames");
48
+ Object.keys(_Hashnames).forEach(function (key) {
49
+ if (key === "default" || key === "__esModule") return;
50
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
51
+ if (key in exports && exports[key] === _Hashnames[key]) return;
52
+ Object.defineProperty(exports, key, {
53
+ enumerable: true,
54
+ get: function () {
55
+ return _Hashnames[key];
56
+ }
57
+ });
58
+ });
59
+ // @types/node
60
+
61
+ // TODO(osp) should buffer be part of the Encoding type?
20
62
 
21
63
  // Mimics node behavior for default global encoding
22
64
  let defaultEncoding = 'buffer';
23
-
24
65
  function setDefaultEncoding(encoding) {
25
66
  defaultEncoding = encoding;
26
67
  }
27
-
28
68
  function getDefaultEncoding() {
29
69
  return defaultEncoding;
30
70
  }
71
+ const kEmptyObject = exports.kEmptyObject = Object.freeze(Object.create(null));
31
72
 
32
- const kEmptyObject = Object.freeze(Object.create(null)); // Should be used by Cipher (or any other module that requires valid encodings)
73
+ // Should be used by Cipher (or any other module that requires valid encodings)
33
74
  // function slowCases(enc: string) {
34
75
  // switch (enc.length) {
35
76
  // case 4:
@@ -91,6 +132,7 @@ const kEmptyObject = Object.freeze(Object.create(null)); // Should be used by Ci
91
132
  // if (enc === '') return 'utf8';
92
133
  // }
93
134
  // }
135
+
94
136
  // // Return undefined if there is no match.
95
137
  // // Move the "slow cases" to a separate function to make sure this function gets
96
138
  // // inlined properly. That prioritizes the common case.
@@ -99,128 +141,398 @@ const kEmptyObject = Object.freeze(Object.create(null)); // Should be used by Ci
99
141
  // return slowCases(enc);
100
142
  // }
101
143
 
102
- exports.kEmptyObject = kEmptyObject;
103
-
104
144
  function toArrayBuffer(buf) {
105
- var _buf$buffer;
106
-
107
- if (buf !== null && buf !== void 0 && (_buf$buffer = buf.buffer) !== null && _buf$buffer !== void 0 && _buf$buffer.slice) {
145
+ if (buf?.buffer?.slice) {
108
146
  return buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength);
109
147
  }
110
-
111
148
  const ab = new ArrayBuffer(buf.length);
112
149
  const view = new Uint8Array(ab);
113
-
114
150
  for (let i = 0; i < buf.length; ++i) {
115
151
  view[i] = buf[i];
116
152
  }
117
-
118
153
  return ab;
119
154
  }
120
-
121
- function binaryLikeToArrayBuffer(input) {
122
- let encoding = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'utf-8';
123
-
155
+ function bufferLikeToArrayBuffer(buf) {
156
+ return _reactNativeBuffer.Buffer.isBuffer(buf) ? buf.buffer : ArrayBuffer.isView(buf) ? buf.buffer : buf;
157
+ }
158
+ function binaryLikeToArrayBuffer(input,
159
+ // CipherKey adds compat with node types
160
+ encoding = 'utf-8') {
124
161
  if (typeof input === 'string') {
162
+ if (encoding === 'buffer') {
163
+ throw new Error('Cannot create a buffer from a string with a buffer encoding');
164
+ }
125
165
  const buffer = _reactNativeBuffer.Buffer.from(input, encoding);
126
-
127
166
  return buffer.buffer.slice(buffer.byteOffset, buffer.byteOffset + buffer.byteLength);
128
167
  }
129
-
130
168
  if (_reactNativeBuffer.Buffer.isBuffer(input)) {
131
169
  return toArrayBuffer(input);
132
- } // TODO add further binary types to BinaryLike, UInt8Array and so for have this array as property
133
-
170
+ }
134
171
 
135
- if (input.buffer) {
172
+ // TODO add further binary types to BinaryLike, UInt8Array and so for have this array as property
173
+ if (ArrayBuffer.isView(input)) {
136
174
  return input.buffer;
137
175
  }
138
-
139
176
  if (!(input instanceof ArrayBuffer)) {
140
177
  try {
178
+ // this is a strange fallback case and input is unknown at this point
179
+ // @ts-expect-error
141
180
  const buffer = _reactNativeBuffer.Buffer.from(input);
142
-
143
181
  return buffer.buffer.slice(buffer.byteOffset, buffer.byteOffset + buffer.byteLength);
144
182
  } catch {
145
183
  throw 'error';
146
184
  }
147
185
  }
148
186
 
187
+ // TODO: handle if input is KeyObject?
188
+
149
189
  return input;
150
190
  }
151
-
152
- function ab2str(buf) {
153
- let encoding = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'hex';
191
+ function ab2str(buf, encoding = 'hex') {
154
192
  return _reactNativeBuffer.Buffer.from(buf).toString(encoding);
155
193
  }
156
-
157
194
  function validateString(str, name) {
158
195
  const isString = typeof str === 'string';
159
-
160
- if (isString) {
196
+ if (!isString) {
161
197
  throw new Error(`${name} is not a string`);
162
198
  }
163
-
164
199
  return isString;
165
200
  }
166
-
167
201
  function validateFunction(f) {
168
202
  return f != null && typeof f === 'function';
169
203
  }
170
-
171
204
  function isStringOrBuffer(val) {
172
205
  return typeof val === 'string' || ArrayBuffer.isView(val);
173
206
  }
174
-
175
207
  function validateObject(value, name, options) {
176
208
  const useDefaultOptions = options == null;
177
209
  const allowArray = useDefaultOptions ? false : options.allowArray;
178
210
  const allowFunction = useDefaultOptions ? false : options.allowFunction;
179
211
  const nullable = useDefaultOptions ? false : options.nullable;
180
-
181
212
  if (!nullable && value === null || !allowArray && Array.isArray(value) || typeof value !== 'object' && (!allowFunction || typeof value !== 'function')) {
182
213
  throw new Error(`${name} is not a valid object $${value}`);
183
214
  }
184
-
185
215
  return true;
186
216
  }
187
-
188
- function validateInt32(value, name) {
189
- let min = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : -2147483648;
190
- let max = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 2147483647;
191
-
217
+ function validateInt32(value, name, min = -2147483648, max = 2147483647) {
192
218
  // The defaults for min and max correspond to the limits of 32-bit integers.
193
219
  if (typeof value !== 'number') {
194
220
  throw new Error(`Invalid argument - ${name} is not a number: ${value}`);
195
221
  }
196
-
197
222
  if (!Number.isInteger(value)) {
198
223
  throw new Error(`Argument out of range - ${name} out of integer range: ${value}`);
199
224
  }
200
-
201
225
  if (value < min || value > max) {
202
226
  throw new Error(`Invalid argument - ${name} out of range >= ${min} && <= ${max}: ${value}`);
203
227
  }
204
228
  }
205
-
206
229
  function validateUint32(value, name, positive) {
207
230
  if (typeof value !== 'number') {
208
231
  // throw new ERR_INVALID_ARG_TYPE(name, 'number', value);
209
232
  throw new Error(`Invalid argument - ${name} is not a number: ${value}`);
210
233
  }
211
-
212
234
  if (!Number.isInteger(value)) {
213
235
  // throw new ERR_OUT_OF_RANGE(name, 'an integer', value);
214
236
  throw new Error(`Argument out of range - ${name} out of integer range: ${value}`);
215
237
  }
216
-
217
- const min = positive ? 1 : 0; // 2 ** 32 === 4294967296
218
-
238
+ const min = positive ? 1 : 0;
239
+ // 2 ** 32 === 4294967296
219
240
  const max = 4294967295;
220
-
221
241
  if (value < min || value > max) {
222
242
  // throw new ERR_OUT_OF_RANGE(name, `>= ${min} && <= ${max}`, value);
223
243
  throw new Error(`Invalid argument - ${name} out of range >= ${min} && <= ${max}: ${value}`);
224
244
  }
225
245
  }
246
+ function hasAnyNotIn(set, checks) {
247
+ for (const s of set) {
248
+ if (!checks.includes(s)) {
249
+ return true;
250
+ }
251
+ }
252
+ return false;
253
+ }
254
+ function lazyDOMException(message, domName) {
255
+ let cause = '';
256
+ if (typeof domName !== 'string') {
257
+ cause = `\nCaused by: ${domName.cause}`;
258
+ }
259
+ return new Error(`[${domName}]: ${message}${cause}`);
260
+ }
261
+
262
+ // from lib/internal/crypto/util.js
263
+
264
+ // The maximum buffer size that we'll support in the WebCrypto impl
265
+ const kMaxBufferLength = 2 ** 31 - 1;
266
+
267
+ // // The EC named curves that we currently support via the Web Crypto API.
268
+ // const kNamedCurveAliases = {
269
+ // 'P-256': 'prime256v1',
270
+ // 'P-384': 'secp384r1',
271
+ // 'P-521': 'secp521r1',
272
+ // };
273
+
274
+ // const kAesKeyLengths = [128, 192, 256];
275
+
276
+ // // These are the only hash algorithms we currently support via
277
+ // // the Web Crypto API.
278
+ // const kHashTypes = ['SHA-1', 'SHA-256', 'SHA-384', 'SHA-512'];
279
+
280
+ const kSupportedAlgorithms = {
281
+ 'digest': {
282
+ 'SHA-1': null,
283
+ 'SHA-256': null,
284
+ 'SHA-384': null,
285
+ 'SHA-512': null
286
+ },
287
+ 'generateKey': {
288
+ 'RSASSA-PKCS1-v1_5': 'RsaHashedKeyGenParams',
289
+ 'RSA-PSS': 'RsaHashedKeyGenParams',
290
+ 'RSA-OAEP': 'RsaHashedKeyGenParams',
291
+ 'ECDSA': 'EcKeyGenParams',
292
+ 'ECDH': 'EcKeyGenParams',
293
+ 'AES-CTR': 'AesKeyGenParams',
294
+ 'AES-CBC': 'AesKeyGenParams',
295
+ 'AES-GCM': 'AesKeyGenParams',
296
+ 'AES-KW': 'AesKeyGenParams',
297
+ 'HMAC': 'HmacKeyGenParams',
298
+ 'X25519': null,
299
+ 'Ed25519': null,
300
+ 'X448': null,
301
+ 'Ed448': null
302
+ },
303
+ 'sign': {
304
+ 'RSASSA-PKCS1-v1_5': null,
305
+ 'RSA-PSS': 'RsaPssParams',
306
+ 'ECDSA': 'EcdsaParams',
307
+ 'HMAC': null,
308
+ 'Ed25519': null,
309
+ 'Ed448': 'Ed448Params'
310
+ },
311
+ 'verify': {
312
+ 'RSASSA-PKCS1-v1_5': null,
313
+ 'RSA-PSS': 'RsaPssParams',
314
+ 'ECDSA': 'EcdsaParams',
315
+ 'HMAC': null,
316
+ 'Ed25519': null,
317
+ 'Ed448': 'Ed448Params'
318
+ },
319
+ 'importKey': {
320
+ 'RSASSA-PKCS1-v1_5': 'RsaHashedImportParams',
321
+ 'RSA-PSS': 'RsaHashedImportParams',
322
+ 'RSA-OAEP': 'RsaHashedImportParams',
323
+ 'ECDSA': 'EcKeyImportParams',
324
+ 'ECDH': 'EcKeyImportParams',
325
+ 'HMAC': 'HmacImportParams',
326
+ 'HKDF': null,
327
+ 'PBKDF2': null,
328
+ 'AES-CTR': null,
329
+ 'AES-CBC': null,
330
+ 'AES-GCM': null,
331
+ 'AES-KW': null,
332
+ 'Ed25519': null,
333
+ 'X25519': null,
334
+ 'Ed448': null,
335
+ 'X448': null
336
+ },
337
+ 'deriveBits': {
338
+ HKDF: 'HkdfParams',
339
+ PBKDF2: 'Pbkdf2Params',
340
+ ECDH: 'EcdhKeyDeriveParams',
341
+ X25519: 'EcdhKeyDeriveParams',
342
+ X448: 'EcdhKeyDeriveParams'
343
+ },
344
+ 'encrypt': {
345
+ 'RSA-OAEP': 'RsaOaepParams',
346
+ 'AES-CBC': 'AesCbcParams',
347
+ 'AES-GCM': 'AesGcmParams',
348
+ 'AES-CTR': 'AesCtrParams'
349
+ },
350
+ 'decrypt': {
351
+ 'RSA-OAEP': 'RsaOaepParams',
352
+ 'AES-CBC': 'AesCbcParams',
353
+ 'AES-GCM': 'AesGcmParams',
354
+ 'AES-CTR': 'AesCtrParams'
355
+ },
356
+ 'get key length': {
357
+ 'AES-CBC': 'AesDerivedKeyParams',
358
+ 'AES-CTR': 'AesDerivedKeyParams',
359
+ 'AES-GCM': 'AesDerivedKeyParams',
360
+ 'AES-KW': 'AesDerivedKeyParams',
361
+ 'HMAC': 'HmacImportParams',
362
+ 'HKDF': null,
363
+ 'PBKDF2': null
364
+ },
365
+ 'wrapKey': {
366
+ 'AES-KW': null
367
+ },
368
+ 'unwrapKey': {
369
+ 'AES-KW': null
370
+ }
371
+ };
372
+
373
+ // const simpleAlgorithmDictionaries = {
374
+ // AesGcmParams: { iv: 'BufferSource', additionalData: 'BufferSource' },
375
+ // RsaHashedKeyGenParams: { hash: 'HashAlgorithmIdentifier' },
376
+ // EcKeyGenParams: {},
377
+ // HmacKeyGenParams: { hash: 'HashAlgorithmIdentifier' },
378
+ // RsaPssParams: {},
379
+ // EcdsaParams: { hash: 'HashAlgorithmIdentifier' },
380
+ // HmacImportParams: { hash: 'HashAlgorithmIdentifier' },
381
+ // HkdfParams: {
382
+ // hash: 'HashAlgorithmIdentifier',
383
+ // salt: 'BufferSource',
384
+ // info: 'BufferSource',
385
+ // },
386
+ // Ed448Params: { context: 'BufferSource' },
387
+ // Pbkdf2Params: { hash: 'HashAlgorithmIdentifier', salt: 'BufferSource' },
388
+ // RsaOaepParams: { label: 'BufferSource' },
389
+ // RsaHashedImportParams: { hash: 'HashAlgorithmIdentifier' },
390
+ // EcKeyImportParams: {},
391
+ // };
392
+
393
+ const validateMaxBufferLength = (data, name) => {
394
+ const length = typeof data === 'string' ? data.length : data.byteLength;
395
+ if (length > kMaxBufferLength) {
396
+ throw lazyDOMException(`${name} must be less than ${kMaxBufferLength + 1} bits`, 'OperationError');
397
+ }
398
+ };
399
+
400
+ // https://w3c.github.io/webcrypto/#algorithm-normalization-normalize-an-algorithm
401
+ // adapted for Node.js from Deno's implementation
402
+ // https://github.com/denoland/deno/blob/v1.29.1/ext/crypto/00_crypto.js#L195
403
+ exports.validateMaxBufferLength = validateMaxBufferLength;
404
+ const normalizeAlgorithm = (algorithm, op) => {
405
+ if (typeof algorithm === 'string') return normalizeAlgorithm({
406
+ name: algorithm
407
+ }, op);
408
+
409
+ // 1.
410
+ const registeredAlgorithms = kSupportedAlgorithms[op];
411
+ // 2. 3.
412
+ // commented, because typescript takes care of this for us 🤞👀
413
+ // const initialAlg = webidl.converters.Algorithm(algorithm, {
414
+ // prefix: 'Failed to normalize algorithm',
415
+ // context: 'passed algorithm',
416
+ // });
417
+
418
+ // 4.
419
+ let algName = algorithm.name;
420
+
421
+ // 5.
422
+ let desiredType;
423
+ for (const key in registeredAlgorithms) {
424
+ if (!registeredAlgorithms.hasOwnProperty(key)) {
425
+ continue;
426
+ }
427
+ if (key.toUpperCase() === algName.toUpperCase()) {
428
+ algName = key;
429
+ // @ts-ignore
430
+ desiredType = registeredAlgorithms[algName];
431
+ }
432
+ }
433
+ if (desiredType === undefined) throw lazyDOMException('Unrecognized algorithm name', 'NotSupportedError');
434
+
435
+ // Fast path everything below if the registered dictionary is null
436
+ if (desiredType === null) return {
437
+ name: algName
438
+ };
439
+ throw lazyDOMException(`normalizeAlgorithm() not implemented for ${op} / ${algName} / ${desiredType}`, 'NotSupportedError');
440
+ // TODO: implement these below when needed
441
+
442
+ // // 8.
443
+ // const normalizedAlgorithm = webidl.converters[desiredType](algorithm, {
444
+ // prefix: 'Failed to normalize algorithm',
445
+ // context: 'passed algorithm',
446
+ // });
447
+ // // 9.
448
+ // normalizedAlgorithm.name = algName;
449
+
450
+ // // 9.
451
+ // const dict = simpleAlgorithmDictionaries[desiredType];
452
+ // // 10.
453
+ // const dictKeys = dict ? Object.keys(dict) : [];
454
+ // for (let i = 0; i < dictKeys.length; i++) {
455
+ // const member = dictKeys[i];
456
+ // if (!dict.hasOwnProperty(member)) continue;
457
+ // const idlType = dict[member];
458
+ // const idlValue = normalizedAlgorithm[member];
459
+ // // 3.
460
+ // if (idlType === 'BufferSource' && idlValue) {
461
+ // const isView = ArrayBufferIsView(idlValue);
462
+ // normalizedAlgorithm[member] = TypedArrayPrototypeSlice(
463
+ // new Uint8Array(
464
+ // isView ? getDataViewOrTypedArrayBuffer(idlValue) : idlValue,
465
+ // isView ? getDataViewOrTypedArrayByteOffset(idlValue) : 0,
466
+ // isView
467
+ // ? getDataViewOrTypedArrayByteLength(idlValue)
468
+ // : ArrayBufferPrototypeGetByteLength(idlValue)
469
+ // )
470
+ // );
471
+ // } else if (idlType === 'HashAlgorithmIdentifier') {
472
+ // normalizedAlgorithm[member] = normalizeAlgorithm(idlValue, 'digest');
473
+ // } else if (idlType === 'AlgorithmIdentifier') {
474
+ // // This extension point is not used by any supported algorithm (yet?)
475
+ // throw lazyDOMException('Not implemented.', 'NotSupportedError');
476
+ // }
477
+ // }
478
+
479
+ // return normalizedAlgorithm;
480
+ };
481
+ exports.normalizeAlgorithm = normalizeAlgorithm;
482
+ const validateBitLength = (length, name, required = false) => {
483
+ if (length !== undefined || required) {
484
+ // validateNumber(length, name);
485
+ if (length < 0) throw new Error(`${name} > 0`);
486
+ if (length % 8) {
487
+ throw lazyDOMException(`${name}'s length (${length}) must be a multiple of 8`, 'InvalidArgument');
488
+ }
489
+ }
490
+ };
491
+ exports.validateBitLength = validateBitLength;
492
+ const validateByteLength = (buf, name, target) => {
493
+ if (buf.byteLength !== target) {
494
+ throw lazyDOMException(`${name} must contain exactly ${target} bytes`, 'OperationError');
495
+ }
496
+ };
497
+ exports.validateByteLength = validateByteLength;
498
+ const kKeyOps = {
499
+ sign: 1,
500
+ verify: 2,
501
+ encrypt: 3,
502
+ decrypt: 4,
503
+ wrapKey: 5,
504
+ unwrapKey: 6,
505
+ deriveKey: 7,
506
+ deriveBits: 8
507
+ };
508
+ const validateKeyOps = (keyOps, usagesSet) => {
509
+ if (keyOps === undefined) return;
510
+ if (!Array.isArray(keyOps)) {
511
+ throw lazyDOMException('keyData.key_ops', 'InvalidArgument');
512
+ }
513
+ let flags = 0;
514
+ for (let n = 0; n < keyOps.length; n++) {
515
+ const op = keyOps[n];
516
+ const op_flag = kKeyOps[op];
517
+ // Skipping unknown key ops
518
+ if (op_flag === undefined) continue;
519
+ // Have we seen it already? if so, error
520
+ // eslint-disable-next-line no-bitwise
521
+ if (flags & 1 << op_flag) throw lazyDOMException('Duplicate key operation', 'DataError');
522
+ // eslint-disable-next-line no-bitwise
523
+ flags |= 1 << op_flag;
524
+
525
+ // TODO(@jasnell): RFC7517 section 4.3 strong recommends validating
526
+ // key usage combinations. Specifically, it says that unrelated key
527
+ // ops SHOULD NOT be used together. We're not yet validating that here.
528
+ }
529
+ if (usagesSet !== undefined) {
530
+ for (const use of usagesSet) {
531
+ if (!keyOps.includes(use)) {
532
+ throw lazyDOMException('Key operations and usage mismatch', 'DataError');
533
+ }
534
+ }
535
+ }
536
+ };
537
+ exports.validateKeyOps = validateKeyOps;
226
538
  //# sourceMappingURL=Utils.js.map