Expand description
§Web3Utilities
web3utilities
crate is a library offering commonly used cryptographic and timestamp data structures common in Web3, asymmetric cryptography, symmetric cryptography and timestamps.
This crate has implementations for constant-time equality by default for all data structures that involve symmetric, timestamp and asymmetric cryptography. There are also fmt::Debug
implementations using Base58 encoding for Ed25519
and SR25519
data structures and hex encoding for X25519
and hashing data structures.
Utilities
struct is also provided for commonly methods for conversions.
Structs§
- Aead
Nonce - Cryptographic and Timestamp data types
A representation of a 12 byte ChaCha AEAD Nonce
default constant time equality checks, hex
fmt::Debug
and hexfmt::Display
, and an implementation for Borsh encoding that ensure no two binary representations that deserialize into the same object and a possibly smaller code size compared to serde binary representations. - AeadTag
- Cryptographic and Timestamp data types
A representation of a 16 byte ChaCha AEAD Tag
default constant time equality checks, hex
fmt::Debug
and hexfmt::Display
, and an implementation for Borsh encoding that ensure no two binary representations that deserialize into the same object and a possibly smaller code size compared to serde binary representations. - AeadX
Nonce - Cryptographic and Timestamp data types
A representation of a 24 byte ChaCha AEAD Extended Nonce
default constant time equality checks, hex
fmt::Debug
and hexfmt::Display
, and an implementation for Borsh encoding that ensure no two binary representations that deserialize into the same object and a possibly smaller code size compared to serde binary representations. - Blake3
Hash - Cryptographic and Timestamp data types
A representation of Blake3 hash byte representation with
default constant time equality checks, hex
fmt::Debug
and hexfmt::Display
, and an implementation for Borsh encoding that ensure no two binary representations that deserialize into the same object and a possibly smaller code size compared to serde binary representations. - Ed25519
Public - Cryptographic and Timestamp data types
A representation of a 32 byte Ed25519 public key with
default constant time equality checks, hex
fmt::Debug
and hexfmt::Display
, and an implementation for Borsh encoding that ensure no two binary representations that deserialize into the same object and a possibly smaller code size compared to serde binary representations. - Ed25519
Signature - Cryptographic and Timestamp data types
A representation of a 64 byte Ed25519 signature with
default constant time equality checks, hex
fmt::Debug
and hexfmt::Display
, and an implementation for Borsh encoding that ensure no two binary representations that deserialize into the same object and a possibly smaller code size compared to serde binary representations. - HexVec
- Cryptographic and Timestamp data types
A representation of a Vec of bytes with
default constant time equality checks, hex
fmt::Debug
and hexfmt::Display
, implementation for zeroize for zeroing memory when the value is dropped and an implementation for Borsh encoding that ensure no two binary representations that deserialize into the same object and a possibly smaller code size compared to serde binary representations. - Secret32
Bytes - Cryptographic and Timestamp data types
A representation of a 32 byte secret key with
default constant time equality checks, hex
fmt::Debug
and hexfmt::Display
, implementation for zeroize for zeroing memory when the value is dropped and an implementation for Borsh encoding that ensure no two binary representations that deserialize into the same object and a possibly smaller code size compared to serde binary representations. - Secret
Vec - Cryptographic and Timestamp data types
A representation of a Vec of bytes with
default constant time equality checks, hex
fmt::Debug
and hexfmt::Display
, implementation for zeroize for zeroing memory when the value is dropped and an implementation for Borsh encoding that ensure no two binary representations that deserialize into the same object and a possibly smaller code size compared to serde binary representations. - Sr25519
Public - Cryptographic and Timestamp data types
A representation of a 32 byte Sr25519 public key with
default constant time equality checks, hex
fmt::Debug
and hexfmt::Display
, and an implementation for Borsh encoding that ensure no two binary representations that deserialize into the same object and a possibly smaller code size compared to serde binary representations. - Sr25519
Signature - Cryptographic and Timestamp data types
A representation of a 64 byte Sr25519 signature with
default constant time equality checks, hex
fmt::Debug
and hexfmt::Display
, and an implementation for Borsh encoding that ensure no two binary representations that deserialize into the same object and a possibly smaller code size compared to serde binary representations. - TaiTimestamp
- Cryptographic and Timestamp data types
A representation of 12 byte Tai64N monotonic timestamp byte with
default constant time equality checks, hex
fmt::Debug
and hexfmt::Display
, and an implementation for Borsh encoding that ensure no two binary representations that deserialize into the same object and a possibly smaller code size compared to serde binary representations. - Utilities
Utilities
struct is used to group common methods for manipulation of bytes- Vote
Tally - Voting structures and functions for an election The tally of the votes cast.
- X25519
Public - Cryptographic and Timestamp data types
A representation of a 32 byte X25519 public key with
default constant time equality checks, hex
fmt::Debug
and hexfmt::Display
, and an implementation for Borsh encoding that ensure no two binary representations that deserialize into the same object and a possibly smaller code size compared to serde binary representations.
Enums§
- IoError
Kind - Errors encountered performing operations using this crate
Implemetation for
From<std::io::ErrorKind>
for this crate - Threshold
- Create or calculate a threshold from a list The total number of items or members required from a list in order to execute or approve a certain task
- Utilities
Error - Errors encountered performing operations using this crate Common Errors
- Vote
- Voting structures and functions for an election An instruction to either accept or reject a vote
- Vote
Outcome - Voting structures and functions for an election An outcome of an election
Type Aliases§
- Byte
Array12 - Cryptographic and Timestamp data types An array of 12 bytes. This does not implement hex or base58 fmt::Debug or constant time equality checks.
- Byte
Array16 - Cryptographic and Timestamp data types An array of 16 bytes common for ChaCha symmetric encryption AEAD tags. This does not implement hex or base58 fmt::Debug or constant time equality checks.
- Byte
Array24 - Cryptographic and Timestamp data types An array of 24 bytes common for 192 bit cryptographic keys. This does not implement hex or base58 fmt::Debug or constant time equality checks.
- Byte
Array32 - Cryptographic and Timestamp data types An array of 32 bytes common for 256 bit private and public keys. This does not implement hex or base58 fmt::Debug or constant time equality checks.
- Byte
Array64 - Cryptographic and Timestamp data types An array of 64 bytes common for 512 bit private and public keys. This does not implement hex or base58 fmt::Debug or constant time equality checks.
- Byte
Array128 - Cryptographic and Timestamp data types An array of 128 bytes common for 1024 bit private and public keys. This does not implement hex or base58 fmt::Debug or constant time equality checks.
- Byte
Array256 - Cryptographic and Timestamp data types An array of 256 bytes common for 2048 bit private and public keys. This does not implement hex or base58 fmt::Debug or constant time equality checks.
- Unix
Timestamp - Cryptographic and Timestamp data types Common Unix timestamps are represented as u64
- Unix
Timestamp Signed - Cryptographic and Timestamp data types Common Unix timestamps are represented as i64
- Utilities
Result - Errors encountered performing operations using this crate
This data structure implements From
for error types of the dependencies of this crate