Last active
March 31, 2022 13:07
-
-
Save stefan2904/f1ac36cebe946a475bcbbb8c3e8960c9 to your computer and use it in GitHub Desktop.
Generate Ed25519 did:key in JSONWebKey format for usage in Hyperledger Aries
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// using https://github.com/transmute-industries/did-key.js | |
// via https://www.npmjs.com/package/@transmute/did-key-ed25519 | |
const main = async function() { | |
const k = await require('@transmute/did-key-ed25519').Ed25519KeyPair.generate({ | |
secureRandom: () => { | |
return Buffer.from( | |
require('crypto').randomBytes(32), | |
'hex' | |
); | |
}, | |
}); | |
const exportedKeyPair = await k.export({ | |
type: 'JsonWebKey2020', | |
privateKey: true, | |
}); | |
console.log(exportedKeyPair); | |
} | |
main(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
used by e.g. https://github.com/krakenh2020/EduPilotBackendBundle/blob/master/.github/helper/kms_init.py