Documentation
¶
Overview ¶
Package testpolicy holds the file stashgen.Generate writes for testmember.Member from a policy (see internal/genmember): the generated Encrypt, Decrypt and Fields over *testmember.Member, with the declaration testusers.User carries as tags. The encrypt tests run it against the deterministic guest beside the tag path and the -for path, so code from a policy is executed, not only compiled. `go generate ./...` rewrites member_stash.go, and CI fails when that changes it.
Index ¶
- Variables
- func Decrypt(ctx context.Context, d encrypt.Decrypter, encrypted []EncryptedMember) ([]testmember.Member, error)
- type AgeField
- func (f AgeField) Between(ctx context.Context, c *encrypt.Cipher, lo, hi uint32) (encrypt.Range[encrypt.OreTerm], error)
- func (f AgeField) Encrypt(ctx context.Context, c *encrypt.Cipher, v uint32) (EncryptedMemberAge, error)
- func (f AgeField) Eq(ctx context.Context, c *encrypt.Cipher, v uint32) (encrypt.EqualityTerm, error)
- func (f AgeField) Gt(ctx context.Context, c *encrypt.Cipher, v uint32) (encrypt.OreTerm, error)
- func (f AgeField) Gte(ctx context.Context, c *encrypt.Cipher, v uint32) (encrypt.OreTerm, error)
- func (f AgeField) Lt(ctx context.Context, c *encrypt.Cipher, v uint32) (encrypt.OreTerm, error)
- func (f AgeField) Lte(ctx context.Context, c *encrypt.Cipher, v uint32) (encrypt.OreTerm, error)
- type EmailField
- func (f EmailField) Encrypt(ctx context.Context, c *encrypt.Cipher, v string) (EncryptedMemberEmail, error)
- func (f EmailField) Eq(ctx context.Context, c *encrypt.Cipher, v string) (encrypt.EqualityTerm, error)
- func (f EmailField) Matches(ctx context.Context, c *encrypt.Cipher, v string) (encrypt.MatchQuery[string], error)
- type EncryptedMember
- type EncryptedMemberAge
- type EncryptedMemberEmail
- type EncryptedMemberNotes
- type NotesField
Constants ¶
This section is empty.
Variables ¶
var Fields = struct { Age AgeField Email EmailField Notes NotesField }{ Age: AgeField{gensupport.NewField[uint32](declaration, "age")}, Email: EmailField{gensupport.NewField[string](declaration, "email")}, Notes: NotesField{gensupport.NewField[string](declaration, "notes")}, }
Functions ¶
func Decrypt ¶
func Decrypt(ctx context.Context, d encrypt.Decrypter, encrypted []EncryptedMember) ([]testmember.Member, error)
Decrypt opens each EncryptedMember, with one ZeroKMS request for each 500 sealed values, plus one the first time a keyset is used.
Types ¶
type AgeField ¶
type AgeField struct {
// contains filtered or unexported fields
}
type EmailField ¶
type EmailField struct {
// contains filtered or unexported fields
}
func (EmailField) Encrypt ¶
func (f EmailField) Encrypt(ctx context.Context, c *encrypt.Cipher, v string) (EncryptedMemberEmail, error)
type EncryptedMember ¶
type EncryptedMember struct {
ID int64
Age EncryptedMemberAge
Email EncryptedMemberEmail
Notes EncryptedMemberNotes
}
func Encrypt ¶
func Encrypt(ctx context.Context, cipher *encrypt.Cipher, testpolicy []testmember.Member) ([]EncryptedMember, error)
Encrypt seals each testmember.Member, with one ZeroKMS request for each 500 sealed values, plus one the first time a keyset is used. The result has one element for each input, in the same order.
func (EncryptedMember) LogValue ¶
func (e EncryptedMember) LogValue() slog.Value
func (EncryptedMember) String ¶
func (e EncryptedMember) String() string
type EncryptedMemberAge ¶
type EncryptedMemberAge struct {
Ciphertext encrypt.Ciphertext
Equality encrypt.EqualityTerm
Ore encrypt.OreTerm
}
type EncryptedMemberEmail ¶
type EncryptedMemberEmail struct {
Ciphertext encrypt.Ciphertext
Equality encrypt.EqualityTerm
Match encrypt.MatchTerm
}
type EncryptedMemberNotes ¶
type EncryptedMemberNotes struct {
Ciphertext encrypt.Ciphertext
}
type NotesField ¶
type NotesField struct {
// contains filtered or unexported fields
}
func (NotesField) Encrypt ¶
func (f NotesField) Encrypt(ctx context.Context, c *encrypt.Cipher, v string) (EncryptedMemberNotes, error)