package
0.0.0-20250128221834-b70a5daccdb4
Repository: https://github.com/canopy-network/canopy.git
Documentation: pkg.go.dev

# Functions

BytesToBLS12381Point() creates a new G1 point on BLS12-381 curve which is the public key of the pair.
BytesToBLS12381PrivateKey() creates a new PrivateKeyI interface from a BLS Private Key bytes.
BytesToBLS12381Public() creates a new PublicKeyI interface from BLS public key bytes.
BytesToED25519Private() creates a new PrivateKeyI interface from ED25519 bytes.
BytesToED25519Public() creates a new PublicKeyI interface from a ED25519PublicKey hex string.
BytesToSECP256K1Public() converts bytes to SECP256K1 private key using go-ethereum.
BytesToSECP256K1Public() returns SECP256K1PublicKey from bytes.
CloneClassGroup() creates a shallow copy of the class group.
DecryptPrivateKey takes an EncryptedPrivateKey and decrypts it to a PrivateKeyI interface using the password.
Ed25519PrivateKeyToCurve25519 hashes the Ed25519 private key seed and extracts the first 32 bytes to form a Curve25519 scalar, which is compatible with Curve25519 operations This conversion allows the use of a single cryptographic key pair Ed25519 for both signing and key exchange.
Ed25519PublicKeyToCurve25519 interprets the Ed25519 public key as a point on the Edwards25519 curve and converts it to a Curve25519 public key in Montgomery form, suitable for X25519 encryption This conversion allows the use of a single cryptographic key pair Ed25519 for both signing and key exchange.
EncryptPrivateKey creates an encrypted private key by generating a random salt and deriving an encryption key with the KDF, and finally encrypting key using AES-GCM.
GenerateVDF() executes a verifiable delay function given a seed and a number of iterations.
Hash() executes the global hashing algorithm on input bytes.
Hasher() returns the global hashing algorithm used.
HashString() returns the hex byte version of a hash.
HKDFSecretsAndChallenge generates shared encryption keys and a unique challenge using HKDF (HMAC-based Key Derivation Function) from a Diffie-Hellman shared secret Parameters: - dhSecret: the shared secret derived from a Diffie-Hellman key exchange - ePub: the ephemeral local public key, this should just be a temporary public key only used for authentication - ePeerPub: the ephemeral peer's public key, this should just be a temporary public key only used for authentication Returns: - send: an AEAD (Authenticated Encryption with Associated Data) cipher for outgoing messages - receive: an AEAD (Authenticated Encryption with Associated Data) cipher for incoming messages - challenge: a unique 32-byte challenge used for authentication purposes - err: error if key derivation or cipher creation fails Process: 1.
No description provided by the author
MerkleTree creates a merkle tree from a slice of bytes.
NewAddress() creates a new address object from bytes by assigning bytes to the underlying address object.
NewAddressFromBytes() casts bytes as an AddressI interface.
NewAddressFromString() returns the hex string implementation of an AddressI interface.
NewBigIntPool() constructs a big int pool.
NewBLS12381PrivateKey() generates a new BLS private key.
NewBLS12381PrivateKeyFromFile() creates a new PrivateKeyI interface from a BLS12381 json file.
NewBLSPublicKey creates a new BLSPublicKey reference from a kyber point.
NewClassGroup() is a constructor for the class group object.
NewDiscriminant generates a 2048-bit discriminant using a seed The discriminant % 8 == 7 and is a negated random prime p between 13 - 2^4096.
NewEd25519PrivateKey() generates a new ED25519 private key.
NewKeyGroup() generates a public key and address that pairs with the private key.
NewKeystoreFromFile() creates a new keystore object from a file.
NewKeystoreInMemory() creates a new in memory keystore.
NewMultiBLSFromPoints() creates a multi public key from a list of G1 points on a BLS12381 curve.
NewPrivateKeyFromBytes() creates a new PrivateKeyI interface from bytes.
NewPrivateKeyFromString() creates a new PrivateKeyI interface from a hex string.
NewPublicKeyED25519() returns a ED25519PublicKey reference that satisfies the PublicKeyI interface.
NewPublicKeyFromBytes() creates a new PublicKeyI interface from a byte slice.
NewPublicKeyFromString() creates a new PublicKeyI interface from a hex string.
NewSECP256K1PrivateKey() generates a new SECP256K1 private key.
PrivateKeyToFile() writes a private key to a file located at filepath.
PubIsBlacklisted() prevents public keys that exploit vulnerabilities in 25519 -> x25519 conversion Reject small-order points early to prevent vulnerabilities from weak points that could be exploited in cryptographic operations, as recommended in the research (https://eprint.iacr.org/2017/806.pdf).
SharedSecret function takes ed25519 public and private keys, converts them to Curve25519-compatible keys, and performs a Diffie-Hellman-style key exchange with X25519 - meaning both peers compute exact pseudorandom bytes from their peersPublicKey and their local private key without transmitting the secret over the wire.
ShortHash() executes the global hashing algorithm on input bytes and truncates the output to 20 bytes.
ShortHashString() returns the hex byte version of a short hash.
StringToBLS12381PrivateKey() creates a new PrivateKeyI interface from a BLS Private Key hex string.
StringToBLSPublic() creates a new PublicKeyI interface from BLS hex string.
StringToED25519Private() creates a new PrivateKeyI interface from an ED25519 hex string.
StringToED25519Public() creates a new PublicKeyI interface from ED25519PublicKey bytes.
StringToSECP256K1Private() creates a new PrivateKeyI interface from an SECP256K1 hex string.
VerifyVDF() verifies VDF bytes given a seed and iterations.

# Constants

the number of bytes in an address.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
2 keys and challenge.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Variables

No description provided by the author
No description provided by the author
No description provided by the author
Public to allow others to import.
Public to allow others to import.

# Structs

No description provided by the author
BLS12381MultiPublicKey is an aggregated public key created by combining multiple BLS public keys from different signers This combined key is used to verify an aggregated signature, confirming that a quorum (or all) of the original signers have participated without needing to verify each signer individually.
BLS12381PrivateKey is a private key wrapper implementation that satisfies the PrivateKeyI interface Boneh-Lynn-Shacham (BLS) signature scheme enables compact, aggregable digital signatures for secure, verifiable messages between multiple parties.
BLS12381PublicKey is a public key wrapper implementation that satisfies the PublicKeyI interface Boneh-Lynn-Shacham (BLS) signature scheme enables compact, aggregable digital signatures for secure, verifiable messages between multiple parties.
ClassGroup is a set of equivalence classes of certain algebraic objects, like ideals or binary quadratic forms The important equations are -> (ax^2 + bxy +cy^2) and (b^2 - 4ac = Discriminant) ClassGroup provides operations for class groups of quadratic imaginary fields, which form the basis for constructing Verifiable Delay Functions These groups enable efficient sequential computations with fast verification, leveraging their cryptographic hardness properties Unlike RSA-based VDFs, class groups don’t require a trusted setup.
ED25519PrivateKey is the private key of a cryptographic key pair used in elliptic curve signing and verification, based on the Curve25519 elliptic curve It is used to create 'unique' digital signatures of messages.
ED25519PublicKey is the public key of a cryptographic key pair used in elliptic curve signing and verification, based on the Curve25519 elliptic curve It is used to verify ownership of the private key as well as validate digital signatures created by the private key.
EncryptedPrivateKey represents an encrypted form of a private key, including the public key, salt used in key derivation, and the encrypted private key itself.
KeyGroup is a structure that holds the Address and PublicKey that corresponds to PrivateKey.
No description provided by the author
***************************************************************************************************** This file is auto-generated from source files in `/lib/.proto/*` using Protocol Buffers (protobuf) Protobuf is a language-neutral, platform-neutral serialization format.
ProtoClassGroup represents a mathematical class group with coefficients a and b.
ProtoPrivKey is a wrapper around private key bytes enabling protobuf encoding and decoding.
ProtoPubKey is a wrapper around public key bytes enabling protobuf encoding and decoding.
SECP256K1PrivateKey is the private key of a cryptographic key pair used in elliptic curve signing and verification, based on the SECP256K1 elliptic curve It is used to create 'unique' digital signatures of messages.
SECP256K1PublicKey is the public key of a cryptographic key pair used in elliptic curve signing and verification, based on the SECP256K1 elliptic curve It is used to verify ownership of the private key as well as validate digital signatures created by the private key.
A Verifiable Delay Function is a cryptographic function that takes a set amount of time to compute, even on powerful hardware, and produces a result that any node may quickly verify.

# Interfaces

AddressI is an interface model for the short version of the Public Key.
MultiPublicKeyI is an interface model for a multi-signature public key, representing multiple signers in a single structure It allows aggregation of individual signatures, validation of aggregated signatures, and management of signers through a bitmap that tracks which participants have signed.
PrivateKeyI is an interface model for a secret cryptographic code that is used to produce digital signatures.
PublicKeyI is an interface model for a cryptographic code shared openly, used to verify digital signatures of its paired private key.

# Type aliases

Address represents a short version of a public key that pairs to a users secret private key Addresses are the most used identity in the blockchain state due to their hash collision resistant property.
Keystore() represents a lightweight database of private keys that are encrypted.