Add API Metadata Encryption

This commit is contained in:
Samuel Lorch 2025-05-12 14:43:04 +02:00
parent d5f79a943f
commit b0a66d5dbf
2 changed files with 18 additions and 0 deletions

View file

@ -68,3 +68,14 @@ func (c *Client) DecryptMetadata(metadataKey *crypto.Key, armoredCiphertext stri
return metadata, nil
}
func (c *Client) EncryptMetadata(metadataKey *crypto.Key, data string) (string, error) {
armoredCiphertext, err := c.EncryptMessageWithKey(metadataKey, data)
if err != nil {
return "", fmt.Errorf("Encrypting Metadata: %w", err)
}
// TODO save Session Key to cache
return armoredCiphertext, nil
}