Documentation
¶
Index ¶
Constants ¶
View Source
const ByteSize = 128
View Source
const GLOBAL_SALT = "oracle/v1"
View Source
const NonceSize = chacha20poly1305.NonceSize
Variables ¶
View Source
var ErrDecryptionFailed = errors.New("decryption failed")
View Source
var ErrEncryptionFailed = errors.New("encryption failed")
View Source
var ErrNoEphemeralKey = errors.New("no ephemeral key")
View Source
var ErrNotImplemented = errors.New("not implemented")
View Source
var UniversalNonce []byte = make([]byte, chacha20poly1305.NonceSize)
Functions ¶
func NewPrincipal ¶
Types ¶
type Certifier ¶
type Certifier interface {
crypto.PrivateKey
crypto.Signer
Verifier
}
a Certifier can produce and verify signatures
type Cipherer ¶
type Cipherer interface {
crypto.PrivateKey
Encrypter
crypto.Decrypter
}
a Cipherer can encrypt and decrypt an [Envelope]
type Message ¶
type Message struct {
To *ecdh.PublicKey
From *ecdh.PublicKey
Metadata *stablemap.StableMap[string, any] // additional authenticated data (AAD)
EphemeralPublicKey []byte
Nonce []byte
CipherText []byte
PlainText []byte
Signature []byte
}
func NewMessage ¶
func (*Message) MarhsalBinary ¶
func (*Message) UnmarshalBinary ¶
type Principal ¶
type Principal interface {
Cipherer
Certifier
encoding.BinaryMarshaler
encoding.BinaryUnmarshaler
}
a Principal is a holder of a public/private key-pair that can perform encryption, decryption, signing, and verifying operations.
Click to show internal directories.
Click to hide internal directories.