react-native-quick-crypto 0.7.0 → 0.7.2

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 (133) hide show
  1. package/README.md +11 -63
  2. package/android/CMakeLists.txt +2 -0
  3. package/cpp/Cipher/MGLRsa.cpp +179 -3
  4. package/cpp/Cipher/MGLRsa.h +40 -0
  5. package/cpp/JSIUtils/MGLJSIUtils.h +8 -0
  6. package/cpp/MGLKeys.cpp +41 -43
  7. package/cpp/MGLKeys.h +9 -2
  8. package/cpp/MGLQuickCryptoHostObject.cpp +6 -6
  9. package/cpp/Sig/MGLSignHostObjects.cpp +22 -15
  10. package/cpp/Utils/MGLUtils.cpp +71 -1
  11. package/cpp/Utils/MGLUtils.h +55 -1
  12. package/cpp/webcrypto/MGLWebCrypto.cpp +89 -37
  13. package/cpp/webcrypto/MGLWebCrypto.h +5 -7
  14. package/cpp/webcrypto/crypto_aes.cpp +516 -0
  15. package/cpp/webcrypto/crypto_aes.h +79 -0
  16. package/cpp/webcrypto/crypto_ec.cpp +4 -20
  17. package/cpp/webcrypto/crypto_ec.h +0 -5
  18. package/cpp/webcrypto/crypto_keygen.cpp +86 -0
  19. package/cpp/webcrypto/crypto_keygen.h +38 -0
  20. package/lib/commonjs/Cipher.js +3 -1
  21. package/lib/commonjs/Cipher.js.map +1 -1
  22. package/lib/commonjs/Hashnames.js +20 -8
  23. package/lib/commonjs/Hashnames.js.map +1 -1
  24. package/lib/commonjs/NativeQuickCrypto/Cipher.js +13 -1
  25. package/lib/commonjs/NativeQuickCrypto/Cipher.js.map +1 -1
  26. package/lib/commonjs/NativeQuickCrypto/NativeQuickCrypto.js.map +1 -1
  27. package/lib/commonjs/NativeQuickCrypto/aes.js +6 -0
  28. package/lib/commonjs/NativeQuickCrypto/aes.js.map +1 -0
  29. package/lib/commonjs/NativeQuickCrypto/keygen.js +6 -0
  30. package/lib/commonjs/NativeQuickCrypto/keygen.js.map +1 -0
  31. package/lib/commonjs/NativeQuickCrypto/rsa.js +6 -0
  32. package/lib/commonjs/NativeQuickCrypto/rsa.js.map +1 -0
  33. package/lib/commonjs/Utils.js +30 -6
  34. package/lib/commonjs/Utils.js.map +1 -1
  35. package/lib/commonjs/aes.js +184 -227
  36. package/lib/commonjs/aes.js.map +1 -1
  37. package/lib/commonjs/index.js +12 -2
  38. package/lib/commonjs/index.js.map +1 -1
  39. package/lib/commonjs/keygen.js +56 -0
  40. package/lib/commonjs/keygen.js.map +1 -0
  41. package/lib/commonjs/keys.js +74 -5
  42. package/lib/commonjs/keys.js.map +1 -1
  43. package/lib/commonjs/rsa.js +115 -196
  44. package/lib/commonjs/rsa.js.map +1 -1
  45. package/lib/commonjs/sig.js.map +1 -1
  46. package/lib/commonjs/subtle.js +140 -78
  47. package/lib/commonjs/subtle.js.map +1 -1
  48. package/lib/commonjs/webcrypto.js +14 -0
  49. package/lib/commonjs/webcrypto.js.map +1 -0
  50. package/lib/module/Cipher.js +3 -1
  51. package/lib/module/Cipher.js.map +1 -1
  52. package/lib/module/Hashnames.js +20 -8
  53. package/lib/module/Hashnames.js.map +1 -1
  54. package/lib/module/NativeQuickCrypto/Cipher.js +12 -0
  55. package/lib/module/NativeQuickCrypto/Cipher.js.map +1 -1
  56. package/lib/module/NativeQuickCrypto/NativeQuickCrypto.js.map +1 -1
  57. package/lib/module/NativeQuickCrypto/aes.js +2 -0
  58. package/lib/module/NativeQuickCrypto/aes.js.map +1 -0
  59. package/lib/module/NativeQuickCrypto/keygen.js +2 -0
  60. package/lib/module/NativeQuickCrypto/keygen.js.map +1 -0
  61. package/lib/module/NativeQuickCrypto/rsa.js +2 -0
  62. package/lib/module/NativeQuickCrypto/rsa.js.map +1 -0
  63. package/lib/module/Utils.js +26 -5
  64. package/lib/module/Utils.js.map +1 -1
  65. package/lib/module/aes.js +183 -228
  66. package/lib/module/aes.js.map +1 -1
  67. package/lib/module/index.js +11 -2
  68. package/lib/module/index.js.map +1 -1
  69. package/lib/module/keygen.js +47 -0
  70. package/lib/module/keygen.js.map +1 -0
  71. package/lib/module/keys.js +68 -4
  72. package/lib/module/keys.js.map +1 -1
  73. package/lib/module/rsa.js +115 -198
  74. package/lib/module/rsa.js.map +1 -1
  75. package/lib/module/sig.js.map +1 -1
  76. package/lib/module/subtle.js +143 -82
  77. package/lib/module/subtle.js.map +1 -1
  78. package/lib/module/webcrypto.js +8 -0
  79. package/lib/module/webcrypto.js.map +1 -0
  80. package/lib/typescript/Cipher.d.ts +0 -1
  81. package/lib/typescript/Cipher.d.ts.map +1 -1
  82. package/lib/typescript/Hash.d.ts.map +1 -1
  83. package/lib/typescript/Hashnames.d.ts +2 -2
  84. package/lib/typescript/Hashnames.d.ts.map +1 -1
  85. package/lib/typescript/NativeQuickCrypto/Cipher.d.ts +5 -0
  86. package/lib/typescript/NativeQuickCrypto/Cipher.d.ts.map +1 -1
  87. package/lib/typescript/NativeQuickCrypto/NativeQuickCrypto.d.ts +4 -1
  88. package/lib/typescript/NativeQuickCrypto/NativeQuickCrypto.d.ts.map +1 -1
  89. package/lib/typescript/NativeQuickCrypto/aes.d.ts +5 -0
  90. package/lib/typescript/NativeQuickCrypto/aes.d.ts.map +1 -0
  91. package/lib/typescript/NativeQuickCrypto/keygen.d.ts +4 -0
  92. package/lib/typescript/NativeQuickCrypto/keygen.d.ts.map +1 -0
  93. package/lib/typescript/NativeQuickCrypto/rsa.d.ts +5 -0
  94. package/lib/typescript/NativeQuickCrypto/rsa.d.ts.map +1 -0
  95. package/lib/typescript/NativeQuickCrypto/webcrypto.d.ts +12 -2
  96. package/lib/typescript/NativeQuickCrypto/webcrypto.d.ts.map +1 -1
  97. package/lib/typescript/Utils.d.ts +4 -4
  98. package/lib/typescript/Utils.d.ts.map +1 -1
  99. package/lib/typescript/aes.d.ts +18 -1
  100. package/lib/typescript/aes.d.ts.map +1 -1
  101. package/lib/typescript/ec.d.ts.map +1 -1
  102. package/lib/typescript/index.d.ts +27 -24
  103. package/lib/typescript/index.d.ts.map +1 -1
  104. package/lib/typescript/keygen.d.ts +6 -0
  105. package/lib/typescript/keygen.d.ts.map +1 -0
  106. package/lib/typescript/keys.d.ts +58 -17
  107. package/lib/typescript/keys.d.ts.map +1 -1
  108. package/lib/typescript/rsa.d.ts +9 -1
  109. package/lib/typescript/rsa.d.ts.map +1 -1
  110. package/lib/typescript/sig.d.ts +3 -17
  111. package/lib/typescript/sig.d.ts.map +1 -1
  112. package/lib/typescript/subtle.d.ts +6 -5
  113. package/lib/typescript/subtle.d.ts.map +1 -1
  114. package/lib/typescript/webcrypto.d.ts +9 -0
  115. package/lib/typescript/webcrypto.d.ts.map +1 -0
  116. package/package.json +12 -12
  117. package/src/Cipher.ts +1 -1
  118. package/src/Hashnames.ts +23 -21
  119. package/src/NativeQuickCrypto/Cipher.ts +32 -0
  120. package/src/NativeQuickCrypto/NativeQuickCrypto.ts +6 -0
  121. package/src/NativeQuickCrypto/aes.ts +14 -0
  122. package/src/NativeQuickCrypto/keygen.ts +7 -0
  123. package/src/NativeQuickCrypto/rsa.ts +12 -0
  124. package/src/NativeQuickCrypto/webcrypto.ts +26 -2
  125. package/src/Utils.ts +37 -8
  126. package/src/aes.ts +259 -222
  127. package/src/index.ts +10 -1
  128. package/src/keygen.ts +80 -0
  129. package/src/keys.ts +143 -30
  130. package/src/rsa.ts +161 -187
  131. package/src/sig.ts +7 -23
  132. package/src/subtle.ts +211 -93
  133. package/src/webcrypto.ts +8 -0
