key(seed?)
Feature
If a seed is provided, mitum key pair derived from the seed is generated. If not (nothing provided), a mitum key pair is generated randomly. Note: the seed must be at least 36 characters long for secure issue.
Parameters
null
| string
seed (optional)
Return Value
object
key pair
Note: In the Mitum account system, private keys are 64-character hex strings with suffix (fpr), public keys are 66-character hex strings with suffix (fpu), and addresses are 40-character checksummed hex strings with prefix (0x) and suffix (fca).
example
// generate random key pair
const key = mitum.account.key();
console.log(key);
// generate key pair from the given seed
const seed = "the seed must be at least 36 characters long for secure issue";
const seedKey = mitum.account.key(seed);
console.log(seedKey);
// output : random key pair
{
privatekey: 'fa3ca46ba9f82302516f7eae7807d976e45f1a60472a594f8bebcff3115c6831fpr',
publickey: '03a2834ba5fa9b27632b6dd8c9bfc1afdf23919edcf5a25d0bee4a78d9f03a6c7efpu',
address: '0x7D30Bd118267FB08920115A1302cee62bCF3d375fca'
}
// output : seed key pair
{
privatekey: '526b4c44556670479a7fd789e0d92522c550006d9ac72c2c5b487dc6a5989ed1fpr',
publickey: '0368e9ef742b6077319393710250c0cd0d00f8601edd75dc1bfdc58799f6c061bbfpu',
address: '0x0321991003DA663D9216CB705fF4480d9306C1f6fca'
}
Last updated