Name of the key in the HSM.
Type of key generation.
If the key is exportable.
If the key is temporary.
Optional
version: null | VERSION_OPTIONSKey version that must be passed according to the type option
Optional
seed: null | stringBuffer containing the data needed to generate the key. The input data must be passed according to the enums.BLOCKCHAIN_KEYS type option.
Optional
passphrase: null | stringKey created.
exceptions.HsmError If it is not possible to create the key or there is an error in the operation.
Example code: Creating a blockchain key
Deletes a key stored in the HSM.
Key name.
Returns true if the key was successfully deleted.
If the key name is invalid.
In the event of an error when deleting the key.
Example code: Deleting a blockchain key
Locks a key in the HSM.
Key name.
Returns true if the key was successfully locked.
If the key name is invalid.
In the event of an error when deleting the key.
Example code: Locking a blockchain key
Unlocks a key in the HSM.
Key name.
Returns true if the key was successfully unlocked.
If the key name is invalid.
In the event of an error when deleting the key.
Example code: Unlocking a blockchain key
Performs a Child Key Derivation (CKD) operation. Derives an Extended Private Key (XPrv) for the blockchain in the BIP32 standard.
Key version.
Index of the key to be derived. Non-hardened keys use an index from 0 to231-1 and hardened (unrestrictedly secure) keys use indexes from231 to232-1, as specified in the BIP32 standard. It is highly recommended to generate hardened keys.
If the key is exportable.
If the key is temporary.
Name of the parent key in the HSM. It must be an XPrv key.
Name of the key that will be derived in the HSM.
Information on the derived key.
exceptions.HsmError If it is not possible to derive the key or an error occurs in the operation.
Example code: Creating a derived bip32 blockchain key
Calculates a hash using the blockchain module.
Hash mode.
Data to be processed. Maximum size of constants.BLOCKCHAIN_MAX_DATA_LEN.
Calculated hash.
exceptions.HsmError If the hash cannot be calculated or an error occurs in the operation.
Example code: Generating data hash
Generates an EdDSA signature using the blockchain module.
Type of signature to be generated.
Name of the private key.
Data that will be signed.
Signature generated.
exceptions.HsmError If it is not possible to sign the data or an error occurs in the operation.
Example code: Signing hash with EdDSA blockchain key
Recover a public key from a private key using the blockchain module.
Format of the public key to be exported.
Name of the private key.
Public key.
exceptions.HsmError If the private key is not found or there is an error in the operation.
Example code: Retrieving a blockchain public key
Verifies an EdDSA signature using the blockchain module.
Type of signature to be verified.
Type of public key.
Public key. This must be a valid public key returned by the Blockchain.getPubKey method.
Signature to be verified. Must be a valid signature returned by the Blockchain.edDsaSign method.
Data that has been signed. It must be a valid hash returned by the Blockchain.hashData method.
True if the signature is valid, false otherwise.
exceptions.HsmError If an error occurs in the operation.
Example code: Verifying hash signatures with EdDSA blockchain
Retrieves the address of a key using the blockchain module.
Type of address to be generated.
Address version.
HRP (Human Readable Part) of the key.
Private key from which the address or script-hash will be generated.
Returns the address.
exceptions.HsmError If the address cannot be retrieved or an error occurs in the operation.
Example code: Getting the blockchain address from the private key
Sign a hash using the blockchain module.
Type of signature to be made.
Hash mode.
Hash calculated according to what is entered in hashMode(enums.BLOCKCHAIN_HASH_MODE).
Name of the private key.
exceptions.HsmError If it is not possible to sign the data or an error occurs in the operation.
Example code: Signing hash with ECDSA blockchain key
Retrieves the properties of a key using the blockchain module.
Name of the private key.
Returns an object with the key's blockchain data.
exceptions.HsmError If the address cannot be retrieved or an error occurs in the operation.
Sample code: Getting information from a blockchain key
Import a private key using the blockchain_interfaces module.
Format of the key to be imported.
If the key is exportable.
If the key is temporary.
Name of the private key.
Private key in the format specified in enums.IMPORT_EXPORT_FORMAT.
True if the import was carried out or an exception otherwise.
exceptions.HsmError If an error occurs in the operation.
Example code: Importing a blockchain private key
Export a private key using the blockchain module.
Format of the key to be exported.
Key version.
If the key is to be returned compressed.
Name of the private key.
Buffer with the private key.
exceptions.HsmError If an error occurs in the operation.
Sample code: Exporting a blockchain private key
Verifies a signature using the blockchain module.
Type of signature made.
Hash mode.
Hash calculated as entered in hashData.
Signature as informed in sigType(enums.BLOCKCHAIN_SIG_TYPE).
Type of public key.
Public key as entered in pubKeyType.
True if the signature is valid, false otherwise.
exceptions.HsmError If an error occurs in the operation.
Example code: Verifying ECDSA blockchain signature
Retrieves a public key (PBK) from an ECDSA-type signature.
Type of signature to be generated.
Hash mode.
Hash calculated as entered in hashData.
Signature as informed in sigType(enums.BLOCKCHAIN_SIG_TYPE).
Returns a buffer with the public key.
exceptions.HsmError If an error occurs in the operation.
Sample code: Retrieving public key from signature
Calculates a point from another point and a random context.
Point X which can be a buffer of constants.ABN128_XY_BUFF_LEN bytes or a hexadecimal string of constants.ABN128_XY_HEX_LEN characters.
Y point which can be a buffer of constants.ABN128_XY_BUFF_LEN bytes or a hexadecimal string of constants.ABN128_XY_HEX_LEN characters.
Returns a buffer with the calculated point.
If any of the parameters entered are invalid.
exceptions.InvalidParameterError If any parameter entered is invalid.
exceptions.HsmError If an error occurs in the operation.
Multiplies a scalar by the private key and adds a random scalar.
Name of the key that will be used for the operation.
Scalar that can be a buffer of constants.ABN128_XY_BUFF_LEN bytes or a hexadecimal string of constants.ABN128_XY_HEX_LEN characters.
Returns a buffer with the result of the operation.
If the key name is invalid.
exceptions.InvalidParameterError If any parameter entered is invalid.
exceptions.HsmError If an error occurs in the operation.
Returns four random scalars.
Returns an array of buffers with random scalars.
exceptions.HsmError If an error occurs in the operation.
Returns a random scalar.
Returns a buffer with the random scalar.
exceptions.HsmError If an error occurs in the operation.
Updates the random context.
Point X which can be a buffer of constants.ABN128_XY_BUFF_LEN bytes or a hexadecimal string of constants.ABN128_XY_HEX_LEN characters.
Y point which can be a buffer of constants.ABN128_XY_BUFF_LEN bytes or a hexadecimal string of constants.ABN128_XY_HEX_LEN characters.
Returns a buffer with the calculated point.
If any of the parameters entered are invalid.
exceptions.InvalidParameterError If any parameter entered is invalid.
exceptions.HsmError If an error occurs in the operation.
Multiplies a scalar by the private key.
Name of the key that will be used for the operation.
Point X which can be a buffer of constants.ABN128_XY_BUFF_LEN bytes or a hexadecimal string of constants.ABN128_XY_HEX_LEN characters.
Y point which can be a buffer of constants.ABN128_XY_BUFF_LEN bytes or a hexadecimal string of constants.ABN128_XY_HEX_LEN characters.
Optional
neg: booleanWhether the private key should be negated.
Returns a buffer with the calculated point.
If any of the parameters entered are invalid.
exceptions.InvalidParameterError If any parameter entered is invalid.
exceptions.HsmError If an error occurs in the operation.
Creates an Extended Private Key (XPrv) for the blockchain in the BIP32 standard.