Expand description
§Essential Signer
This crate provides a simple API for signing data with various cryptographic schemes. It is designed to be used with the Essential protocol. There is functionality to make word aligning data for use in decision variables easy.
Note that all hashing in this crate is done with sha256.
This may change in the future to allow more types of hashing.
You can use sign_hash
if you wish to hash the data with a different algorithm.
Re-exports§
pub use ed25519_dalek;
pub use secp256k1;
Enums§
- Encoding
- The encoding to use when decoding or encoding a string.
- Key
- Different types of private keys that can be used for signing.
- Padding
- Where to pad the data to make it word aligned.
- Public
Key - Different types of public keys.
- Signature
- Different types of signatures that can be produced.
Functions§
- align_
to_ word - Align the data to be word aligned. This will pad the data with zeros at the start or end depending on the padding.
- decode_
str - Decode a string into a vector of bytes using the given encoding.
- encode_
str - Encode a vector of bytes into a string using the given encoding.
- hash_
bytes - Hash the data using sha256.
- hash_
words - Hash the words using sha256.
- into_
words - Align and convert the data to words.
- is_
word_ aligned - Check if the data is word aligned.
- pad_
bytes - Pad the data to be word aligned.
- postcard_
bytes - Serialize data using postcard.
- postcard_
bytes_ with_ padding - Serialize data using postcard and then pad it to be word aligned.
- public_
key - Get the public key from a private key.
- public_
key_ to_ words - Turn any supported public key into bytes that are padded to be word aligned.
- read_
file - Read a file into a vector of bytes.
- sign_
aligned_ bytes - Sign already word aligned data by hashing and signing the hash.
- sign_
bytes_ unchecked - Sign the data by hashing and signing the hash.
- sign_
bytes_ with_ padding - Sign the data by padding it to be word aligned and then hashing and signing the hash.
- sign_
hash - Sign a already hashed data.
- sign_
postcard - Sign data by serializing it using postcard and then hashing and signing the hash.
- sign_
postcard_ with_ padding - Sign data by serializing it using postcard and then hashing and signing the hash.
- sign_
words - Sign a slice of words by hashing and signing the hash.
- signature_
to_ aligned_ bytes - Turn any supported signature into bytes that are padded to be word aligned.
- signature_
to_ bytes - Turn any supported signature into bytes.
- signature_
to_ words - Turn any supported signature into words.
- signed_
set_ to_ bytes - Serialize a signed contract to json bytes.
- to_
essential_ signature - Turn a secp256k1 signature into an essential signature.