Documentation ¶
Index ¶
- func Base32Decode(str string) ([]byte, error)
- func Base32DecodeNP(str string) ([]byte, error)
- func Base32Encode(data []byte) string
- func Base32EncodeNP(data []byte) string
- func Base64Decode(str string) ([]byte, error)
- func Base64DecodeNP(str string) ([]byte, error)
- func Base64Encode(data []byte) string
- func Base64EncodeNP(data []byte) string
- func GenKeyPair() (privateKey, publicKey string)
- func HashData(data interface{}) (string, error)
- func HashDataRaw(data interface{}) (string, error)
- func HashStrings(strs ...string) string
- func HashStringsRaw(strs ...string) string
- func RandomString(length int, args ...string) (walletID string)
- func SignData(privKey string, data interface{}) (string, error)
- func SignMessage(privKey, message string) (string, error)
- func VerifySignature(pubKey, message, signature string) (bool, error)
- type KP
- func (kp *KP) SetPrivKeyFromString(privateKey string) (err error)
- func (kp *KP) SetPubKeyFromString(publicKey string) (err error)
- func (kp *KP) Sign(data []byte) (string, error)
- func (kp *KP) SignData(data interface{}) (string, error)
- func (kp *KP) VerifySignature(message, signature string) (bool, error)
- type Key
- func (key Key) MarshalJSON() ([]byte, error)
- func (key *Key) Scan(src interface{}) error
- func (key Key) String() string
- func (key Key) ToBytes() []byte
- func (key Key) ToPrivate() ed25519.PrivateKey
- func (key Key) ToPublicKey() ed25519.PublicKey
- func (key *Key) UnmarshalJSON(data []byte) error
- func (key Key) Value() (driver.Value, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Base32Decode ¶
func Base32DecodeNP ¶
func Base32Encode ¶
func Base32EncodeNP ¶
func Base64Decode ¶
func Base64Encode ¶
func GenKeyPair ¶
func GenKeyPair() (privateKey, publicKey string)
GenKeyPair generates new ed25519 private and public keys.
func HashDataRaw ¶
HashData serializes `data` and generate hash.
func HashStrings ¶
HashStrings joins passed strings and hash it.
func HashStringsRaw ¶
HashStrings joins passed strings and hash it.
func RandomString ¶
RandomString generates new random base32 Encoded random string.
func SignMessage ¶
SignMessage signs the `message` using the `privateKey`.
func VerifySignature ¶
VerifySignature checks is valid `signature` of `message`.
Types ¶
type KP ¶
type KP struct { Private Key `json:"private" yaml:"private"` Public Key `json:"public" yaml:"public"` }
KP (KeyPair) is a representation of the `ed25519` key pair with common methods.
func (*KP) SetPrivKeyFromString ¶
SetPrivKeyFromString - set private key from string
func (*KP) SetPubKeyFromString ¶
SetPubKeyFromString - set public key from string
type Key ¶
type Key []byte
Key is a type for
func FromString ¶
FromString initialize type from string key
func (Key) MarshalJSON ¶
MarshalJSON is a realization of the `Marshaller` interface.
func (Key) ToPrivate ¶
func (key Key) ToPrivate() ed25519.PrivateKey
ToPrivate cast `key` to `ed25519.PrivateKey`.
func (Key) ToPublicKey ¶
ToPublicKey cast `key` to `ed25519.PublicKey`.
func (*Key) UnmarshalJSON ¶
UnmarshalJSON is a realization of the `Unmarshaller` interface.