react-native-quick-crypto 0.7.10 → 0.7.11

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 (55) hide show
  1. package/android/CMakeLists.txt +59 -62
  2. package/android/build.gradle +7 -7
  3. package/lib/commonjs/Algorithms.js +224 -0
  4. package/lib/commonjs/Algorithms.js.map +1 -0
  5. package/lib/commonjs/Hash.js +1 -1
  6. package/lib/commonjs/Hash.js.map +1 -1
  7. package/lib/commonjs/Hashnames.js +1 -1
  8. package/lib/commonjs/Hashnames.js.map +1 -1
  9. package/lib/commonjs/Utils.js +27 -235
  10. package/lib/commonjs/Utils.js.map +1 -1
  11. package/lib/commonjs/keys.js.map +1 -1
  12. package/lib/commonjs/pbkdf2.js +1 -1
  13. package/lib/commonjs/pbkdf2.js.map +1 -1
  14. package/lib/commonjs/random.js.map +1 -1
  15. package/lib/commonjs/subtle.js +7 -6
  16. package/lib/commonjs/subtle.js.map +1 -1
  17. package/lib/module/Algorithms.js +219 -0
  18. package/lib/module/Algorithms.js.map +1 -0
  19. package/lib/module/Hash.js +1 -1
  20. package/lib/module/Hash.js.map +1 -1
  21. package/lib/module/Hashnames.js +1 -1
  22. package/lib/module/Hashnames.js.map +1 -1
  23. package/lib/module/Utils.js +25 -230
  24. package/lib/module/Utils.js.map +1 -1
  25. package/lib/module/keys.js.map +1 -1
  26. package/lib/module/pbkdf2.js +1 -1
  27. package/lib/module/pbkdf2.js.map +1 -1
  28. package/lib/module/random.js.map +1 -1
  29. package/lib/module/subtle.js +2 -1
  30. package/lib/module/subtle.js.map +1 -1
  31. package/lib/typescript/src/Algorithms.d.ts +4 -0
  32. package/lib/typescript/src/Algorithms.d.ts.map +1 -0
  33. package/lib/typescript/src/Hashnames.d.ts +2 -2
  34. package/lib/typescript/src/Hashnames.d.ts.map +1 -1
  35. package/lib/typescript/src/Utils.d.ts +20 -8
  36. package/lib/typescript/src/Utils.d.ts.map +1 -1
  37. package/lib/typescript/src/index.d.ts +4 -4
  38. package/lib/typescript/src/index.d.ts.map +1 -1
  39. package/lib/typescript/src/keys.d.ts +5 -2
  40. package/lib/typescript/src/keys.d.ts.map +1 -1
  41. package/lib/typescript/src/random.d.ts +5 -6
  42. package/lib/typescript/src/random.d.ts.map +1 -1
  43. package/lib/typescript/src/sig.d.ts +1 -1
  44. package/lib/typescript/src/subtle.d.ts.map +1 -1
  45. package/package.json +40 -52
  46. package/react-native-quick-crypto.podspec +1 -1
  47. package/src/Algorithms.ts +247 -0
  48. package/src/Hash.ts +1 -1
  49. package/src/Hashnames.ts +4 -4
  50. package/src/Utils.ts +34 -279
  51. package/src/keys.ts +5 -1
  52. package/src/pbkdf2.ts +1 -1
  53. package/src/random.ts +16 -24
  54. package/src/subtle.ts +1 -2
  55. package/LICENSE +0 -27
package/src/Utils.ts CHANGED
@@ -1,31 +1,18 @@
1
1
  import { Buffer as CraftzdogBuffer } from '@craftzdog/react-native-buffer';
2
2
  import { Buffer as SafeBuffer } from 'safe-buffer';
3
- import { Buffer as FerossBuffer } from 'buffer';
4
- import type {
5
- AnyAlgorithm,
6
- DeriveBitsAlgorithm,
7
- DigestAlgorithm,
8
- EncryptDecryptAlgorithm,
9
- EncryptDecryptParams,
10
- KeyPairAlgorithm,
11
- KeyUsage,
12
- SecretKeyAlgorithm,
13
- SignVerifyAlgorithm,
14
- SubtleAlgorithm,
15
- } from './keys';
3
+
4
+ import type { KeyUsage } from './keys';
16
5
  import { type CipherKey } from 'crypto'; // @types/node
17
6
 
18
7
  export type BufferLike =
19
8
  | ArrayBuffer
20
9
  | CraftzdogBuffer
