-
-
Notifications
You must be signed in to change notification settings - Fork 11
Working with ADM key pairs
adamant-al edited this page May 28, 2021
·
7 revisions
The library offers to create new ADAMANT account — a passPhrase, public key and private key, and ADM address. Read more about ADAMANT account and key pair.
- createNewPassPhrase
- makeKeypairFromHash
- createHashFromPassPhrase
- createKeypairFromPassPhrase
- createAddressFromPublicKey
Refer to keys
module to access these methods.
Creates new Mnemonic passPhrase with English 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. You can use createHashFromPassPhrase
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
Example:
const address = keys.createAddressFromPublicKey(keysPair.publicKey);