package/src/rsa.ts CHANGED
@@ -1,6 +1,7 @@
1
- // 'use strict';
2
-
1
+ import { KeyVariantLookup } from './NativeQuickCrypto/Cipher';
2
+ import { generateKeyPairPromise } from './Cipher';
3
3
  import { NativeQuickCrypto } from './NativeQuickCrypto/NativeQuickCrypto';
4
+ import type { KeyObjectHandle } from './NativeQuickCrypto/webcrypto';
4
5
  import {
5
6
  lazyDOMException,
6
7
  type BufferLike,
@@ -8,6 +9,10 @@ import {
8
9
  normalizeHashName,
9
10
  HashContext,
10
11
  hasAnyNotIn,
12
+ getUsagesUnion,
13
+ bigIntArrayToUnsignedInt,
14
+ validateMaxBufferLength,
15
+ bufferLikeToArrayBuffer,
11
16
  } from './Utils';
12
17
  import {
13
18
  CryptoKey,
@@ -20,68 +25,20 @@ import {
20
25
  PublicKeyObject,
21
26
  type AnyAlgorithm,
22
27
  KeyType,
28
+ createPublicKey,
29
+ type CryptoKeyPair,
30
+ KWebCryptoKeyFormat,
31
+ CipherOrWrapMode,
32
+ type RsaOaepParams,
33
+ type DigestAlgorithm,
23
34
  } from './keys';
24
35
 
25
- // const {
26
- // SafeSet,
27
- // Uint8Array,
28
- // } = primordials;
29
-
30
- // const {
31
- // KeyObjectHandle,
32
- // RSACipherJob,
33
- // RSAKeyExportJob,
34
- // SignJob,
35
- // kCryptoJobAsync,
36
- // kSignJobModeSign,
37
- // kSignJobModeVerify,
38
- // kKeyVariantRSA_SSA_PKCS1_v1_5,
39
- // kKeyVariantRSA_PSS,
40
- // kKeyVariantRSA_OAEP,
41
- // kKeyTypePrivate,
42
- // kWebCryptoCipherEncrypt,
43
- // RSA_PKCS1_PSS_PADDING,
44
- // } = internalBinding('crypto');
45
-
46
- // const {
47
- // validateInt32,
48
- // } = require('internal/validators');
49
-
50
- // const {
51
- // bigIntArrayToUnsignedInt,
52
- // getUsagesUnion,
53
- // hasAnyNotIn,
54
- // jobPromise,
55
- // normalizeHashName,
56
- // validateKeyOps,
57
- // validateMaxBufferLength,
58
- // kHandle,
59
- // kKeyObject,
60
- // } = require('internal/crypto/util');
61
-
62
- // const {
63
- // lazyDOMException,
64
- // promisify,
65
- // } = require('internal/util');
66
-
67
- // const {
68
- // InternalCryptoKey,
69
- // PrivateKeyObject,
70
- // PublicKeyObject,
71
- // createPublicKey,
72
- // createPrivateKey,
73
- // } = require('internal/crypto/keys');
74
-
75
- // const {
76
- // generateKeyPair: _generateKeyPair,
77
- // } = require('internal/crypto/keygen');
78
-
79
- // const kRsaVariants = {
80
- // 'RSASSA-PKCS1-v1_5': kKeyVariantRSA_SSA_PKCS1_v1_5,
81
- // 'RSA-PSS': kKeyVariantRSA_PSS,
82
- // 'RSA-OAEP': kKeyVariantRSA_OAEP,
83
- // };
84
- // const generateKeyPair = promisify(_generateKeyPair);
36
+ // TODO: keep in in sync with C++ side (cpp/Cipher/MGLRsa.h)
37
+ export enum RSAKeyVariant {
38
+ RSA_SSA_PKCS1_v1_5,
39
+ RSA_PSS,
40
+ RSA_OAEP,
41
+ }
85
42
 
86
43
  function verifyAcceptableRsaKeyUse(
87
44
  name: AnyAlgorithm,
@@ -112,120 +69,137 @@ function verifyAcceptableRsaKeyUse(
112
69
  }
113
70
  }
114
71
 
115
- // function rsaOaepCipher(mode, key, data, { label }) {
116
- // const type = mode === kWebCryptoCipherEncrypt ? 'public' : 'private';
117
- // if (key.type !== type) {
118
- // throw lazyDOMException(
119
- // 'The requested operation is not valid for the provided key',
120
- // 'InvalidAccessError');
121
- // }
122
- // if (label !== undefined) {
123
- // validateMaxBufferLength(label, 'algorithm.label');
124
- // }
72
+ const rsaOaepCipher = (
73
+ mode: CipherOrWrapMode,
74
+ key: CryptoKey,
75
+ data: ArrayBuffer,
76
+ { label }: RsaOaepParams
77
+ ): Promise<ArrayBuffer> => {
78
+ const type =
79
+ mode === CipherOrWrapMode.kWebCryptoCipherEncrypt ? 'public' : 'private';
80
+ if (key.type !== type) {
81
+ throw lazyDOMException(
82
+ 'The requested operation is not valid for the provided key',
83
+ 'InvalidAccessError'
84
+ );
85
+ }
86
+ if (label !== undefined) {
87
+ validateMaxBufferLength(label, 'algorithm.label');
88
+ }
125
89
 
126
- // return jobPromise(() => new RSACipherJob(
127
- // kCryptoJobAsync,
128
- // mode,
129
- // key[kKeyObject][kHandle],
130
- // data,
131
- // kKeyVariantRSA_OAEP,
132
- // normalizeHashName(key.algorithm.hash.name),
133
- // label));
134
- // }
90
+ return NativeQuickCrypto.webcrypto.rsaCipher(
91
+ mode,
92
+ key.keyObject.handle,
93
+ data,
94
+ RSAKeyVariant.RSA_OAEP,
95
+ normalizeHashName(key.algorithm.hash) as DigestAlgorithm,
96
+ label !== undefined ? bufferLikeToArrayBuffer(label) : undefined
97
+ );
98
+ };
135
99
 
136
- // async function rsaKeyGenerate(
137
- // algorithm,
138
- // extractable,
139
- // keyUsages) {
140
-
141
- // const {
142
- // name,
143
- // modulusLength,
144
- // publicExponent,
145
- // hash,
146
- // } = algorithm;
147
-
148
- // const usageSet = new SafeSet(keyUsages);
149
-
150
- // const publicExponentConverted = bigIntArrayToUnsignedInt(publicExponent);
151
- // if (publicExponentConverted === undefined) {
152
- // throw lazyDOMException(
153
- // 'The publicExponent must be equivalent to an unsigned 32-bit value',
154
- // 'OperationError');
155
- // }
100
+ export const rsaCipher = rsaOaepCipher;
156
101
 
157
- // switch (name) {
158
- // case 'RSA-OAEP':
159
- // if (hasAnyNotIn(usageSet,
160
- // ['encrypt', 'decrypt', 'wrapKey', 'unwrapKey'])) {
161
- // throw lazyDOMException(
162
- // 'Unsupported key usage for a RSA key',
163
- // 'SyntaxError');
164
- // }
165
- // break;
166
- // default:
167
- // if (hasAnyNotIn(usageSet, ['sign', 'verify'])) {
168
- // throw lazyDOMException(
169
- // 'Unsupported key usage for a RSA key',
170
- // 'SyntaxError');
171
- // }
172
- // }
102
+ export const rsaKeyGenerate = async (
103
+ algorithm: SubtleAlgorithm,
104
+ extractable: boolean,
105
+ keyUsages: KeyUsage[]
106
+ ): Promise<CryptoKeyPair> => {
107
+ const { name, modulusLength, publicExponent, hash: rawHash } = algorithm;
108
+ const hash: HashAlgorithm = normalizeHashName(rawHash);
173
109
 
174
- // const keypair = await generateKeyPair('rsa', {
175
- // modulusLength,
176
- // publicExponent: publicExponentConverted,
177
- // }).catch((err) => {
178
- // throw lazyDOMException(
179
- // 'The operation failed for an operation-specific reason',
180
- // { name: 'OperationError', cause: err });
181
- // });
182
-
183
- // const keyAlgorithm = {
184
- // name,
185
- // modulusLength,
186
- // publicExponent,
187
- // hash: { name: hash.name },
188
- // };
189
-
190
- // let publicUsages;
191
- // let privateUsages;
192
- // switch (name) {
193
- // case 'RSA-OAEP': {
194
- // publicUsages = getUsagesUnion(usageSet, 'encrypt', 'wrapKey');
195
- // privateUsages = getUsagesUnion(usageSet, 'decrypt', 'unwrapKey');
196
- // break;
197
- // }
198
- // default: {
199
- // publicUsages = getUsagesUnion(usageSet, 'verify');
200
- // privateUsages = getUsagesUnion(usageSet, 'sign');
201
- // break;
202
- // }
203
- // }
110
+ // const usageSet = new SafeSet(keyUsages);
111
+ const publicExponentConverted = bigIntArrayToUnsignedInt(publicExponent);
112
+ if (publicExponentConverted === undefined) {
113
+ throw lazyDOMException(
114
+ 'The publicExponent must be equivalent to an unsigned 32-bit value',
115
+ 'OperationError'
116
+ );
117
+ }
204
118
 
205
- // const publicKey =
206
- // new InternalCryptoKey(
207
- // keypair.publicKey,
208
- // keyAlgorithm,
209
- // publicUsages,
210
- // true);
211
-
212
- // const privateKey =
213
- // new InternalCryptoKey(
214
- // keypair.privateKey,
215
- // keyAlgorithm,
216
- // privateUsages,
217
- // extractable);
218
-
219
- // return { __proto__: null, publicKey, privateKey };
220
- // }
119
+ switch (name) {
120
+ case 'RSA-OAEP':
121
+ if (
122
+ hasAnyNotIn(keyUsages, ['encrypt', 'decrypt', 'wrapKey', 'unwrapKey'])
123
+ ) {
124
+ throw lazyDOMException(
125
+ 'Unsupported key usage for a RSA key',
126
+ 'SyntaxError'
127
+ );
128
+ }
129
+ break;
130
+ default:
131
+ if (hasAnyNotIn(keyUsages, ['sign', 'verify'])) {
132
+ throw lazyDOMException(
133
+ 'Unsupported key usage for a RSA key',
134
+ 'SyntaxError'
135
+ );
136
+ }
137
+ }
221
138
 
222
- // function rsaExportKey(key, format) {
223
- // return jobPromise(() => new RSAKeyExportJob(
224
- // kCryptoJobAsync,
225
- // format,
226
- // key[kKeyObject][kHandle],
227
- // kRsaVariants[key.algorithm.name]));
228
- // }
139
+ const [err, keypair] = await generateKeyPairPromise('rsa', {
140
+ modulusLength,
141
+ publicExponent: publicExponentConverted,
142
+ });
143
+ if (err) {
144
+ throw lazyDOMException(
145
+ 'The operation failed for an operation-specific reason',
146
+ { name: 'OperationError', cause: err }
147
+ );
148
+ }
149
+
150
+ const keyAlgorithm = {
151
+ name,
152
+ modulusLength,
153
+ publicExponent: publicExponentConverted,
154
+ hash,
155
+ };
156
+
157
+ let publicUsages: KeyUsage[] = [];
158
+ let privateUsages: KeyUsage[] = [];
159
+ switch (name) {
160
+ case 'RSA-OAEP': {
161
+ publicUsages = getUsagesUnion(keyUsages, 'encrypt', 'wrapKey');
162
+ privateUsages = getUsagesUnion(keyUsages, 'decrypt', 'unwrapKey');
163
+ break;
164
+ }
165
+ default: {
166
+ publicUsages = getUsagesUnion(keyUsages, 'verify');
167
+ privateUsages = getUsagesUnion(keyUsages, 'sign');
168
+ break;
169
+ }
170
+ }
171
+
172
+ const pub = new PublicKeyObject(keypair?.publicKey as KeyObjectHandle);
173
+ const publicKey = new CryptoKey(pub, keyAlgorithm, publicUsages, true);
174
+
175
+ const priv = new PrivateKeyObject(keypair?.privateKey as KeyObjectHandle);
176
+ const privateKey = new CryptoKey(
177
+ priv,
178
+ keyAlgorithm,
179
+ privateUsages,
180
+ extractable
181
+ );
182
+
183
+ return { publicKey, privateKey };
184
+ };
185
+
186
+ export const rsaExportKey = (
187
+ key: CryptoKey,
188
+ format: KWebCryptoKeyFormat
189
+ ): ArrayBuffer => {
190
+ const variant = KeyVariantLookup[key.algorithm.name];
191
+ if (variant === undefined) {
192
+ throw lazyDOMException(
193
+ `Unrecognized algorithm name '${key.algorithm.name}'`,
194
+ 'NotSupportedError'
195
+ );
196
+ }
197
+ return NativeQuickCrypto.webcrypto.rsaExportKey(
198
+ format,
199
+ key.keyObject.handle,
200
+ variant
201
+ );
202
+ };
229
203
 
230
204
  export const rsaImportKey = (
231
205
  format: ImportFormat,
@@ -235,24 +209,24 @@ export const rsaImportKey = (
235
209
  keyUsages: KeyUsage[]
236
210
  ): CryptoKey => {
237
211
  // const usagesSet = new SafeSet(keyUsages);
238
- let keyObject;
212
+ let keyObject: PublicKeyObject | PrivateKeyObject;
239
213
  switch (format) {
240
- // case 'spki': {
241
- // verifyAcceptableRsaKeyUse(algorithm.name, true, keyUsages);
242
- // try {
243
- // keyObject = createPublicKey({
244
- // key: keyData,
245
- // format: 'der',
246
- // type: 'spki',
247
- // });
248
- // } catch (err) {
249
- // throw lazyDOMException('Invalid keyData', {
250
- // name: 'DataError',
251
- // cause: err,
252
- // });
253
- // }
254
- // break;
255
- // }
214
+ case 'spki': {
215
+ verifyAcceptableRsaKeyUse(algorithm.name, true, keyUsages);
216
+ try {
217
+ keyObject = createPublicKey({
218
+ key: keyData,
219
+ format: 'der',
220
+ type: 'spki',
221
+ });
222
+ } catch (err) {
223
+ throw lazyDOMException('Invalid keyData', {
224
+ name: 'DataError',
225
+ cause: err,
226
+ });
227
+ }
228
+ break;
229
+ }
256
230
  // case 'pkcs8': {
257
231
  // verifyAcceptableRsaKeyUse(algorithm.name, false, keyUsages);
258
232
  // try {
package/src/sig.ts CHANGED
@@ -14,7 +14,11 @@ import {
14
14
  binaryLikeToArrayBuffer,
15
15
  getDefaultEncoding,
16
16
  } from './Utils';
17
- import { preparePrivateKey, preparePublicOrPrivateKey } from './keys';
17
+ import {
18
+ preparePrivateKey,
19
+ preparePublicOrPrivateKey,
20
+ type EncodingOptions,
21
+ } from './keys';
18
22
 
19
23
  const createInternalSign = NativeQuickCrypto.createSign;
20
24
  const createInternalVerify = NativeQuickCrypto.createVerify;
@@ -70,17 +74,7 @@ class Verify extends Stream.Writable {
70
74
  return this;
71
75
  }
72
76
 
73
- verify(
74
- options: {
75
- key: string | Buffer;
76
- format?: string;
77
- type?: string;
78
- passphrase?: string;
79
- padding?: number;
80
- saltLength?: number;
81
- },
82
- signature: BinaryLike
83
- ): boolean {
77
+ verify(options: EncodingOptions, signature: BinaryLike): boolean {
84
78
  if (!options) {
85
79
  throw new Error('Crypto sign key required');
86
80
  }
@@ -129,17 +123,7 @@ class Sign extends Stream.Writable {
129
123
  return this;
130
124
  }
131
125
 
132
- sign(
133
- options: {
134
- key: string | Buffer;
135
- format?: string;
136
- type?: string;
137
- passphrase?: string;
138
- padding?: number;
139
- saltLength?: number;
140
- },
141
- encoding?: string
142
- ) {
126
+ sign(options: EncodingOptions, encoding?: string) {
143
127
  if (!options) {
144
128
  throw new Error('Crypto sign key required');
145
129
  }