Documentation ¶
Index ¶
- Constants
- type Ed25519Keypair
- func DeriveEd25519Keypair(mnemonics string, path string) (*Ed25519Keypair, error)
- func DeriveEd25519KeypairFromSeed(seedHex string, path string) (*Ed25519Keypair, error)
- func FromEd25519SecretKey(secretKey []byte, skipValidation bool) (*Ed25519Keypair, error)
- func GenerateEd25519Keypair() (*Ed25519Keypair, error)
- func NewEd25519Keypair(keypair *Ed25519KeypairData) (*Ed25519Keypair, error)
- func (k *Ed25519Keypair) GetBitcoinAddress() (*address.BitcoinAddress, error)
- func (k *Ed25519Keypair) GetKeyScheme() crypto.SignatureScheme
- func (k *Ed25519Keypair) GetPublicKey() crypto.PublicKey[address.RoochAddress]
- func (k *Ed25519Keypair) GetRoochAddress() (*address.RoochAddress, error)
- func (k *Ed25519Keypair) GetSecretKey() (string, error)
- func (k *Ed25519Keypair) Sign(input []byte) ([]byte, error)
- func (k *Ed25519Keypair) SignTransaction(tx crypto.Transaction) (*crypto.Authenticator, error)
- type Ed25519KeypairData
- type Ed25519PublicKey
- func (pk *Ed25519PublicKey) Equals(other crypto.PublicKey[address.RoochAddress]) bool
- func (pk *Ed25519PublicKey) Flag() uint8
- func (pk *Ed25519PublicKey) FromBytes(bytes []byte) (err error)
- func (pk *Ed25519PublicKey) FromHex(hexStr string) (err error)
- func (pk *Ed25519PublicKey) MarshalBCS(ser *bcs.Serializer)
- func (pk *Ed25519PublicKey) String() string
- func (pk *Ed25519PublicKey) ToAddress() (*address.RoochAddress, error)
- func (pk *Ed25519PublicKey) ToBase64() string
- func (pk *Ed25519PublicKey) ToBytes() []byte
- func (pk *Ed25519PublicKey) ToHex() string
- func (pk *Ed25519PublicKey) UnmarshalBCS(des *bcs.Deserializer)
- func (pk *Ed25519PublicKey) Verify(message, signature []byte) (bool, error)
- type Keys
Constants ¶
const ( ED25519_CURVE = "ed25519 seed" HARDENED_OFFSET = 0x80000000 )
const ( DefaultEd25519DerivationPath = "m/44'/784'/0'/0'/0'" PrivateKeySize = 32 )
const PublicKeySize = 32
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Ed25519Keypair ¶
type Ed25519Keypair struct {
// contains filtered or unexported fields
}
Ed25519Keypair represents an Ed25519 keypair used for signing transactions
func DeriveEd25519Keypair ¶
func DeriveEd25519Keypair(mnemonics string, path string) (*Ed25519Keypair, error)
DeriveKeypair derives Ed25519 keypair from mnemonics and path
func DeriveEd25519KeypairFromSeed ¶
func DeriveEd25519KeypairFromSeed(seedHex string, path string) (*Ed25519Keypair, error)
DeriveKeypairFromSeed derives Ed25519 keypair from seed and path
func FromEd25519SecretKey ¶
func FromEd25519SecretKey(secretKey []byte, skipValidation bool) (*Ed25519Keypair, error)
FromSecretKey creates an Ed25519 keypair from a raw secret key byte array
func GenerateEd25519Keypair ¶
func GenerateEd25519Keypair() (*Ed25519Keypair, error)
Generate generates a new random Ed25519 keypair
func NewEd25519Keypair ¶
func NewEd25519Keypair(keypair *Ed25519KeypairData) (*Ed25519Keypair, error)
NewEd25519Keypair creates a new Ed25519 keypair instance
func (*Ed25519Keypair) GetBitcoinAddress ¶
func (k *Ed25519Keypair) GetBitcoinAddress() (*address.BitcoinAddress, error)
GetBitcoinAddress returns the Bitcoin address (not implemented for Ed25519)
func (*Ed25519Keypair) GetKeyScheme ¶
func (k *Ed25519Keypair) GetKeyScheme() crypto.SignatureScheme
GetKeyScheme returns the key scheme of the keypair
func (*Ed25519Keypair) GetPublicKey ¶
func (k *Ed25519Keypair) GetPublicKey() crypto.PublicKey[address.RoochAddress]
GetPublicKey returns the public key for this Ed25519 keypair
func (*Ed25519Keypair) GetRoochAddress ¶
func (k *Ed25519Keypair) GetRoochAddress() (*address.RoochAddress, error)
GetRoochAddress returns the Rooch address
func (*Ed25519Keypair) GetSecretKey ¶
func (k *Ed25519Keypair) GetSecretKey() (string, error)
The Bech32 secret key string for this Ed25519 keypair
func (*Ed25519Keypair) Sign ¶
func (k *Ed25519Keypair) Sign(input []byte) ([]byte, error)
Sign returns the signature for the provided data using Ed25519
func (*Ed25519Keypair) SignTransaction ¶
func (k *Ed25519Keypair) SignTransaction(tx crypto.Transaction) (*crypto.Authenticator, error)
SignTransaction signs a transaction and returns an authenticator
type Ed25519KeypairData ¶
Ed25519KeypairData represents the keypair data structure
type Ed25519PublicKey ¶
type Ed25519PublicKey struct {
// contains filtered or unexported fields
}
Ed25519PublicKey represents an Ed25519 public key
func NewEd25519PublicKey ¶
func NewEd25519PublicKey(value interface{}) (*Ed25519PublicKey, error)
NewEd25519PublicKey creates a new Ed25519PublicKey object value can be either a base64 encoded string or a byte slice
func (*Ed25519PublicKey) Equals ¶
func (pk *Ed25519PublicKey) Equals(other crypto.PublicKey[address.RoochAddress]) bool
Equals checks if two Ed25519 public keys are equal
func (*Ed25519PublicKey) Flag ¶
func (pk *Ed25519PublicKey) Flag() uint8
Flag returns the signature scheme flag for Ed25519
func (*Ed25519PublicKey) FromBytes ¶
func (pk *Ed25519PublicKey) FromBytes(bytes []byte) (err error)
func (*Ed25519PublicKey) FromHex ¶
func (pk *Ed25519PublicKey) FromHex(hexStr string) (err error)
// FromHex sets the Ed25519PublicKey to the bytes represented by the hex string, with or without a leading 0x // // Errors if the hex string is not valid, or if the bytes length is not ed25519.PublicKeySize. // // Implements: // - [CryptoMaterial]
func (*Ed25519PublicKey) MarshalBCS ¶
func (pk *Ed25519PublicKey) MarshalBCS(ser *bcs.Serializer)
MarshalBCS serializes the Ed25519PublicKey to BCS bytes
Implements:
func (*Ed25519PublicKey) String ¶
func (pk *Ed25519PublicKey) String() string
String returns the hex string representation of the public key
func (*Ed25519PublicKey) ToAddress ¶
func (pk *Ed25519PublicKey) ToAddress() (*address.RoochAddress, error)
ToAddress returns the Rooch address associated with this Ed25519 public key
func (*Ed25519PublicKey) ToBase64 ¶
func (pk *Ed25519PublicKey) ToBase64() string
func (*Ed25519PublicKey) ToBytes ¶
func (pk *Ed25519PublicKey) ToBytes() []byte
ToBytes returns the byte array representation of the Ed25519 public key
func (*Ed25519PublicKey) ToHex ¶
func (pk *Ed25519PublicKey) ToHex() string
func (*Ed25519PublicKey) UnmarshalBCS ¶
func (pk *Ed25519PublicKey) UnmarshalBCS(des *bcs.Deserializer)
UnmarshalBCS deserializes the Ed25519PublicKey from BCS bytes
Sets bcs.Deserializer.Error if the bytes length is not ed25519.PublicKeySize, or if it fails to read the required bytes.
Implements: