Documentation
¶
Index ¶
- Constants
- func DisplayInfo(info PrintInfo) error
- func GenerateSEDAKeyEncryptionKey() (string, error)
- func GenerateSEDAKeys(valAddr sdk.ValAddress, dirPath string, encryptionKey string, ...) ([]pubkeytypes.IndexedPubKey, error)
- func GetProof(entries [][]byte, index int) ([][]byte, error)
- func LoadSEDAPubKeys(loadPath string, encryptionKey string) ([]pubkeytypes.IndexedPubKey, error)
- func PubKeyToEthAddress(uncompressed []byte) ([]byte, error)
- func ReadSEDAKeyEncryptionKeyFromEnv() string
- func RootFromEntries(entries [][]byte) []byte
- func RootFromLeaves(leaves [][]byte) []byte
- func SEDAKeyFileExists(dirPath string) bool
- func ShouldAllowUnencryptedSedaKeys(appOpts servertypes.AppOptions) bool
- func ValidateSEDAPubKeys(indPubKeys []pubkeytypes.IndexedPubKey) error
- func VerifyProof(proof [][]byte, root, entry []byte) bool
- type PrintInfo
- type SEDAKeyIndex
- type SEDASigner
Constants ¶
const ( // FlagAllowUnencryptedSedaKeys is a flag that allows unencrypted SEDA keys. FlagAllowUnencryptedSedaKeys = "allow-unencrypted-seda-keys" // EnvAllowUnencryptedSedaKeys is an environment variable that allows unencrypted SEDA keys. EnvAllowUnencryptedSedaKeys = "SEDA_ALLOW_UNENCRYPTED_KEYS" // SEDAKeyEncryptionKeyEnvVar is the environment variable that should contain the SEDA key encryption key. SEDAKeyEncryptionKeyEnvVar = "SEDA_KEYS_ENCRYPTION_KEY" )
const ( SEDASeparatorDataRequest byte = iota SEDASeparatorSecp256k1 )
SEDA domain separators
const SEDAKeyFileName = "seda_keys.json"
SEDAKeyFileName defines the SEDA key file name.
Variables ¶
This section is empty.
Functions ¶
func DisplayInfo ¶
func GenerateSEDAKeys ¶
func GenerateSEDAKeys(valAddr sdk.ValAddress, dirPath string, encryptionKey string, forceKeyFile bool) ([]pubkeytypes.IndexedPubKey, error)
GenerateSEDAKeys generates a new set of SEDA keys and saves them to the SEDA key file, along with the provided validator address. It returns the resulting index-public key pairs. The key file is stored in the directory given by dirPath. When encryptionKey is not empty, the file is encrypted using the provided key and stored as base64 encoded. If forceKeyFile is true, the key file is overwritten if it already exists.
func LoadSEDAPubKeys ¶
func LoadSEDAPubKeys(loadPath string, encryptionKey string) ([]pubkeytypes.IndexedPubKey, error)
LoadSEDAPubKeys loads the SEDA key file from the given path and returns a list of index-public key pairs. When encryptionKey is not empty, the file is processed as base64 encoded and then decrypted using the provided key.
func PubKeyToEthAddress ¶
PubKeyToAddress converts a public key in the 65-byte uncompressed format into the Ethereum address format, which is defined as the rightmost 160 bits of Keccak hash of an ECDSA public key without the 0x04 prefix.
func ReadSEDAKeyEncryptionKeyFromEnv ¶
func ReadSEDAKeyEncryptionKeyFromEnv() string
ReadSEDAKeyEncryptionKeyFromEnv reads the SEDA key encryption key from the environment variable. Returns an empty string if the environment variable is not set.
func RootFromEntries ¶
RootFromEntries computes the root of a merkle tree whose leaves are the hashes of the given entries.
- It uses Keccak-256 hashing algorithm.
- The leaves are sorted.
- Each hash pair is sorted to make proofs more succinct.
func RootFromLeaves ¶
RootFromLeaves computes the root of a merkle tree with the given leaves.
func SEDAKeyFileExists ¶
func ShouldAllowUnencryptedSedaKeys ¶
func ShouldAllowUnencryptedSedaKeys(appOpts servertypes.AppOptions) bool
func ValidateSEDAPubKeys ¶
func ValidateSEDAPubKeys(indPubKeys []pubkeytypes.IndexedPubKey) error
ValidateSEDAPubKeys ensures that the provided indexed public keys conform to SEDA keys specifications. It first sorts the provided slice for deterministic results.
func VerifyProof ¶
Types ¶
type PrintInfo ¶ added in v0.0.6
type PrintInfo struct { Moniker string `json:"moniker" yaml:"moniker"` ChainID string `json:"chain_id" yaml:"chain_id"` NodeID string `json:"node_id" yaml:"node_id"` Seeds string `json:"seeds" yaml:"seeds"` }
func NewPrintInfo ¶
type SEDAKeyIndex ¶
type SEDAKeyIndex uint32
SEDAKeyIndex enumerates the SEDA key indices.
const (
SEDAKeyIndexSecp256k1 SEDAKeyIndex = iota
)
type SEDASigner ¶
type SEDASigner interface { GetValAddress() sdk.ValAddress Sign(input []byte, index SEDAKeyIndex) (signature []byte, err error) ReloadIfMismatch(pubKeys []pubkeytypes.IndexedPubKey) error IsLoaded() bool }
func LoadSEDASigner ¶
func LoadSEDASigner(keyFilePath string, allowUnencrypted bool) (SEDASigner, error)
LoadSEDASigner loads the SEDA keys from a given file path and returns a SEDASigner interface.