Documentation ¶
Overview ¶
MIT License
Copyright (c) 2016 GenesisCommunity ¶
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
MIT License ¶
Copyright (c) 2016 GenesisCommunity ¶
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
MIT License ¶
Copyright (c) 2016 GenesisCommunity ¶
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
MIT License ¶
Copyright (c) 2016 GenesisCommunity ¶
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
MIT License ¶
Copyright (c) 2016 GenesisCommunity ¶
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
MIT License ¶
Copyright (c) 2016 GenesisCommunity ¶
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Index ¶
- Variables
- func Address(pubKey []byte) int64
- func CalcChecksum(input []byte) (uint64, error)
- func CheckSign(public []byte, data string, signature []byte) (bool, error)
- 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 JSSignToBytes(in string) ([]byte, error)
- func KeyToAddress(pubKey []byte) string
- func NewHash() hash.Hash
- func PrivateToPublic(key []byte) ([]byte, error)
- func RandInt(min int, max int) int
- func RandSeq(n int) string
- func SharedEncrypt(public, text []byte) ([]byte, error)
- func Sign(privateKey string, 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.
Types ¶
This section is empty.