Versions in this module Expand all Collapse all v0 v0.8.1 Feb 21, 2022 v0.8.0 Feb 11, 2022 Changes in this version + func BuildKeyFromEnv() ([]byte, error) + func Decrypt(data *EncryptedData, key []byte) ([]byte, error) + func DeriveKey(publicKey *ecdsa.PublicKey, privateKey *ecdsa.PrivateKey) []byte + func GenerateKey() (*ecdsa.PrivateKey, error) + func Hash(data []byte) []byte + func LoadPrivateKey(privateKey []byte) (*ecdsa.PrivateKey, error) + func LoadPublicKey(publicKey []byte) (*ecdsa.PublicKey, error) + func RandomBytes(n int) ([]byte, error) + func Verify(message []byte, signatureBytes []byte, publicKey *ecdsa.PublicKey) (bool, error) + func VerifyWithBytes(message, signature, publicKeyData []byte) (bool, error) + type Actor struct + EncryptionKey *Key + Name string + SigningKey *Key + func MakeActor(name string) (*Actor, error) + type ECDHEncryptedData struct + Data []byte + IV []byte + PublicKey []byte + func (e *ECDHEncryptedData) Sign(key *Key) (*SignedData, error) + type ECDSASignature struct + R *big.Int + S *big.Int + func Sign(message []byte, privateKey *ecdsa.PrivateKey) (*ECDSASignature, error) + func (e *ECDSASignature) Serialize() []byte + type EncryptedData struct + Data []byte + IV []byte + func Encrypt(data, key []byte) (*EncryptedData, error) + type JWKPrivateKey struct + Curve string + D string + Extractable bool + KeyOps []string + KeyType string + X string + Y string + type Key struct + Format string + Name string + Params map[string]interface{} + PrivateKey []byte + PublicKey []byte + Purposes []string + Type string + func AsSettingsKey(key *ecdsa.PrivateKey, name, keyType string) (*Key, error) + func GenerateWebKey(name, keyType string) (*Key, error) + func (k *Key) Encrypt(data []byte, recipient *Key) (*ECDHEncryptedData, error) + func (k *Key) Sign(data []byte) (*SignedData, error) + func (k *Key) SignString(data string) (*SignedStringData, error) + func (k *Key) Verify(data *SignedData) (bool, error) + func (k *Key) VerifyString(data *SignedStringData) (bool, error) + type KeyPair struct + PrivateKey *ecdsa.PrivateKey + PrivateKeyBytes []byte + PublicKey *ecdsa.PublicKey + PublicKeyBytes []byte + func KeyPairFromStrings(keyPair *StringKeyPair) (*KeyPair, error) + type SignedData struct + Data []byte + PublicKey []byte + Signature []byte + func (s *SignedData) AsMap() map[string]interface{} + func (s *SignedData) Verify(publicKey *ecdsa.PublicKey) (bool, error) + type SignedStringData struct + Data string + PublicKey []byte + Signature []byte + func (s *SignedStringData) AsMap() map[string]interface{} + type StringKeyPair struct + PrivateKey string + PublicKey string + type WebKey struct + PrivateKey *JWKPrivateKey + PublicKey string + func AsWebKey(key *ecdsa.PrivateKey, keyType string) (*WebKey, error)