Documentation ¶
Index ¶
- Constants
- Variables
- func GenerateMnemonic() (string, error)
- type AsymEncKeypair
- type AsymEncPrivkey
- type AsymEncPubkey
- func (pubkey *AsymEncPubkey) Bytes() []byte
- func (pubkey *AsymEncPubkey) Hex() string
- func (pubkey *AsymEncPubkey) MarshalBinary() ([]byte, error)
- func (pubkey *AsymEncPubkey) MarshalJSON() ([]byte, error)
- func (pubkey AsymEncPubkey) MarshalStateBytes() ([]byte, error)
- func (pubkey *AsymEncPubkey) String() string
- func (pubkey *AsymEncPubkey) UnmarshalBinary(bs []byte) error
- func (pubkey *AsymEncPubkey) UnmarshalStateBytes(bs []byte) error
- type SigKeypair
- type SigningPrivateKey
- type SigningPublicKey
- func (pubkey *SigningPublicKey) Address() types.Address
- func (pubkey *SigningPublicKey) Bytes() []byte
- func (pubkey *SigningPublicKey) Hex() string
- func (pubkey *SigningPublicKey) MarshalBinary() ([]byte, error)
- func (pubkey *SigningPublicKey) MarshalJSON() ([]byte, error)
- func (pubkey SigningPublicKey) MarshalStateBytes() ([]byte, error)
- func (pubkey *SigningPublicKey) MarshalText() ([]byte, error)
- func (pubkey *SigningPublicKey) String() string
- func (pubkey *SigningPublicKey) UnmarshalBinary(bs []byte) error
- func (pubkey *SigningPublicKey) UnmarshalStateBytes(bs []byte) error
- func (pubkey *SigningPublicKey) UnmarshalText(bs []byte) error
- func (pubkey *SigningPublicKey) VerifySignature(hash types.Hash, signature []byte) bool
- type SymEncKey
- type SymEncMsg
Constants ¶
View Source
const ( AES128_KEY_LENGTH = 16 AES256_KEY_LENGTH = 32 AES_GCM_NONCE_SIZE = 12 )
View Source
const ( NACL_BOX_KEY_LENGTH = 32 NACL_BOX_NONCE_LENGTH = 24 )
Variables ¶
View Source
var DefaultHDDerivationPathPrefix = accounts.DerivationPath{44, 60, 0, 0}
View Source
var (
ErrCannotDecrypt = errors.New("cannot decrypt")
)
Functions ¶
func GenerateMnemonic ¶
Types ¶
type AsymEncKeypair ¶
type AsymEncKeypair struct { *AsymEncPrivkey *AsymEncPubkey }
func GenerateAsymEncKeypair ¶
func GenerateAsymEncKeypair() (*AsymEncKeypair, error)
type AsymEncPrivkey ¶
type AsymEncPrivkey [NACL_BOX_KEY_LENGTH]byte
func AsymEncPrivkeyFromBytes ¶
func AsymEncPrivkeyFromBytes(bs []byte) *AsymEncPrivkey
func AsymEncPrivkeyFromHex ¶
func AsymEncPrivkeyFromHex(s string) (*AsymEncPrivkey, error)
func (*AsymEncPrivkey) Bytes ¶
func (privkey *AsymEncPrivkey) Bytes() []byte
func (*AsymEncPrivkey) OpenMessageFrom ¶
func (privkey *AsymEncPrivkey) OpenMessageFrom(senderPublicKey *AsymEncPubkey, msgEncrypted []byte) ([]byte, error)
func (*AsymEncPrivkey) SealMessageFor ¶
func (privkey *AsymEncPrivkey) SealMessageFor(recipientPubKey *AsymEncPubkey, msg []byte) ([]byte, error)
type AsymEncPubkey ¶
type AsymEncPubkey [NACL_BOX_KEY_LENGTH]byte
func AsymEncPubkeyFromBytes ¶
func AsymEncPubkeyFromBytes(bs []byte) *AsymEncPubkey
func AsymEncPubkeyFromHex ¶
func AsymEncPubkeyFromHex(s string) (*AsymEncPubkey, error)
func (*AsymEncPubkey) Bytes ¶
func (pubkey *AsymEncPubkey) Bytes() []byte
func (*AsymEncPubkey) Hex ¶
func (pubkey *AsymEncPubkey) Hex() string
func (*AsymEncPubkey) MarshalBinary ¶
func (pubkey *AsymEncPubkey) MarshalBinary() ([]byte, error)
func (*AsymEncPubkey) MarshalJSON ¶
func (pubkey *AsymEncPubkey) MarshalJSON() ([]byte, error)
func (AsymEncPubkey) MarshalStateBytes ¶
func (pubkey AsymEncPubkey) MarshalStateBytes() ([]byte, error)
func (*AsymEncPubkey) String ¶
func (pubkey *AsymEncPubkey) String() string
func (*AsymEncPubkey) UnmarshalBinary ¶
func (pubkey *AsymEncPubkey) UnmarshalBinary(bs []byte) error
func (*AsymEncPubkey) UnmarshalStateBytes ¶
func (pubkey *AsymEncPubkey) UnmarshalStateBytes(bs []byte) error
type SigKeypair ¶
type SigKeypair struct { *SigningPrivateKey *SigningPublicKey }
func GenerateSigKeypair ¶
func GenerateSigKeypair() (*SigKeypair, error)
func SigKeypairFromHDMnemonic ¶
func SigKeypairFromHDMnemonic(mnemonic string, accountIndex uint32) (*SigKeypair, error)
func SigKeypairFromHex ¶
func SigKeypairFromHex(s string) (*SigKeypair, error)
type SigningPrivateKey ¶
type SigningPrivateKey struct {
*ecdsa.PrivateKey
}
func (*SigningPrivateKey) Bytes ¶
func (privkey *SigningPrivateKey) Bytes() []byte
func (*SigningPrivateKey) Hex ¶
func (privkey *SigningPrivateKey) Hex() string
func (*SigningPrivateKey) SignHash ¶
func (privkey *SigningPrivateKey) SignHash(hash types.Hash) ([]byte, error)
func (*SigningPrivateKey) String ¶
func (privkey *SigningPrivateKey) String() string
type SigningPublicKey ¶
func RecoverSigningPubkey ¶
func RecoverSigningPubkey(hash types.Hash, signature []byte) (*SigningPublicKey, error)
func SigningPublicKeyFromBytes ¶
func SigningPublicKeyFromBytes(bs []byte) (*SigningPublicKey, error)
func (*SigningPublicKey) Address ¶
func (pubkey *SigningPublicKey) Address() types.Address
func (*SigningPublicKey) Bytes ¶
func (pubkey *SigningPublicKey) Bytes() []byte
func (*SigningPublicKey) Hex ¶
func (pubkey *SigningPublicKey) Hex() string
func (*SigningPublicKey) MarshalBinary ¶
func (pubkey *SigningPublicKey) MarshalBinary() ([]byte, error)
func (*SigningPublicKey) MarshalJSON ¶
func (pubkey *SigningPublicKey) MarshalJSON() ([]byte, error)
func (SigningPublicKey) MarshalStateBytes ¶
func (pubkey SigningPublicKey) MarshalStateBytes() ([]byte, error)
func (*SigningPublicKey) MarshalText ¶
func (pubkey *SigningPublicKey) MarshalText() ([]byte, error)
func (*SigningPublicKey) String ¶
func (pubkey *SigningPublicKey) String() string
func (*SigningPublicKey) UnmarshalBinary ¶
func (pubkey *SigningPublicKey) UnmarshalBinary(bs []byte) error
func (*SigningPublicKey) UnmarshalStateBytes ¶
func (pubkey *SigningPublicKey) UnmarshalStateBytes(bs []byte) error
func (*SigningPublicKey) UnmarshalText ¶
func (pubkey *SigningPublicKey) UnmarshalText(bs []byte) error
func (*SigningPublicKey) VerifySignature ¶
func (pubkey *SigningPublicKey) VerifySignature(hash types.Hash, signature []byte) bool
type SymEncKey ¶
type SymEncKey [AES256_KEY_LENGTH]byte
AES-256 symmetric encryption key
func NewSymEncKey ¶
func SymEncKeyFromBytes ¶
func (SymEncKey) MarshalJSON ¶
func (*SymEncKey) UnmarshalJSON ¶
Click to show internal directories.
Click to hide internal directories.