-
-
Notifications
You must be signed in to change notification settings - Fork 351
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
fromKeyLike
does not return an object (JWK). If you use the output of this function in the latest version of node you get the following error:
TypeError: JWK must be an object
To Reproduce
Use Node v15.14.0.
const key = crypto.generateKeyPairSync("ec", {
namedCurve: "secp256k1",
});
const privateJwk = await fromKeyLike(key.privateKey);
// ^^^^^^^^^^ this is not an object
const privateKey = await parseJwk(privateJwk, "ES256K");
// TypeError: JWK must be an object
Expected behaviour
Get proper object so as to be able to use JWK.
Environment:
jose
version: 3.11.4- Typescript v4.2.4
- affected runtime is: Node.js v15.14.0
Additional context
If anyone faces the same issue, there are two tricks that can save you:
- Do not use
privateJwk
in the next function as input but{...privateJwk }
or - After getting
privateJwk
setjwk.constructor = Object;
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working