Static
Ed25519Static
Secp256k1Static
X25519Creates a private key based on the current cryptographic abstraction
Create an EC Key with secp256k1 curve
const privateKey = apollo.createPrivateKey({
type: KeyTypes.EC,
curve: Curve.SECP256K1,
seed: Buffer.from(seed.value).toString("hex"),
});
Create an EC Key with secp256k1 curve, but also specify a derivationPath
const privateKey = apollo.createPrivateKey({
type: KeyTypes.EC,
curve: Curve.SECP256K1,
seed: Buffer.from(seed.value).toString("hex"),
derivationPath: "m/0'/0'/0'"
});
Create an EC Key with ed25519 curve, ED25519 keys do not use derivation, passing the seed or derivation path will make no effect. Calling this function just generates a new random privateKey for that curve
const privateKey = apollo.createPrivateKey({
type: KeyTypes.EC,
curve: Curve.ED25519,
});
Create an EC Key with X25519 curve, X25519 keys do not use derivation, passing the seed or derivation path will make no effect. Calling this function just generates a new random privateKey for that curve
const privateKey = apollo.createPrivateKey({
type: KeyTypes.Curve25519,
curve: Curve.X25519,
});
Creates a random set of mnemonic phrases that can be used as a seed for generating a private key.
This function creates a random mnemonic phrase whose usage is as a seed for generating a private key.
const mnemonics = apollo.createRandomMnemonics();
Takes in a set of mnemonics and a passphrase, and returns a seed object used to generate a private key.
Optional
passphrase: stringThis function takes mnemonics and passphrases and creates a seed object to generate a private key. It may throw an error if the mnemonics are invalid.
const seed = apollo.createSeed(mnemonics, "my-secret-passphrase");
Apollo defines the set of cryptographic operations that are used in the Atala PRISM.
Abstraction
We by default are implementing Secp256k1, Ed25519 and X25519 Private and Public key from our generic abstractions. When you are using one of those type of keys, for example with:
All the properties you pass to the createPrivateKey are just the default keyProperty keys and the values are strings, buffers are represented in hex format also as strings to simplify conversion later
You can know check if this key can sign with:
PublicKeys follow the same concept, imagine you already have an instance of a publicKey, then..
All keys know also have a generic list of properties which can be accessed at any stage, for example:
Would give your the Curve value.
Find below all the complete list of KeyProperties that are available.