Skip to content

Commit

Permalink
Only attempt publicKeyJwk import for non-Multikey type.
Browse files Browse the repository at this point in the history
  • Loading branch information
dlongley committed Mar 18, 2024
1 parent 4124171 commit 7d49c49
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,13 @@ export async function from(key, options = {}) {

let multikey = {...key};
if(multikey.type && multikey.type !== 'Multikey') {
// attempt loading from JWK if `publicKeyJwk` is present
if(multikey.publicKeyJwk) {
return fromJwk({jwk: multikey.publicKeyJwk, secretKey: true});
}
multikey = await toMultikey({keyPair: multikey});
return _createKeyPairInterface({keyPair: multikey, keyAgreement});
}
// attempt loading from JWK if `publicKeyJwk` is present
if(multikey.publicKeyJwk) {
return fromJwk({jwk: multikey.publicKeyJwk, secretKey: true});
}
if(!multikey.type) {
multikey.type = 'Multikey';
}
Expand Down

0 comments on commit 7d49c49

Please sign in to comment.