@@ -251,13 +251,8 @@ async function testImportJwk({ name, publicUsages, privateUsages }, extractable)
251
251
assert . strictEqual ( pvtJwk . crv , jwk . crv ) ;
252
252
assert . strictEqual ( pvtJwk . d , jwk . d ) ;
253
253
254
- if ( jwk . crv . startsWith ( 'Ed' ) ) {
255
- assert . strictEqual ( pubJwk . alg , 'EdDSA' ) ;
256
- assert . strictEqual ( pvtJwk . alg , 'EdDSA' ) ;
257
- } else {
258
- assert . strictEqual ( pubJwk . alg , undefined ) ;
259
- assert . strictEqual ( pvtJwk . alg , undefined ) ;
260
- }
254
+ assert . strictEqual ( pubJwk . alg , undefined ) ;
255
+ assert . strictEqual ( pvtJwk . alg , undefined ) ;
261
256
} else {
262
257
await assert . rejects (
263
258
subtle . exportKey ( 'jwk' , publicKey ) , {
@@ -281,24 +276,22 @@ async function testImportJwk({ name, publicUsages, privateUsages }, extractable)
281
276
{ message : 'Invalid JWK "use" Parameter' } ) ;
282
277
}
283
278
279
+ // The JWK alg member is ignored
280
+ // https://github.com/WICG/webcrypto-secure-curves/pull/24
284
281
if ( name . startsWith ( 'Ed' ) ) {
285
- await assert . rejects (
286
- subtle . importKey (
287
- 'jwk' ,
288
- { kty : jwk . kty , x : jwk . x , crv : jwk . crv , alg : 'foo' } ,
289
- { name } ,
290
- extractable ,
291
- publicUsages ) ,
292
- { message : 'JWK "alg" does not match the requested algorithm' } ) ;
282
+ await subtle . importKey (
283
+ 'jwk' ,
284
+ { kty : jwk . kty , x : jwk . x , crv : jwk . crv , alg : 'foo' } ,
285
+ { name } ,
286
+ extractable ,
287
+ publicUsages ) ;
293
288
294
- await assert . rejects (
295
- subtle . importKey (
296
- 'jwk' ,
297
- { ...jwk , alg : 'foo' } ,
298
- { name } ,
299
- extractable ,
300
- privateUsages ) ,
301
- { message : 'JWK "alg" does not match the requested algorithm' } ) ;
289
+ await subtle . importKey (
290
+ 'jwk' ,
291
+ { ...jwk , alg : 'foo' } ,
292
+ { name } ,
293
+ extractable ,
294
+ privateUsages ) ;
302
295
}
303
296
304
297
for ( const crv of [ undefined , name === 'Ed25519' ? 'Ed448' : 'Ed25519' ] ) {
0 commit comments