Documentation ¶
Index ¶
- Constants
- type PrivateKey
- func (prv *PrivateKey) Bytes() []byte
- func (prv *PrivateKey) EqualsTo(x crypto.PrivateKey) bool
- func (prv *PrivateKey) PublicKey() crypto.PublicKey
- func (prv *PrivateKey) PublicKeyNative() *PublicKey
- func (prv *PrivateKey) Sign(msg []byte) crypto.Signature
- func (prv *PrivateKey) SignNative(msg []byte) *Signature
- func (prv *PrivateKey) String() string
- type PublicKey
- func (pub *PublicKey) AccountAddress() crypto.Address
- func (pub *PublicKey) Bytes() []byte
- func (pub *PublicKey) Decode(r io.Reader) error
- func (pub *PublicKey) Encode(w io.Writer) error
- func (pub *PublicKey) EqualsTo(x crypto.PublicKey) bool
- func (pub *PublicKey) MarshalCBOR() ([]byte, error)
- func (*PublicKey) SerializeSize() int
- func (pub *PublicKey) String() string
- func (pub *PublicKey) UnmarshalCBOR(bs []byte) error
- func (pub *PublicKey) Verify(msg []byte, sig crypto.Signature) error
- func (pub *PublicKey) VerifyAddress(addr crypto.Address) error
- type Signature
- func (sig *Signature) Bytes() []byte
- func (sig *Signature) Decode(r io.Reader) error
- func (sig *Signature) Encode(w io.Writer) error
- func (sig *Signature) EqualsTo(x crypto.Signature) bool
- func (sig *Signature) MarshalCBOR() ([]byte, error)
- func (*Signature) SerializeSize() int
- func (sig *Signature) String() string
- func (sig *Signature) UnmarshalCBOR(bs []byte) error
Constants ¶
const PrivateKeySize = 32
const PublicKeySize = 32
const SignatureSize = 64
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PrivateKey ¶
type PrivateKey struct {
// contains filtered or unexported fields
}
func PrivateKeyFromBytes ¶
func PrivateKeyFromBytes(data []byte) (*PrivateKey, error)
PrivateKeyFromBytes constructs a ED25519 private key from the raw bytes.
func PrivateKeyFromString ¶
func PrivateKeyFromString(text string) (*PrivateKey, error)
PrivateKeyFromString decodes the input string and returns the PrivateKey if the string is a valid bech32m encoding of a Ed25519 public key.
func (*PrivateKey) Bytes ¶
func (prv *PrivateKey) Bytes() []byte
Bytes return the raw bytes of the private key.
func (*PrivateKey) EqualsTo ¶
func (prv *PrivateKey) EqualsTo(x crypto.PrivateKey) bool
func (*PrivateKey) PublicKey ¶
func (prv *PrivateKey) PublicKey() crypto.PublicKey
func (*PrivateKey) PublicKeyNative ¶
func (prv *PrivateKey) PublicKeyNative() *PublicKey
func (*PrivateKey) Sign ¶
func (prv *PrivateKey) Sign(msg []byte) crypto.Signature
Sign calculates the signature from the private key and given message. It's defined in section 2.6 of the spec: CoreSign.
func (*PrivateKey) SignNative ¶
func (prv *PrivateKey) SignNative(msg []byte) *Signature
func (*PrivateKey) String ¶
func (prv *PrivateKey) String() string
String returns a human-readable string for the ED25519 private key.
type PublicKey ¶
type PublicKey struct {
// contains filtered or unexported fields
}
func PublicKeyFromBytes ¶
PublicKeyFromBytes constructs a Ed25519 public key from the raw bytes.
func PublicKeyFromString ¶
PublicKeyFromString decodes the input string and returns the PublicKey if the string is a valid bech32m encoding of a Ed25519 public key.
func (*PublicKey) AccountAddress ¶
AccountAddress returns the account address derived from the public key.
func (*PublicKey) Decode ¶
Decode reads the raw bytes of the public key from the provided reader and initializes the public key.
func (*PublicKey) EqualsTo ¶
EqualsTo checks if the current public key is equal to another public key.
func (*PublicKey) MarshalCBOR ¶
MarshalCBOR encodes the public key into CBOR format.
func (*PublicKey) SerializeSize ¶ added in v1.6.0
func (*PublicKey) UnmarshalCBOR ¶
UnmarshalCBOR decodes the public key from CBOR format.
type Signature ¶
type Signature struct {
// contains filtered or unexported fields
}
func SignatureFromBytes ¶
SignatureFromBytes constructs a Ed25519 signature from the raw bytes.
func SignatureFromString ¶
SignatureFromString decodes the input string and returns the Signature if the string is a valid hexadecimal encoding of a Ed25519 signature.
func (*Signature) Decode ¶
Decode reads the raw bytes of the signature from the provided reader and initializes the signature.
func (*Signature) EqualsTo ¶
EqualsTo checks if the current signature is equal to another signature.
func (*Signature) MarshalCBOR ¶
MarshalCBOR encodes the signature into CBOR format.
func (*Signature) SerializeSize ¶ added in v1.6.0
func (*Signature) UnmarshalCBOR ¶
UnmarshalCBOR decodes the signature from CBOR format.