16 lines
364 B
Go
16 lines
364 B
Go
package crypto
|
|
|
|
import "context"
|
|
|
|
type Envelope struct {
|
|
Version uint8 `json:"version"`
|
|
KeyID string `json:"key_id"`
|
|
Nonce []byte `json:"nonce"`
|
|
Ciphertext []byte `json:"ciphertext"`
|
|
}
|
|
|
|
type KeyCipher interface {
|
|
Encrypt(ctx context.Context, plaintext []byte) (Envelope, error)
|
|
Decrypt(ctx context.Context, envelope Envelope) ([]byte, error)
|
|
}
|