Documentation
¶
Index ¶
- Constants
- type Ed25519Keypair
- func DeriveKeypair(mnemonics, path string) (*Ed25519Keypair, error)
- func DeriveKeypairFromSeed(seedHex, path string) (*Ed25519Keypair, error)
- func FromSecretKey(secretKey []byte, skipValidation bool) (*Ed25519Keypair, error)
- func GenerateEd25519Keypair() (*Ed25519Keypair, error)
- func NewEd25519Keypair(keypair *Ed25519KeypairData) (*Ed25519Keypair, error)
- func (k *Ed25519Keypair) GetKeyScheme() cryptography.SignatureScheme
- func (k *Ed25519Keypair) GetPublicKey() (cryptography.PublicKey, error)
- func (k *Ed25519Keypair) GetSecretKey() (string, error)
- func (kp *Ed25519Keypair) PublicKey() []byte
- func (kp *Ed25519Keypair) SecretKey() []byte
- func (k *Ed25519Keypair) Sign(data []byte) ([]byte, error)
- func (k *Ed25519Keypair) SignData(data []byte) ([]byte, error)
- type Ed25519KeypairData
- type Ed25519PublicKey
Constants ¶
const DefaultEd25519DerivationPath = "m/44'/784'/0'/0'/0'"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Ed25519Keypair ¶
type Ed25519Keypair struct { cryptography.BaseKeypair // contains filtered or unexported fields }
An Ed25519 Keypair used for signing transactions.
func DeriveKeypair ¶
func DeriveKeypair(mnemonics, path string) (*Ed25519Keypair, error)
Derive Ed25519 keypair from mnemonics and path The mnemonics must be normalized and validated against the english wordlist. If path is none, it will default to m/44'/784'/0'/0'/0' Otherwise the path must be compliant to SLIP-0010 in form m/44'/784'/{account_index}'/{change_index}'/{address_index}'.
func DeriveKeypairFromSeed ¶
func DeriveKeypairFromSeed(seedHex, path string) (*Ed25519Keypair, error)
Derive Ed25519 keypair from mnemonicSeed and path. If path is none, it will default to m/44'/784'/0'/0'/0' Otherwise the path must be compliant to SLIP-0010 in form m/44'/784'/{account_index}'/{change_index}'/{address_index}'.
func FromSecretKey ¶
func FromSecretKey(secretKey []byte, skipValidation bool) (*Ed25519Keypair, error)
Create a Ed25519 keypair from a raw secret key byte array, also known as seed. This is NOT the private scalar which is result of hashing and bit clamping of the raw secret key.
func GenerateEd25519Keypair ¶
func GenerateEd25519Keypair() (*Ed25519Keypair, error)
Generate a new random Ed25519 keypair
func NewEd25519Keypair ¶
func NewEd25519Keypair(keypair *Ed25519KeypairData) (*Ed25519Keypair, error)
Create or generate a new Ed25519 keypair instance.
func (*Ed25519Keypair) GetKeyScheme ¶
func (k *Ed25519Keypair) GetKeyScheme() cryptography.SignatureScheme
Get the key scheme of the keypair ED25519
func (*Ed25519Keypair) GetPublicKey ¶
func (k *Ed25519Keypair) GetPublicKey() (cryptography.PublicKey, error)
The public key for this Ed25519 keypair
func (*Ed25519Keypair) GetSecretKey ¶
func (k *Ed25519Keypair) GetSecretKey() (string, error)
The Bech32 secret key string for this Ed25519 keypair
func (*Ed25519Keypair) PublicKey ¶ added in v0.0.15
func (kp *Ed25519Keypair) PublicKey() []byte
func (*Ed25519Keypair) SecretKey ¶ added in v0.0.15
func (kp *Ed25519Keypair) SecretKey() []byte
type Ed25519KeypairData ¶
Ed25519 Keypair data. The publickey is the 32-byte public key and the secretkey is 64-byte Where the first 32 bytes is the secret key and the last 32 bytes is the public key.
type Ed25519PublicKey ¶
type Ed25519PublicKey struct { cryptography.BasePublicKey // contains filtered or unexported fields }
func NewEd25519PublicKey ¶
func NewEd25519PublicKey[T string | []byte](value T) (publicKey *Ed25519PublicKey, err error)
func (*Ed25519PublicKey) Flag ¶
func (key *Ed25519PublicKey) Flag() uint8
Return the Sui address associated with this Ed25519 public key
func (*Ed25519PublicKey) ToRawBytes ¶
func (key *Ed25519PublicKey) ToRawBytes() []byte
Return the byte array representation of the Ed25519 public key
func (*Ed25519PublicKey) Verify ¶
func (key *Ed25519PublicKey) Verify(message []byte, signature cryptography.SerializedSignature) (bool, error)
Verifies that the signature is valid for for the provided message