Documentation ¶
Index ¶
- func Encrypt(message, publicKey string, sdkSecretKey *[32]byte) (string, error)
- func GetKeyPair() (publicKey *[32]byte, privateKey *[32]byte, err error)
- func Hash(algorithm, value string) string
- func ParseAmount(amount float64) string
- func ToJson(object interface{}) (string, error)
- func TrimValue(value string) string
- func ValidateZeroValue(value interface{}) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Encrypt ¶ added in v1.1.0
Encrypt encrypts a message using the XSalsa20-Poly1305 cipher algorithm.
The `message` parameter represents the message to be encrypted. The `publicKey` parameter represents the base64-encoded public key of the merchant. The `sdkSecretKey` parameter represents the secret key generated in the current package.
Returns a base64-encoded string containing the encrypted message (box) and the used nonce. Returns an error if any issue occurs during the encryption process.
func GetKeyPair ¶ added in v1.1.0
GetKeyPair generates a new public/private key pair using the Curve25519 elliptic curve.
Returns a both public & private keys as a *[32]byte. Returns pointers to arrays of 32 bytes each for the public and private keys. The keys are generated in binary format.
func Hash ¶
This function returns a hash of a given value using the specified algorithm.
The `algorithm` parameter is the algorithm to use (e.g. "MD5", "SHA-1", "SHA-256"). The `value` parameter is the string to be hashed.
Returns the hash of the value parameter using the specified algorithm.
func ParseAmount ¶
ParseAmount parses or nullifies the given amount.
The `amount` parameter represents the amount to be parsed.
Returns a string that contains the parsed `amount`.
func ToJson ¶
This function serializes the object to a JSON string and returns it as a string. If an error occurs during the process, it will be returned.
func TrimValue ¶
TrimValue trims the given value.
The `value` parameter represents the input value to be trimmed.
Returns the trimmed version of the `value`.
func ValidateZeroValue ¶ added in v1.1.0
func ValidateZeroValue(value interface{}) bool
ValidateZeroValue checks if the value is the zero value for its type.
Returns a boolean evaluation.
Types ¶
This section is empty.