Class: Signer

Signer

Signer is an interface for an opaque private key that can be used for signing operations

new Signer(cryptoSuite, key)

Parameters:
Name Type Description
cryptoSuite module:api.CryptoSuite The underlying CryptoSuite implementation for the digital signature algorithm
key module:api.Key The private key

Methods


getPublicKey()

Returns the public key corresponding to the opaque, private key
Returns:
The public key corresponding to the private key
Type
module:api.Key

sign(digest, opts)

Signs digest with the private key. Hash implements the SignerOpts interface and, in most cases, one can simply pass in the hash function used as opts. Sign may also attempt to type assert opts to other types in order to obtain algorithm specific values. Note that when a signature of a hash of a larger message is needed, the caller is responsible for hashing the larger message and passing the hash (as digest) and the hash function (as opts) to Sign.
Parameters:
Name Type Description
digest Array.<byte> The message to sign
opts Object hashingFunction: the function to use to hash