Documentation ¶
Index ¶
- func Decrypt(buf []byte, key []byte) ([]byte, error)
- func Encrypt(buf []byte, key []byte) ([]byte, error)
- func HandleWithEncryption(provider secretProvider, handler http.Handler) http.HandlerFunc
- func Sign(privateKey *ecdsa.PrivateKey, message string) (string, error)
- func SignWithTimestamp(privateKey *ecdsa.PrivateKey, message string) (string, string, error)
- func ValidateSignedMessage(message string, signature string) (common.Address, error)deprecated
- func VerifySignedMessage(publicKey *ecdsa.PublicKey, message, signature string) (common.Address, error)
- type HagallSecretProvider
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Encrypt ¶
Encrypt encrypts buf using key with AES-GCM AEAD mode, nonce is prepended to encrypted text and result is hex encoded.
func HandleWithEncryption ¶
func HandleWithEncryption(provider secretProvider, handler http.Handler) http.HandlerFunc
HandleWithEncryption returns a http handler function that encrypts content returned by handler using key provided by secretProvider.
func Sign ¶
func Sign(privateKey *ecdsa.PrivateKey, message string) (string, error)
Sign signs a message with an ECDSA private key. Returns signature in 0x string format.
func SignWithTimestamp ¶
SignWithTimestamp signs a message with an ECDSA private key. Returns signature in 0x string format.
func ValidateSignedMessage
deprecated
ValidateSignedMessage validates a signed message and returns wallet address from signature. Expects signature in 0x string format (hex).
Deprecated: ValidateSignedMessage is half-broken, as it does not check that the signature matches the message. You instead have to rely on checking the returned address matches the expected one. Use VerifySignedMessage instead.
Types ¶
type HagallSecretProvider ¶
type HagallSecretProvider struct {
// contains filtered or unexported fields
}
A secret provider using Hagall token from HDS client.
func NewHagallSecretProvider ¶
func NewHagallSecretProvider(client hdsClient) HagallSecretProvider
Returns a new HagallSecretProvider.
func (HagallSecretProvider) GetKey ¶
func (h HagallSecretProvider) GetKey() ([]byte, error)
GetKey generates a 256-bit key using sha256 hash of Hagall secret with cache.