21
- | FerossBuffer
22
10
  | SafeBuffer
23
11
  | ArrayBufferView;
24
12
  export type BinaryLike =
25
13
  | string
26
14
  | ArrayBuffer
27
15
  | CraftzdogBuffer
28
- | FerossBuffer
29
16
  | SafeBuffer
30
17
  | TypedArray
31
18
  | DataView;
@@ -91,6 +78,8 @@ export type TypedArray =
91
78
  | Float32Array
92
79
  | Float64Array;
93
80
 
81
+ export type ABV = TypedArray | DataView | ArrayBufferLike | CraftzdogBuffer;
82
+
94
83
  type DOMName =
95
84
  | string
96
85
  | {
@@ -182,18 +171,38 @@ export const kEmptyObject = Object.freeze(Object.create(null));
182
171
  // return slowCases(enc);
183
172
  // }
184
173
 
174
+ /**
175
+ * Converts supplied argument to an ArrayBuffer. Note this does not copy the
176
+ * data so it is faster than toArrayBuffer. Not copying is important for
177
+ * functions like randomFill which need to be able to write to the underlying
178
+ * buffer.
179
+ * @param buf
180
+ * @returns ArrayBuffer
181
+ */
182
+ export function abvToArrayBuffer(buffer: ABV): ArrayBuffer {
183
+ if (CraftzdogBuffer.isBuffer(buffer) || ArrayBuffer.isView(buffer)) {
184
+ return buffer.buffer as ArrayBuffer;
185
+ }
186
+ return buffer as ArrayBuffer;
187
+ }
188
+
189
+ /**
190
+ * Converts supplied argument to an ArrayBuffer. Note this copies data if the
191
+ * supplied buffer has the .slice() method, so can be a bit slow.
192
+ * @param buf
193
+ * @returns ArrayBuffer
194
+ */
185
195
  export function toArrayBuffer(
186
- buf: CraftzdogBuffer | FerossBuffer | SafeBuffer | ArrayBufferView,
196
+ buf: CraftzdogBuffer | SafeBuffer | ArrayBufferView,
187
197
  ): ArrayBuffer {
188
- if (
189
- CraftzdogBuffer.isBuffer(buf) ||
190
- FerossBuffer.isBuffer(buf) ||
191
- ArrayBuffer.isView(buf)
192
- ) {
198
+ if (CraftzdogBuffer.isBuffer(buf) || ArrayBuffer.isView(buf)) {
193
199
  if (buf?.buffer?.slice) {
194
- return buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength);
200
+ return buf.buffer.slice(
201
+ buf.byteOffset,
202
+ buf.byteOffset + buf.byteLength,
203
+ ) as ArrayBuffer;
195
204
  } else {
196
- return buf.buffer;
205
+ throw new Error('This implementation of buffer does not implement slice');
197
206
  }
198
207
  }
199
208
  const ab = new ArrayBuffer(buf.length);
@@ -205,11 +214,7 @@ export function toArrayBuffer(
205
214
  }
206
215
 
207
216
  export function bufferLikeToArrayBuffer(buf: BufferLike): ArrayBuffer {
208
- if (
209
- CraftzdogBuffer.isBuffer(buf) ||
210
- FerossBuffer.isBuffer(buf) ||
211
- SafeBuffer.isBuffer(buf)
212
- ) {
217
+ if (CraftzdogBuffer.isBuffer(buf) || SafeBuffer.isBuffer(buf)) {
213
218
  return toArrayBuffer(buf);
214
219
  }
215
220
  if (ArrayBuffer.isView(buf)) {
@@ -239,11 +244,7 @@ export function binaryLikeToArrayBuffer(
239
244
  }
240
245
 
241
246
  // Buffer
242
- if (
243
- CraftzdogBuffer.isBuffer(input) ||
244
- FerossBuffer.isBuffer(input) ||
245
- SafeBuffer.isBuffer(input)
246
- ) {
247
+ if (CraftzdogBuffer.isBuffer(input) || SafeBuffer.isBuffer(input)) {
247
248
  return toArrayBuffer(input);
248
249
  }
249
250
 
@@ -411,156 +412,6 @@ const kMaxBufferLength = 2 ** 31 - 1;
411
412
  // // the Web Crypto API.
412
413
  // const kHashTypes = ['SHA-1', 'SHA-256', 'SHA-384', 'SHA-512'];
413
414
 
414
- type SupportedAlgorithm<Type extends string> = {
415
- [key in Type]: string | null;
416
- };
417
-
418
- type SupportedAlgorithms = {
419
- digest: SupportedAlgorithm<DigestAlgorithm>;
420
- generateKey: SupportedAlgorithm<KeyPairAlgorithm | SecretKeyAlgorithm>;
421
- sign: SupportedAlgorithm<SignVerifyAlgorithm>;
422
- verify: SupportedAlgorithm<SignVerifyAlgorithm>;
423
- importKey: SupportedAlgorithm<
424
- KeyPairAlgorithm | 'PBKDF2' | SecretKeyAlgorithm | 'HKDF'
425
- >;
426
- deriveBits: SupportedAlgorithm<DeriveBitsAlgorithm>;
427
- encrypt: SupportedAlgorithm<EncryptDecryptAlgorithm>;
428
- decrypt: SupportedAlgorithm<EncryptDecryptAlgorithm>;
429
- 'get key length': SupportedAlgorithm<SecretKeyAlgorithm | 'PBKDF2' | 'HKDF'>;
430
- wrapKey: SupportedAlgorithm<'AES-KW'>;
431
- unwrapKey: SupportedAlgorithm<'AES-KW'>;
432
- };
433
-
434
- export type Operation =
435
- | 'digest'
436
- | 'generateKey'
437
- | 'sign'
438
- | 'verify'
439
- | 'importKey'
440
- | 'deriveBits'
441
- | 'encrypt'
442
- | 'decrypt'
443
- | 'get key length'
444
- | 'wrapKey'
445
- | 'unwrapKey';
446
-
447
- const kSupportedAlgorithms: SupportedAlgorithms = {
448
- digest: {
449
- 'SHA-1': null,
450
- 'SHA-256': null,
451
- 'SHA-384': null,
452
- 'SHA-512': null,
453
- },
454
- generateKey: {
455
- 'RSASSA-PKCS1-v1_5': 'RsaHashedKeyGenParams',
456
- 'RSA-PSS': 'RsaHashedKeyGenParams',
457
- 'RSA-OAEP': 'RsaHashedKeyGenParams',
458
- ECDSA: 'EcKeyGenParams',
459
- ECDH: 'EcKeyGenParams',
460
- 'AES-CTR': 'AesKeyGenParams',
461
- 'AES-CBC': 'AesKeyGenParams',
462
- 'AES-GCM': 'AesKeyGenParams',
463
- 'AES-KW': 'AesKeyGenParams',
464
- HMAC: 'HmacKeyGenParams',
465
- X25519: null,
466
- Ed25519: null,
467
- X448: null,
468
- Ed448: null,
469
- },
470
- sign: {
471
- 'RSASSA-PKCS1-v1_5': null,
472
- 'RSA-PSS': 'RsaPssParams',
473
- ECDSA: 'EcdsaParams',
474
- HMAC: null,
475
- Ed25519: null,
476
- Ed448: 'Ed448Params',
477
- },
478
- verify: {
479
- 'RSASSA-PKCS1-v1_5': null,
480
- 'RSA-PSS': 'RsaPssParams',
481
- ECDSA: 'EcdsaParams',
482
- HMAC: null,
483
- Ed25519: null,
484
- Ed448: 'Ed448Params',
485
- },
486
- importKey: {
487
- 'RSASSA-PKCS1-v1_5': 'RsaHashedImportParams',
488
- 'RSA-PSS': 'RsaHashedImportParams',
489
- 'RSA-OAEP': 'RsaHashedImportParams',
490
- ECDSA: 'EcKeyImportParams',
491
- ECDH: 'EcKeyImportParams',
492
- HMAC: 'HmacImportParams',
493
- HKDF: null,
494
- PBKDF2: null,
495
- 'AES-CTR': null,
496
- 'AES-CBC': null,
497
- 'AES-GCM': null,
498
- 'AES-KW': null,
499
- Ed25519: null,
500
- X25519: null,
501
- Ed448: null,
502
- X448: null,
503
- },
504
- deriveBits: {
505
- HKDF: 'HkdfParams',
506
- PBKDF2: 'Pbkdf2Params',
507
- ECDH: 'EcdhKeyDeriveParams',
508
- X25519: 'EcdhKeyDeriveParams',
509
- X448: 'EcdhKeyDeriveParams',
510
- },
511
- encrypt: {
512
- 'RSA-OAEP': 'RsaOaepParams',
513
- 'AES-CBC': 'AesCbcParams',
514
- 'AES-GCM': 'AesGcmParams',
515
- 'AES-CTR': 'AesCtrParams',
516
- },
517
- decrypt: {
518
- 'RSA-OAEP': 'RsaOaepParams',
519
- 'AES-CBC': 'AesCbcParams',
520
- 'AES-GCM': 'AesGcmParams',
521
- 'AES-CTR': 'AesCtrParams',
522
- },
523
- 'get key length': {
524
- 'AES-CBC': 'AesDerivedKeyParams',
525
- 'AES-CTR': 'AesDerivedKeyParams',
526
- 'AES-GCM': 'AesDerivedKeyParams',
527
- 'AES-KW': 'AesDerivedKeyParams',
528
- HMAC: 'HmacImportParams',
529
- HKDF: null,
530
- PBKDF2: null,
531
- },
532
- wrapKey: {
533
- 'AES-KW': null,
534
- },
535
- unwrapKey: {
536
- 'AES-KW': null,
537
- },
538
- };
539
-
540
- type AlgorithmDictionaries = {
541
- [key in string]: object;
542
- };
543
-
544
- const simpleAlgorithmDictionaries: AlgorithmDictionaries = {
545
- AesGcmParams: { iv: 'BufferSource', additionalData: 'BufferSource' },
546
- RsaHashedKeyGenParams: { hash: 'HashAlgorithmIdentifier' },
547
- EcKeyGenParams: {},
548
- HmacKeyGenParams: { hash: 'HashAlgorithmIdentifier' },
549
- RsaPssParams: {},
550
- EcdsaParams: { hash: 'HashAlgorithmIdentifier' },
551
- HmacImportParams: { hash: 'HashAlgorithmIdentifier' },
552
- HkdfParams: {
553
- hash: 'HashAlgorithmIdentifier',
554
- salt: 'BufferSource',
555
- info: 'BufferSource',
556
- },
557
- Ed448Params: { context: 'BufferSource' },
558
- Pbkdf2Params: { hash: 'HashAlgorithmIdentifier', salt: 'BufferSource' },
559
- RsaOaepParams: { label: 'BufferSource' },
560
- RsaHashedImportParams: { hash: 'HashAlgorithmIdentifier' },
561
- EcKeyImportParams: {},
562
- };
563
-
564
415
  export const validateMaxBufferLength = (
565
416
  data: BinaryLike | BufferLike,
566
417
  name: string,
@@ -577,92 +428,6 @@ export const validateMaxBufferLength = (
577
428
  }
578
429
  };
579
430
 
580
- // https://w3c.github.io/webcrypto/#algorithm-normalization-normalize-an-algorithm
581
- // adapted for Node.js from Deno's implementation
582
- // https://github.com/denoland/deno/blob/v1.29.1/ext/crypto/00_crypto.js#L195
583
- export const normalizeAlgorithm = (
584
- algorithm: SubtleAlgorithm | EncryptDecryptParams | AnyAlgorithm,
585
- op: Operation,
586
- ): SubtleAlgorithm | EncryptDecryptParams => {
587
- if (typeof algorithm === 'string') {
588
- return normalizeAlgorithm({ name: algorithm }, op);
589
- }
590
-
591
- // 1.
592
- const registeredAlgorithms = kSupportedAlgorithms[op];
593
- // 2. 3.
594
- // commented, because typescript takes care of this for us 🤞👀
595
- // const initialAlg = webidl.converters.Algorithm(algorithm, {
596
- // prefix: 'Failed to normalize algorithm',
597
- // context: 'passed algorithm',
598
- // });
599
-
600
- // 4.
601
- let algName = algorithm.name;
602
- if (algName === undefined) return { name: 'unknown' };
603
-
604
- // 5.
605
- let desiredType: string | null | undefined;
606
- for (const key in registeredAlgorithms) {
607
- if (!Object.prototype.hasOwnProperty.call(registeredAlgorithms, key)) {
608
- continue;
609
- }
610
- if (key.toUpperCase() === algName.toUpperCase()) {
611
- algName = key as AnyAlgorithm;
612
- desiredType = (
613
- registeredAlgorithms as Record<string, typeof desiredType>
614
- )[algName];
615
- }
616
- }
617
- if (desiredType === undefined)
618
- throw lazyDOMException('Unrecognized algorithm name', 'NotSupportedError');
619
-
620
- // Fast path everything below if the registered dictionary is null
621
- if (desiredType === null) return { name: algName };
622
-
623
- // 6.
624
- const normalizedAlgorithm = algorithm;
625
- // TODO: implement this? Maybe via typescript?
626
- // webidl.converters[desiredType](algorithm, {
627
- // prefix: 'Failed to normalize algorithm',
628
- // context: 'passed algorithm',
629
- // });
630
- // 7.
631
- normalizedAlgorithm.name = algName;
632
-
633
- // 9.
634
- const dict = simpleAlgorithmDictionaries[desiredType];
635
- // 10.
636
- const dictKeys = dict ? Object.keys(dict) : [];
637
- for (let i = 0; i < dictKeys.length; i++) {
638
- const member = dictKeys[i] || '';
639
- if (!Object.prototype.hasOwnProperty.call(dict, member)) continue;
640
- // TODO: implement this? Maybe via typescript?
641
- // const idlType = dict[member];
642
- // const idlValue = normalizedAlgorithm[member];
643
- // 3.
644
- // if (idlType === 'BufferSource' && idlValue) {
645
- // const isView = ArrayBufferIsView(idlValue);
646
- // normalizedAlgorithm[member] = TypedArrayPrototypeSlice(
647
- // new Uint8Array(
648
- // isView ? getDataViewOrTypedArrayBuffer(idlValue) : idlValue,
649
- // isView ? getDataViewOrTypedArrayByteOffset(idlValue) : 0,
650
- // isView
651
- // ? getDataViewOrTypedArrayByteLength(idlValue)
652
- // : ArrayBufferPrototypeGetByteLength(idlValue)
653
- // )
654
- // );
655
- // } else if (idlType === 'HashAlgorithmIdentifier') {
656
- // normalizedAlgorithm[member] = normalizeAlgorithm(idlValue, 'digest');
657
- // } else if (idlType === 'AlgorithmIdentifier') {
658
- // // This extension point is not used by any supported algorithm (yet?)
659
- // throw lazyDOMException('Not implemented.', 'NotSupportedError');
660
- // }
661
- }
662
-
663
- return normalizedAlgorithm;
664
- };
665
-
666
431
  export const validateBitLength = (
667
432
  length: number,
668
433
  name: string,
@@ -778,16 +543,6 @@ export const bigIntArrayToUnsignedInt = (
778
543
  return result;
779
544
  };
780
545
 
781
- export function abvToArrayBuffer(buffer: ArrayBufferView): ArrayBuffer {
782
- if (CraftzdogBuffer.isBuffer(buffer)) {
783
- return buffer.buffer;
784
- }
785
- if (ArrayBuffer.isView(buffer)) {
786
- return buffer.buffer;
787
- }
788
- return buffer;
789
- }
790
-
791
546
  // TODO: these used to be shipped by crypto-browserify in quickcrypto v0.6
792
547
  // could instead fetch from OpenSSL if needed and handle breaking changes
793
548
  export const getHashes = () => [
package/src/keys.ts CHANGED
@@ -119,13 +119,17 @@ export type SubtleAlgorithm = {
119
119
  name: AnyAlgorithm;
120
120
  salt?: string;
121
121
  iterations?: number;
122
- hash?: HashAlgorithm;
122
+ hash?: HashAlgorithm | HashAlgorithmIdentifier;
123
123
  namedCurve?: NamedCurve;
124
124
  length?: number;
125
125
  modulusLength?: number;
126
126
  publicExponent?: number | Uint8Array;
127
127
  };
128
128
 
129
+ export type HashAlgorithmIdentifier = {
130
+ name: HashAlgorithm;
131
+ };
132
+
129
133
  export type KeyUsage =
130
134
  | 'encrypt'
131
135
  | 'decrypt'
package/src/pbkdf2.ts CHANGED
@@ -83,7 +83,7 @@ export function pbkdf2Sync(
83
83
  algo,
84
84
  );
85
85
 
86
- return Buffer.from(result);
86
+ return result;
87
87
  }
88
88
 
89
89
  // We need this because the typescript overload signatures in pbkdf2() above do
package/src/random.ts CHANGED
@@ -1,31 +1,29 @@
1
1
  import { abvToArrayBuffer } from './Utils';
2
2
  import { NativeQuickCrypto } from './NativeQuickCrypto/NativeQuickCrypto';
3
3
  import { Buffer } from '@craftzdog/react-native-buffer';
4
- import type { TypedArray } from './Utils';
4
+ import type { ABV } from './Utils';
5
5
 
6
6
  const random = NativeQuickCrypto.random;
7
7
 
8
- type RandomBuffer = TypedArray | DataView | ArrayBufferLike | Buffer;
9
-
10
- export function randomFill<T extends RandomBuffer>(
8
+ export function randomFill<T extends ABV>(
11
9
  buffer: T,
12
10
  callback: (err: Error | null, buf: T) => void,
13
11
  ): void;
14
12
 
15
- export function randomFill<T extends RandomBuffer>(
13
+ export function randomFill<T extends ABV>(
16
14
  buffer: T,
17
15
  offset: number,
18
16
  callback: (err: Error | null, buf: T) => void,
19
17
  ): void;
20
18
 
21
- export function randomFill<T extends RandomBuffer>(
19
+ export function randomFill<T extends ABV>(
22
20
  buffer: T,
23
21
  offset: number,
24
22
  size: number,
25
23
  callback: (err: Error | null, buf: T) => void,
26
24
  ): void;
27
25
 
28
- export function randomFill(buffer: RandomBuffer, ...rest: unknown[]): void {
26
+ export function randomFill(buffer: ABV, ...rest: unknown[]): void {
29
27
  if (typeof rest[rest.length - 1] !== 'function') {
30
28
  throw new Error('No callback provided to randomFill');
31
29
  }
@@ -47,31 +45,25 @@ export function randomFill(buffer: RandomBuffer, ...rest: unknown[]): void {
47
45
  offset = rest[0] as number;
48
46
  }
49
47
 
50
- random
51
- .randomFill(abvToArrayBuffer(buffer as ArrayBufferView), offset, size)
52
- .then(
53
- (res: ArrayBuffer) => {
54
- callback(null, res);
55
- },
56
- (e: Error) => {
57
- callback(e);
58
- },
59
- );
48
+ random.randomFill(abvToArrayBuffer(buffer), offset, size).then(
49
+ (res: ArrayBuffer) => {
50
+ callback(null, res);
51
+ },
52
+ (e: Error) => {
53
+ callback(e);
54
+ },
55
+ );
60
56
  }
61
57
 
62
- export function randomFillSync<T extends RandomBuffer>(
58
+ export function randomFillSync<T extends ABV>(
63
59
  buffer: T,
64
60
  offset?: number,
65
61
  size?: number,
66
62
  ): T;
67
63
 
68
- export function randomFillSync(
69
- buffer: RandomBuffer,
70
- offset: number = 0,
71
- size?: number,
72
- ) {
64
+ export function randomFillSync(buffer: ABV, offset: number = 0, size?: number) {
73
65
  return random.randomFillSync(
74
- abvToArrayBuffer(buffer as ArrayBufferView),
66
+ abvToArrayBuffer(buffer),
75
67
  offset,
76
68
  size ?? buffer.byteLength,
77
69
  );
package/src/subtle.ts CHANGED
@@ -17,11 +17,9 @@ import {
17
17
  hasAnyNotIn,
18
18
  type BufferLike,
19
19
  type BinaryLike,
20
- normalizeAlgorithm,
21
20
  lazyDOMException,
22
21
  normalizeHashName,
23
22
  HashContext,
24
- type Operation,
25
23
  validateMaxBufferLength,
26
24
  bufferLikeToArrayBuffer,
27
25
  } from './Utils';
@@ -35,6 +33,7 @@ import {
35
33
  getAlgorithmName,
36
34
  } from './aes';
37
35
  import { rsaCipher, rsaExportKey, rsaImportKey, rsaKeyGenerate } from './rsa';
36
+ import { normalizeAlgorithm, type Operation } from './Algorithms';
38
37
 
39
38
  const exportKeySpki = async (
40
39
  key: CryptoKey,
package/LICENSE DELETED
@@ -1,27 +0,0 @@
1
- **react-native-quick-crypto**
2
-
3
- MIT License
4
-
5
- Copyright (c) 2021 Margelo GmbH
6
-
7
- Permission is hereby granted, free of charge, to any person obtaining a copy
8
- of this software and associated documentation files (the "Software"), to deal
9
- in the Software without restriction, including without limitation the rights
10
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
- copies of the Software, and to permit persons to whom the Software is
12
- furnished to do so, subject to the following conditions:
13
-
14
- The above copyright notice and this permission notice shall be included in all
15
- copies or substantial portions of the Software.
16
-
17
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
- SOFTWARE.
24
-
25
- **NodeJS Crypto**
26
-
27
- See https://github.com/nodejs/node/blob/main/LICENSE