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 a263230 commit e6642e7
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 @@ -41,13 +41,13 @@ export async function generate({id, controller, seed} = {}) {
export async function from(key) {
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});
}
// 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 e6642e7

Please sign in to comment.