8000
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 027b0ff commit 540b1dbCopy full SHA for 540b1db
lib/internal/crypto/cfrg.js
@@ -27,7 +27,6 @@ const {
27
} = require('internal/crypto/util');
28
29
const {
30
- emitExperimentalWarning,
31
lazyDOMException,
32
promisify,
33
} = require('internal/util');
@@ -105,7 +104,6 @@ function createCFRGRawKey(name, keyData, isPublic) {
105
104
106
async function cfrgGenerateKey(algorithm, extractable, keyUsages) {
107
const { name } = algorithm;
108
- emitExperimentalWarning(`The ${name} Web Crypto API algorithm`);
109
110
const usageSet = new SafeSet(keyUsages);
111
switch (name) {
@@ -187,7 +185,6 @@ async function cfrgGenerateKey(algorithm, extractable, keyUsages) {
187
185
}
188
186
189
function cfrgExportKey(key, format) {
190
- emitExperimentalWarning(`The ${key.algorithm.name} Web Crypto API algorithm`);
191
return jobPromise(() => new ECKeyExportJob(
192
kCryptoJobAsync,
193
format,
@@ -202,7 +199,6 @@ async function cfrgImportKey(
202
199
keyUsages) {
203
200
204
201
205
206
let keyObject;
207
const usagesSet = new SafeSet(keyUsages);
208
switch (format) {
@@ -319,7 +315,6 @@ async function cfrgImportKey(
319
315
320
316
321
317
function eddsaSignVerify(key, data, { name, context }, signature) {
322
323
318
const mode = signature === undefined ? kSignJobModeSign : kSignJobModeVerify;
324
const type = mode === kSignJobModeSign ? 'private' : 'public';
325
lib/internal/crypto/util.js
@@ -11,6 +11,8 @@ const {
11
DataViewPrototypeGetByteOffset,
12
FunctionPrototypeBind,
13
Number,
14
+ ObjectDefineProperty,
15
+ ObjectEntries,
16
ObjectKeys,
17
ObjectPrototypeHasOwnProperty,
18
Promise,
@@ -63,6 +65,7 @@ const { Buffer } = require('buffer');
63
65
64
66
67
cachedResult,
68
+ emitExperimentalWarning,
69
filterDuplicateStrings,
70
71
@@ -195,26 +198,18 @@ const kSupportedAlgorithms = {
195
198
'AES-GCM': 'AesKeyGenParams',
196
'AES-KW': 'AesKeyGenParams',
197
'HMAC': 'HmacKeyGenParams',
- 'X25519': null,
- 'Ed25519': null,
- 'X448': null,
- 'Ed448': null,
},
'sign': {
'RSASSA-PKCS1-v1_5': null,
'RSA-PSS': 'RsaPssParams',
'ECDSA': 'EcdsaParams',
'HMAC': null,
209
- 'Ed448': 'Ed448Params',
210
211
'verify': {
212
213
214
215
216
217
218
219
'importKey': {
220
'RSASSA-PKCS1-v1_5': 'RsaHashedImportParams',
@@ -229,17 +224,11 @@ const kSupportedAlgorithms = {
229
224
'AES-CBC': null,
230
225
'AES-GCM': null,
231
226
'AES-KW': null,
232
233
234
235
236
227
237
228
'deriveBits': {
238
'HKDF': 'HkdfParams',
239
'PBKDF2': 'Pbkdf2Params',
240
'ECDH': 'EcdhKeyDeriveParams',
241
- 'X25519': 'EcdhKeyDeriveParams',
242
- 'X448': 'EcdhKeyDeriveParams',
243
244
'encrypt': {
245
'RSA-OAEP': 'RsaOaepParams',
@@ -270,6 +259,47 @@ const kSupportedAlgorithms = {
270
259
271
260
};
272
261
262
+const experimentalAlgorithms = ObjectEntries({
263
+ 'X25519': {
264
+ generateKey: null,
265
+ importKey: null,
266
+ deriveBits: 'EcdhKeyDeriveParams',
267
+ },
268
+ 'Ed25519': {
269
+ sign: null,
+ verify: null,
273
274
+ 'X448': {
275
276
277
278
279
+ 'Ed448': {
280
281
+ sign: 'Ed448Params',
282
+ verify: 'Ed448Params',
283
284
285
+});
286
+
287
+for (let i = 0; i < experimentalAlgorithms.length; i++) {
288
+ const name = experimentalAlgorithms[i][0];
289
+ const ops = ObjectEntries(experimentalAlgorithms[i][1]);
290
+ for (let j = 0; j < ops.length; j++) {
291
+ const { 0: op, 1: dict } = ops[j];
292
+ ObjectDefineProperty(kSupportedAlgorithms[op], name, {
293
+ get() {
294
+ emitExperimentalWarning(`The ${name} Web Crypto API algorithm`);
295
+ return dict;
296
297
+ __proto__: null,
298
+ enumerable: true,
299
+ });
300
+ }
301
+}
302
303
const simpleAlgorithmDictionaries = {
304
AesGcmParams: { iv: 'BufferSource', additionalData: 'BufferSource' },
305
RsaHashedKeyGenParams: { hash: 'HashAlgorithmIdentifier' },