File tree Expand file tree Collapse file tree 2 files changed +34
-1
lines changed Expand file tree Collapse file tree 2 files changed +34
-1
lines changed Original file line number Diff line number Diff line change @@ -303,7 +303,7 @@ async function ecImportKey(
303303 keyObject = createECRawKey (
304304 namedCurve ,
305305 Buffer . from (
306- isPublic ? keyData . k : keyData . d ,
306+ isPublic ? keyData . x : keyData . d ,
307307 'base64' ) ,
308308 isPublic ) ;
309309 break ;
Original file line number Diff line number Diff line change @@ -244,3 +244,36 @@ assert.rejects(
244244 {
245245 message : / U n s u p p o r t e d n a m e d c u r v e s f o r E C D H /
246246 } ) ;
247+
248+ {
249+ // Private JWK import
250+ subtle . importKey (
251+ 'jwk' ,
252+ {
253+ crv : 'X25519' ,
254+ d : '8CE-XY7cvbR-Pu7mILHq8YZ4hLGAA2-RD01he5q2wUA' ,
255+ x : '42IbTo34ZYANub5o42547vB6OxdEd44ztwZewoRch0Q' ,
256+ kty : 'OKP'
257+ } ,
258+ {
259+ name : 'ECDH' ,
260+ namedCurve : 'NODE-X25519'
261+ } ,
262+ true ,
263+ [ 'deriveBits' ] ) . then ( common . mustCall ( ) ) ;
264+
265+ // Public JWK import
266+ subtle . importKey (
267+ 'jwk' ,
268+ {
269+ crv : 'X25519' ,
270+ x : '42IbTo34ZYANub5o42547vB6OxdEd44ztwZewoRch0Q' ,
271+ kty : 'OKP'
272+ } ,
273+ {
274+ name : 'ECDH' ,
275+ namedCurve : 'NODE-X25519'
276+ } ,
277+ true ,
278+ [ ] ) . then ( common . mustCall ( ) ) ;
279+ }
You can’t perform that action at this time.
0 commit comments