Skip to content

Commit

Permalink
Separate out func that returns just the keyPair.
Browse files Browse the repository at this point in the history
  • Loading branch information
aljones15 committed Jun 5, 2024
1 parent 932442e commit b7de3cb
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions tests/vc-generator/key-gen.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,7 @@ export const getMultikeys = async ({keyTypes}) => {
if(!new Set(keyTypes).has(keyType)) {
continue;
}
// require the exported keyPair
const serializedKeyPair = require(`../${keys[keyType]}`);
// check format keyPair to ensure it's interoperable with multikey spec
const formattedKey = formatKey(serializedKeyPair);
const key = await EcdsaMultikey.from(formattedKey);
const key = await getMultiKey({keyType});
const signer = key.signer();
// The issuer needs to match the signer or the controller of the signer
const issuer = `did:key:${key.publicKeyMultibase}`;
Expand All @@ -44,3 +40,11 @@ export const getMultikeys = async ({keyTypes}) => {
}
return _keys;
};

export async function getMultiKey({keyType}) {
// require the exported keyPair
const serializedKeyPair = require(`../${keys[keyType]}`);
// check format keyPair to ensure it's interoperable with multikey spec
const formattedKey = formatKey(serializedKeyPair);
return EcdsaMultikey.from(formattedKey);
}

0 comments on commit b7de3cb

Please sign in to comment.