Skip to content

Instantly share code, notes, and snippets.

@OR13
Created June 18, 2019 02:39
Show Gist options
  • Save OR13/ea635504c77b6ebf0d4f0f7d6b453f84 to your computer and use it in GitHub Desktop.
Save OR13/ea635504c77b6ebf0d4f0f7d6b453f84 to your computer and use it in GitHub Desktop.
Create Test Actors for Element
const generateActors = (count) => {
for (let i = 0; i < count; i++) {
const mks = new element.MnemonicKeySystem(element.MnemonicKeySystem.generateMnemonic());
const didUniqueSuffix = element.op.getDidUniqueSuffix({
primaryKey: mks.getKeyForPurpose('primary', 0),
recoveryPublicKey: mks.getKeyForPurpose('recovery', 0).publicKey,
});
const actor = {
'@context': 'https://schema.org',
'@type': 'Person',
name: faker.name.findName(),
email: faker.internet.email(),
jobTitle: faker.name.jobTitle(),
sameAs: [
`https://www.facebook.com/${i}`,
`https://www.linkedin.com/${i}`,
`https://did.example.com/did:elem:${didUniqueSuffix}`,
],
};
actors[didUniqueSuffix] = {
actor,
mks,
didUniqueSuffix,
};
}
return actors;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment