diff --git a/lib/index.js b/lib/index.js index ef415a2..e7bcc23 100644 --- a/lib/index.js +++ b/lib/index.js @@ -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'; }