Documentation ¶
Index ¶
- Variables
- func Address(pubKey []byte) int64
- func CalcChecksum(input []byte) (uint64, error)
- func CheckSign(public, data, signature []byte) (bool, error)
- func CutPub(pubKey []byte) []byte
- func Decrypt(msg []byte, key []byte, iv []byte) ([]byte, error)
- func DoubleHash(msg []byte) ([]byte, error)
- func Encrypt(msg []byte, key []byte, iv []byte) ([]byte, error)
- func GenBytesKeys() ([]byte, []byte, error)
- func GenHexKeys() (string, string, error)
- func GetHMAC(secret string, message string) ([]byte, error)
- func GetHMACWithTimestamp(secret string, message string, timestamp string) ([]byte, error)
- func GetWalletIDByPublicKey(publicKey []byte) (int64, error)
- func Hash(msg []byte) ([]byte, error)
- func HashHex(input []byte) (string, error)
- func HexToPub(pub string) ([]byte, error)
- func JSSignToBytes(in string) ([]byte, error)
- func KeyToAddress(pubKey []byte) string
- func NewHash() hash.Hash
- func PrivateToPublic(key []byte) ([]byte, error)
- func PubToHex(pub []byte) string
- func RandInt(min int, max int) int
- func RandSeq(n int) string
- func SharedEncrypt(public, text []byte) ([]byte, error)
- func Sign(privateKey, data []byte) ([]byte, error)
- func SignString(privateKeyHex, data string) ([]byte, error)
Constants ¶
This section is empty.
Variables ¶
var ( // ErrHashing is Hashing error ErrHashing = errors.New("Hashing error") // ErrEncrypting is Encoding error ErrEncrypting = errors.New("Encoding error") // ErrDecrypting is Decrypting error ErrDecrypting = errors.New("Decrypting error") // ErrUnknownProvider is Unknown provider error ErrUnknownProvider = errors.New("Unknown provider") // ErrHashingEmpty is Hashing empty value error ErrHashingEmpty = errors.New("Hashing empty value") // ErrEncryptingEmpty is Encrypting empty value error ErrEncryptingEmpty = errors.New("Encrypting empty value") // ErrDecryptingEmpty is Decrypting empty value error ErrDecryptingEmpty = errors.New("Decrypting empty value") // ErrSigningEmpty is Signing empty value error ErrSigningEmpty = errors.New("Signing empty value") // ErrCheckingSignEmpty is Checking sign of empty error ErrCheckingSignEmpty = errors.New("Cheking sign of empty") // ErrIncorrectSign is Incorrect sign ErrIncorrectSign = errors.New("Incorrect sign") // ErrUnsupportedCurveSize is Unsupported curve size error ErrUnsupportedCurveSize = errors.New("Unsupported curve size") // ErrIncorrectPrivKeyLength is Incorrect private key length error ErrIncorrectPrivKeyLength = errors.New("Incorrect private key length") // ErrIncorrectPubKeyLength is Incorrect public key length ErrIncorrectPubKeyLength = errors.New("Incorrect public key length") )
Functions ¶
func CalcChecksum ¶
CalcChecksum is calculates checksum
func DoubleHash ¶
DoubleHash returns double hash of passed bytes
func GenBytesKeys ¶
GenBytesKeys generates a random pair of ECDSA private and public binary keys.
func GenHexKeys ¶
GenHexKeys generates a random pair of ECDSA private and public hex keys.
func GetHMACWithTimestamp ¶
GetHMACWithTimestamp allows add timestamp
func GetWalletIDByPublicKey ¶
GetWalletIDByPublicKey converts public key to wallet id
func JSSignToBytes ¶
JSSignToBytes converts hex signature which has got from the browser to []byte
func KeyToAddress ¶
KeyToAddress converts a public key to apla address XXXX-...-XXXX.
func PrivateToPublic ¶
PrivateToPublic returns the public key for the specified private key.
func SharedEncrypt ¶
SharedEncrypt creates a shared key and encrypts text. The first 32 characters are the created public key. The cipher text can be only decrypted with the original private key.
func SignString ¶
Types ¶
This section is empty.