-
-
Notifications
You must be signed in to change notification settings - Fork 11
Working with ADM key pairs
Aleksei Lebedev edited this page Sep 29, 2019
·
7 revisions
The library offers to create new passPhrase, make public and private key pair and ADM address. Read more about ADAMANT account and key pair.
Refer to adamant-api/helpers/keys
module to access these methods:
const keys = require('adamant-api/helpers/keys');
Creates new Mnemonic passPhrase with Engish words.
Parameters: none.
Returns: new random passPhrase, String
Creates public and private keys with provided hash using Sodium (NaCl).
Parameters:
-
hash
— SHA-256 hash of passPhase to generate key pair,Hash
object fromcrypto
library
Returns:
-
publicKey
of key pair -
privateKey
of key pair
Creates SHA-256 hash from provided passPhrase.
Parameters:
-
passPhrase
— 12 words Mnemonic passPhrase to generate hash,String
Returns: generated Hash
object from crypto
library
Creates public and private keys with provided passPhrase using Sodium (NaCl).
Parameters:
-
passPhrase
— 12 words Mnemonic passPhrase to generate hash,String
Returns:
-
publicKey
of key pair -
privateKey
of key pair
Example:
let keysPair;
try {
keysPair = keys.createKeypairFromPassPhrase(config.passphrase);
} catch (e) {
exit('Passphrase is not valid! Error: ' + e);
}
Generates ADAMANT address from provided publicKey.
Parameters:
-
publicKey
— account's publicKey
Returns: ADAMANT address, String