createConsumer abstract method

SignatureConsumer createConsumer({
  1. required SecureKey secretKey,
})

Creates a StreamConsumer for generating a signature from a stream.

The returned SignatureConsumer is basically a typed StreamConsumer, that wraps the signature streaming APIs. Creating the consumer will call crypto_sign_init, adding messages to it via SignatureConsumer.addStream will call crypto_sign_update for every event in the stream. After you are done adding messages, you can SignatureConsumer.close it, which will call crypto_sign_final_create internally and return the signature of the data created from secretKey.

For simpler usage, if you only have a single input Stream and simply want to get the signature from it, you ca use stream instead.

See https://libsodium.gitbook.io/doc/public-key_cryptography/public-key_signatures#multi-part-messages

Implementation

SignatureConsumer createConsumer({
  required SecureKey secretKey,
});