Documentation
¶
Overview ¶
Package encryptionkey manages encryption keys for users
Index ¶
- Constants
- func DecodeTurnkeyPrivateKey(encodedPrivateKey string) (*kem.PrivateKey, error)
- func DecodeTurnkeyPublicKey(encodedPublicKey string) (*kem.PublicKey, error)
- func EncodePrivateKey(privateKey kem.PrivateKey) (string, error)
- func EncodePublicKey(publicKey kem.PublicKey) (string, error)
- type Key
- type Metadata
Constants ¶
const KemID hpke.KEM = hpke.KEM_P256_HKDF_SHA256
KemID for HPKE protocol.
Variables ¶
This section is empty.
Functions ¶
func DecodeTurnkeyPrivateKey ¶
func DecodeTurnkeyPrivateKey(encodedPrivateKey string) (*kem.PrivateKey, error)
DecodeTurnkeyPrivateKey takes a Turnkey-encoded private key and creates a KEM private key.
func DecodeTurnkeyPublicKey ¶
DecodeTurnkeyPublicKey takes a Turnkey-encoded public key and creates a KEM public key.
func EncodePrivateKey ¶
func EncodePrivateKey(privateKey kem.PrivateKey) (string, error)
EncodePrivateKey encodes a KEM private key into the Turnkey format. For now, "Turnkey format" = raw DER form.
Types ¶
type Key ¶
type Key struct { Metadata TkPrivateKey string `json:"-"` // do not store the private key in the metadata file TkPublicKey string `json:"public_key"` // contains filtered or unexported fields }
Key defines a structure in which to hold both serialized and ecdh-lib-friendly versions of a Turnkey Encryption keypair.
func FromKemPrivateKey ¶
func FromKemPrivateKey(privateKey kem.PrivateKey) (*Key, error)
FromKemPrivateKey takes a HPKE KEM keypair and forms a Turnkey encryption key from it. Assumes that privateKey.Public() has already been derived.
func FromTurnkeyPrivateKey ¶
FromTurnkeyPrivateKey takes a Turnkey-encoded private key, derives a public key from it, and then returns the corresponding Turnkey API key.
func (Key) GetPrivateKey ¶
GetPrivateKey gets the key's private key.
func (Key) GetPublicKey ¶
GetPublicKey gets the key's public key.
func (Key) LoadMetadata ¶
LoadMetadata loads a JSON metadata file.
func (*Key) MergeMetadata ¶
MergeMetadata merges the given metadata with the api key.