README ¶
crypto
crypto is the cryptographic package adapted for CometBFT's uses
Importing it
To get the interfaces,
import "github.com/KYVENetwork/cometbft/v38/crypto"
For any specific algorithm, use its specific module e.g.
import "github.com/KYVENetwork/cometbft/v38/crypto/ed25519"
Binary encoding
For Binary encoding, please refer to the CometBFT encoding specification.
JSON Encoding
JSON encoding is done using CometBFT's internal json encoder. For more information on JSON encoding, please refer to CometBFT JSON encoding
Example JSON encodings:
ed25519.PrivKey - {"type":"cometbft/v38/PrivKeyEd25519","value":"EVkqJO/jIXp3rkASXfh9YnyToYXRXhBr6g9cQVxPFnQBP/5povV4HTjvsy530kybxKHwEi85iU8YL0qQhSYVoQ=="}
ed25519.PubKey - {"type":"cometbft/v38/PubKeyEd25519","value":"AT/+aaL1eB0477Mud9JMm8Sh8BIvOYlPGC9KkIUmFaE="}
sr25519.PrivKeySr25519 - {"type":"cometbft/v38/PrivKeySr25519","value":"xtYVH8UCIqfrY8FIFc0QEpAEBShSG4NT0zlEOVSZ2w4="}
sr25519.PubKeySr25519 - {"type":"cometbft/v38/PubKeySr25519","value":"8sKBLKQ/OoXMcAJVxBqz1U7TyxRFQ5cmliuHy4MrF0s="}
crypto.PrivKeySecp256k1 - {"type":"cometbft/v38/PrivKeySecp256k1","value":"zx4Pnh67N+g2V+5vZbQzEyRerX9c4ccNZOVzM9RvJ0Y="}
crypto.PubKeySecp256k1 - {"type":"cometbft/v38/PubKeySecp256k1","value":"A8lPKJXcNl5VHt1FK8a244K9EJuS4WX1hFBnwisi0IJx"}
Documentation ¶
Index ¶
Examples ¶
Constants ¶
const ( // AddressSize is the size of a pubkey address. AddressSize = tmhash.TruncatedSize )
const Version = "0.9.0-dev"
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Address ¶
An address is a []byte, but hex-encoded even in JSON. []byte leaves us the option to change the address length. Use an alias so Unmarshal methods (with ptr receivers) are available too.
func AddressHash ¶
type BatchVerifier ¶
type BatchVerifier interface { // Add appends an entry into the BatchVerifier. Add(key PubKey, message, signature []byte) error // Verify verifies all the entries in the BatchVerifier, and returns // if every signature in the batch is valid, and a vector of bools // indicating the verification status of each signature (in the order // that signatures were added to the batch). Verify() (bool, []bool) }
If a new key type implements batch verification, the key type must be registered in github.com/KYVENetwork/cometbft/v38/crypto/batch
Directories ¶
Path | Synopsis |
---|---|
internal
|
|
Package merkle computes a deterministic minimal height Merkle tree hash.
|
Package merkle computes a deterministic minimal height Merkle tree hash. |
Package xchacha20poly1305 creates an AEAD using hchacha, chacha, and poly1305 This allows for randomized nonces to be used in conjunction with chacha.
|
Package xchacha20poly1305 creates an AEAD using hchacha, chacha, and poly1305 This allows for randomized nonces to be used in conjunction with chacha. |