Hierarchy

  • Blockchain

Methods

  • Description

    Multiplies a scalar by the private key.

    Returns

    Returns a buffer with the calculated point.

    Throws

    If any of the parameters entered are invalid.

    Throws

    InvalidParameterError If any parameter entered is invalid.

    Throws

    HsmError If an error occurs in the operation.

    Parameters

    • keyName: string

      Name of the key that will be used for the operation.

    • x: string | Buffer

      Point X which can be a buffer of ABN128_XY_BUFF_LEN bytes or a hexadecimal string of ABN128_XY_HEX_LEN characters.

    • y: string | Buffer

      Y point which can be a buffer of ABN128_XY_BUFF_LEN bytes or a hexadecimal string of ABN128_XY_HEX_LEN characters.

    • Optional neg: boolean

      Whether the private key should be negated.

    Returns Promise<Buffer>

  • Description

    Calculates a point from another point and a random context.

    Returns

    Returns a buffer with the calculated point.

    Throws

    If any of the parameters entered are invalid.

    Throws

    InvalidParameterError If any parameter entered is invalid.

    Throws

    HsmError If an error occurs in the operation.

    Parameters

    Returns Promise<Buffer>

  • Description

    Multiplies a scalar by the private key and adds a random scalar.

    Returns

    Returns a buffer with the result of the operation.

    Throws

    If the key name is invalid.

    Throws

    InvalidParameterError If any parameter entered is invalid.

    Throws

    HsmError If an error occurs in the operation.

    Parameters

    • keyName: string

      Name of the key that will be used for the operation.

    • scalar: string | Buffer

      Scalar that can be a buffer of ABN128_XY_BUFF_LEN bytes or a hexadecimal string of ABN128_XY_HEX_LEN characters.

    Returns Promise<Buffer>

  • Description

    Updates the random context.

    Returns

    Returns a buffer with the calculated point.

    Throws

    If any of the parameters entered are invalid.

    Throws

    InvalidParameterError If any parameter entered is invalid.

    Throws

    HsmError If an error occurs in the operation.

    Parameters

    Returns Promise<Buffer>

  • Description

    Returns a random scalar.

    Returns

    Returns a buffer with the random scalar.

    Throws

    HsmError If an error occurs in the operation.

    Returns Promise<Buffer>

  • Description

    Returns four random scalars.

    Returns

    Returns an array of buffers with random scalars.

    Throws

    HsmError If an error occurs in the operation.

    Returns Promise<Buffer[]>

  • Description

    Locks a key in the HSM.

    Returns

    Returns true if the key was successfully locked.

    Throws

    If the key name is invalid.

    Throws

    In the event of an error when deleting the key.

    Parameters

    • name: string

      Key name.

    Returns Promise<boolean>

  • Description

    Creates an Extended Private Key (XPrv) for the blockchain in the BIP32 standard.

    Returns

    Key created.

    Throws

    HsmError If it is not possible to create the key or there is an error in the operation.

    Parameters

    • name: string

      Name of the key in the HSM.

    • type: BLOCKCHAIN_KEYS

      Type of key generation.

    • exportable: boolean

      If the key is exportable.

    • temporary: boolean

      If the key is temporary.

    • Optional version: null | VERSION_OPTIONS

      Key version that must be passed according to the type option

    • Optional seed: null | string

      Buffer containing the data needed to generate the key. The input data must be passed according to the BLOCKCHAIN_KEYS type option.

    • Optional passphrase: null | string

    Returns Promise<boolean>

  • Description

    Performs a Child Key Derivation (CKD) operation. Derives an Extended Private Key (XPrv) for the blockchain in the BIP32 standard.

    Returns

    Information on the derived key.

    Throws

    HsmError If the key cannot be derived or an error occurs in the operation.

    Parameters

    • version: VERSION_OPTIONS

      Key version.

    • index: number

      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.

    • exportable: boolean

      If the key is exportable.

    • temporary: boolean

      If the key is temporary.

    • parentKeyName: string

      Name of the parent key in the HSM. It must be an XPrv key.

    • childKeyName: string

      Name of the key that will be derived in the HSM.

    Returns Promise<KeyInfo>

  • Description

    Deletes a key stored in the HSM.

    Returns

    Returns true if the key was successfully deleted.

    Throws

    If the key name is invalid.

    Throws

    In the event of an error when deleting the key.

    Parameters

    • name: string

      Key name.

    Returns Promise<boolean>

  • Description

    Deletes a key stored in the HSM.

    Returns

    Returns true if the key was successfully deleted.

    Throws

    If the key name is invalid.

    Throws

    In the event of an error when deleting the key.

    Parameters

    • name: string

      Key name.

    Returns Promise<boolean>

  • Description

    Generates an EdDSA signature using the blockchain module.

    Returns

    Signature generated.

    Throws

    HsmError If it is not possible to sign the data or there is an error in the operation.

    Parameters

    • type: BLOCKCHAIN_EdDSA_TYPE

      Type of signature to be generated.

    • privKeyName: string

      Name of the private key.

    • date: Buffer

      Data that will be signed.

    Returns Promise<Buffer>

  • Description

    Verifies an EdDSA signature using the blockchain module.

    Returns

    True if the signature is valid, false otherwise.

    Throws

    HsmError If an error occurs in the operation.

    Parameters

    Returns Promise<boolean>

  • Description

    Export a private key using the blockchain module.

    Returns

    Buffer with the private key.

    Throws

    HsmError If an error occurs in the operation.

    Parameters

    Returns Promise<Buffer>

  • Description

    Retrieves the address of a key using the blockchain module.

    Returns

    Returns the address.

    Throws

    HsmError If the address cannot be retrieved or an error occurs in the operation.

    Parameters

    • type: ADDRESS_TYPE

      Type of address to be generated.

    • version: ADDRESS_VERSION

      Address version.

    • hrp: ADDRESS_HRP

      HRP (Human Readable Part) of the key.

    • pk: string

      Private key from which the address or script-hash will be generated.

    Returns Promise<Buffer>

  • Description

    Retrieves the properties of a key using the blockchain module.

    Returns

    Returns an object with the key's blockchain data.

    Throws

    HsmError If the address cannot be retrieved or an error occurs in the operation.

    Parameters

    • name: string

      Name of the private key.

    Returns Promise<KeyInfo>

  • Description

    Recover a public key from a private key using the blockchain module.

    Returns

    Public key.

    Throws

    HsmError If the private key is not found or there is an error in the operation.

    Parameters

    Returns Promise<Buffer>

  • Description

    Calculates a hash using the blockchain module.

    Returns

    Calculated hash.

    Throws

    HsmError If the hash cannot be calculated or an error occurs in the operation.

    Parameters

    Returns Promise<Buffer>

  • Description

    Import a private key using the blockchain_interfaces module.

    Returns

    True if the import was carried out or an exception otherwise.

    Throws

    HsmError If an error occurs in the operation.

    Parameters

    • format: IMPORT_EXPORT_FORMAT

      Format of the key to be imported.

    • exportable: boolean

      If the key is exportable.

    • temporary: boolean

      If the key is temporary.

    • name: string

      Name of the private key.

    • date: string

      Private key in the format specified in IMPORT_EXPORT_FORMAT.

    Returns Promise<boolean>

  • Description

    Retrieves a public key (PBK) from an ECDSA-type signature.

    Returns

    Returns a buffer with the public key.

    Throws

    HsmError If an error occurs in the operation.

    Parameters

    Returns Promise<Buffer>

  • Description

    Unlocks a key in the HSM.

    Returns

    Returns true if the key was successfully unlocked.

    Throws

    If the key name is invalid.

    Throws

    In the event of an error when deleting the key.

    Parameters

    • name: string

      Key name.

    Returns Promise<boolean>