crypt

package
v0.1.12 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 18, 2024 License: MIT Imports: 14 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Decrypt

func Decrypt(buf []byte, key []byte) ([]byte, error)

Decrypt decrypts buf using key with AES-GCM AEAD mode.

func Encrypt

func Encrypt(buf []byte, key []byte) ([]byte, error)

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

func SignWithTimestamp(privateKey *ecdsa.PrivateKey, message string) (string, string, error)

SignWithTimestamp signs a message with an ECDSA private key. Returns signature in 0x string format.

func ValidateSignedMessage

func ValidateSignedMessage(message string, signature string) (common.Address, error)

ValidateSignedMessage validates a signed message and returns wallet address from signature.

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL