testusers

package
v0.1.0-alpha.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 13, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package testusers holds the tagged structs the encrypt tests encrypt through the generated API: a record in separate columns, an opaque struct, and a probe struct with one field of each scalar type for the term ordering tests. The *_stash.go files beside them are what stashgen writes from the tags; `go generate ./...` rewrites them, and CI fails when that changes a file.

Index

Constants

This section is empty.

Variables

View Source
var AccountFields = struct {
	Email AccountEmailField
}{
	Email: AccountEmailField{gensupport.NewField[string](accountDeclaration, "email")},
}
View Source
var ContactFields = struct {
	Email ContactEmailField
	Notes ContactNotesField
}{
	Email: ContactEmailField{gensupport.NewField[string](contactDeclaration, "email")},
	Notes: ContactNotesField{gensupport.NewField[string](contactDeclaration, "notes")},
}
View Source
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")},
}
View Source
var KindsFields = struct {
	S   KindsSField
	E   KindsEField
	Bo  KindsBoField
	I8  KindsI8Field
	I16 KindsI16Field
	I32 KindsI32Field
	I   KindsIField
	I64 KindsI64Field
	U8  KindsU8Field
	U16 KindsU16Field
	U32 KindsU32Field
	U   KindsUField
	U64 KindsU64Field
	F32 KindsF32Field
	F64 KindsF64Field
	By  KindsByField
	Bl  KindsBlField
	Sc  KindsScField
	St  KindsStField
	D   KindsDField
}{
	S:   KindsSField{gensupport.NewField[string](kindsDeclaration, "s")},
	E:   KindsEField{gensupport.NewField[Email](kindsDeclaration, "e")},
	Bo:  KindsBoField{gensupport.NewField[bool](kindsDeclaration, "bo")},
	I8:  KindsI8Field{gensupport.NewField[int8](kindsDeclaration, "i8")},
	I16: KindsI16Field{gensupport.NewField[int16](kindsDeclaration, "i16")},
	I32: KindsI32Field{gensupport.NewField[int32](kindsDeclaration, "i32")},
	I:   KindsIField{gensupport.NewField[int](kindsDeclaration, "i")},
	I64: KindsI64Field{gensupport.NewField[int64](kindsDeclaration, "i64")},
	U8:  KindsU8Field{gensupport.NewField[uint8](kindsDeclaration, "u8")},
	U16: KindsU16Field{gensupport.NewField[uint16](kindsDeclaration, "u16")},
	U32: KindsU32Field{gensupport.NewField[uint32](kindsDeclaration, "u32")},
	U:   KindsUField{gensupport.NewField[uint](kindsDeclaration, "u")},
	U64: KindsU64Field{gensupport.NewField[uint64](kindsDeclaration, "u64")},
	F32: KindsF32Field{gensupport.NewField[float32](kindsDeclaration, "f32")},
	F64: KindsF64Field{gensupport.NewField[float64](kindsDeclaration, "f64")},
	By:  KindsByField{gensupport.NewField[[]byte](kindsDeclaration, "by")},
	Bl:  KindsBlField{gensupport.NewField[Blob](kindsDeclaration, "bl")},
	Sc:  KindsScField{gensupport.NewField[Score](kindsDeclaration, "sc")},
	St:  KindsStField{gensupport.NewField[Status](kindsDeclaration, "st")},
	D:   KindsDField{gensupport.NewField[time.Duration](kindsDeclaration, "d")},
}
View Source
var LookupFields = struct {
	Email LookupEmailField
	Score LookupScoreField
	Code  LookupCodeField
}{
	Email: LookupEmailField{gensupport.NewField[string](lookupDeclaration, "email")},
	Score: LookupScoreField{gensupport.NewField[int32](lookupDeclaration, "score")},
	Code:  LookupCodeField{gensupport.NewField[Status](lookupDeclaration, "code")},
}
View Source
var MemberFields = struct {
	Age   MemberAgeField
	Email MemberEmailField
	Notes MemberNotesField
}{
	Age:   MemberAgeField{gensupport.NewField[uint32](memberDeclaration, "age")},
	Email: MemberEmailField{gensupport.NewField[string](memberDeclaration, "email")},
	Notes: MemberNotesField{gensupport.NewField[string](memberDeclaration, "notes")},
}
View Source
var NoteFields = struct {
	Text NoteTextField
}{
	Text: NoteTextField{gensupport.NewField[string](noteDeclaration, "text")},
}
View Source
var ProbeFields = struct {
	U32 ProbeU32Field
	U64 ProbeU64Field
	I64 ProbeI64Field
	S   ProbeSField
	B   ProbeBField
}{
	U32: ProbeU32Field{gensupport.NewField[uint32](probeDeclaration, "u32")},
	U64: ProbeU64Field{gensupport.NewField[uint64](probeDeclaration, "u64")},
	I64: ProbeI64Field{gensupport.NewField[int64](probeDeclaration, "i64")},
	S:   ProbeSField{gensupport.NewField[string](probeDeclaration, "s")},
	B:   ProbeBField{gensupport.NewField[[]byte](probeDeclaration, "b")},
}
View Source
var ProfileFields = struct {
	Visits  ProfileVisitsField
	Balance ProfileBalanceField
	Active  ProfileActiveField
	Ratio   ProfileRatioField
	Score   ProfileScoreField
	Note    ProfileNoteField
	Name    ProfileNameField
}{
	Visits:  ProfileVisitsField{gensupport.NewField[int32](profileDeclaration, "visits")},
	Balance: ProfileBalanceField{gensupport.NewField[int64](profileDeclaration, "balance")},
	Active:  ProfileActiveField{gensupport.NewField[bool](profileDeclaration, "active")},
	Ratio:   ProfileRatioField{gensupport.NewField[float32](profileDeclaration, "ratio")},
	Score:   ProfileScoreField{gensupport.NewField[float64](profileDeclaration, "score")},
	Note:    ProfileNoteField{gensupport.NewField[string](profileDeclaration, "note")},
	Name:    ProfileNameField{gensupport.NewField[string](profileDeclaration, "name")},
}
View Source
var SecretFields = struct {
	Value SecretValueField
}{
	Value: SecretValueField{gensupport.NewField[string](secretDeclaration, "value")},
}

Functions

func DecryptMember

func DecryptMember(ctx context.Context, d encrypt.Decrypter, encrypted []EncryptedMember) ([]testmember.Member, error)

DecryptMember opens each EncryptedMember, with one ZeroKMS request for each 500 sealed values, plus one the first time a keyset is used.

Types

type Account

type Account struct {
	ID        uint         `stash:"id,passthrough"`
	CreatedAt time.Time    `stash:"created_at,passthrough"`
	DeletedAt sql.NullTime `stash:"deleted_at,passthrough"`
	Email     string       `stash:"email,encrypt,index=equality"`
	// contains filtered or unexported fields
}

Account is the shape of the plan's accounts example: passthrough fields whose types the FFI codec cannot carry (a time.Time, a driver.Valuer), kept on the host and returned as they are.

func DecryptAccount

func DecryptAccount(ctx context.Context, d encrypt.Decrypter, encrypted []EncryptedAccount) ([]Account, error)

DecryptAccount opens each EncryptedAccount, with one ZeroKMS request for each 500 sealed values, plus one the first time a keyset is used.

type AccountEmailField

type AccountEmailField struct {
	// contains filtered or unexported fields
}

func (AccountEmailField) Encrypt

func (AccountEmailField) Equality

type AgeField

type AgeField struct {
	// contains filtered or unexported fields
}

func (AgeField) Encrypt

func (AgeField) Equality

func (AgeField) Ore

type Blob

type Blob []byte

Defined types over scalars: the engine returns the underlying type and the generated code converts.

type Contact

type Contact struct {
	ID    int64  `stash:"id,passthrough"`
	Email string `stash:"email,encrypt_into=TextEq"`
	Notes string `stash:"notes,encrypt"`
	// contains filtered or unexported fields
}

Contact is one row with an email stored as an EQL value, the shape the cross-language fixture packages/eql/tests/encryption/fixtures/text_eq_query.json is derived under (table users, column email). Its generated file imports encrypt/eql, so the encrypt test binary links the guest build with the EQL types; the tests that want the build without them load it by name.

func DecryptContact

func DecryptContact(ctx context.Context, d encrypt.Decrypter, encrypted []EncryptedContact) ([]Contact, error)

DecryptContact opens each EncryptedContact, with one ZeroKMS request for each 500 sealed values, plus one the first time a keyset is used.

type ContactEmailField

type ContactEmailField struct {
	// contains filtered or unexported fields
}

func (ContactEmailField) Encrypt

func (ContactEmailField) Query

type ContactNotesField

type ContactNotesField struct {
	// contains filtered or unexported fields
}

func (ContactNotesField) Encrypt

type Document

type Document struct {
	Title string
	Body  string
	Tags  []string
	// contains filtered or unexported fields
}

Document is sealed as one value.

func DecryptDocument

func DecryptDocument(ctx context.Context, d encrypt.Decrypter, encrypted []EncryptedDocument) ([]Document, error)

DecryptDocument opens each EncryptedDocument, with one ZeroKMS request for each 500 sealed values, plus one the first time a keyset is used.

type Email

type Email string

Defined types over scalars: the engine returns the underlying type and the generated code converts.

type EmailField

type EmailField struct {
	// contains filtered or unexported fields
}

func (EmailField) Encrypt

func (EmailField) Equality

func (EmailField) Match

type EncryptedAccount

type EncryptedAccount struct {
	ID        uint
	CreatedAt time.Time
	DeletedAt sql.NullTime
	Email     EncryptedAccountEmail
}

func EncryptAccount

func EncryptAccount(ctx context.Context, cipher *encrypt.Cipher, values []Account) ([]EncryptedAccount, error)

EncryptAccount seals each Account, 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 (EncryptedAccount) LogValue

func (e EncryptedAccount) LogValue() slog.Value

func (EncryptedAccount) String

func (e EncryptedAccount) String() string

type EncryptedAccountEmail

type EncryptedAccountEmail struct {
	Ciphertext encrypt.Ciphertext
	Equality   encrypt.EqualityTerm
}

type EncryptedContact

type EncryptedContact struct {
	ID    int64
	Email eql.TextEq
	Notes EncryptedContactNotes
}

func EncryptContact

func EncryptContact(ctx context.Context, cipher *encrypt.Cipher, values []Contact) ([]EncryptedContact, error)

EncryptContact seals each Contact, 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 (EncryptedContact) LogValue

func (e EncryptedContact) LogValue() slog.Value

func (EncryptedContact) String

func (e EncryptedContact) String() string

type EncryptedContactNotes

type EncryptedContactNotes struct {
	Ciphertext encrypt.Ciphertext
}

type EncryptedDocument

type EncryptedDocument struct {
	Sealed encrypt.Ciphertext
}

func EncryptDocument

func EncryptDocument(ctx context.Context, cipher *encrypt.Cipher, values []Document) ([]EncryptedDocument, error)

EncryptDocument seals each Document, 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 (EncryptedDocument) LogValue

func (e EncryptedDocument) LogValue() slog.Value

func (EncryptedDocument) String

func (e EncryptedDocument) String() string

type EncryptedEverything

type EncryptedEverything struct {
	Sealed encrypt.Ciphertext
}

func EncryptEverything

func EncryptEverything(ctx context.Context, cipher *encrypt.Cipher, values []Everything) ([]EncryptedEverything, error)

EncryptEverything seals each Everything, 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 (EncryptedEverything) LogValue

func (e EncryptedEverything) LogValue() slog.Value

func (EncryptedEverything) String

func (e EncryptedEverything) String() string

type EncryptedKinds

func EncryptKinds

func EncryptKinds(ctx context.Context, cipher *encrypt.Cipher, values []Kinds) ([]EncryptedKinds, error)

EncryptKinds seals each Kinds, 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 (EncryptedKinds) LogValue

func (e EncryptedKinds) LogValue() slog.Value

func (EncryptedKinds) String

func (e EncryptedKinds) String() string

type EncryptedKindsBl

type EncryptedKindsBl struct {
	Ciphertext encrypt.Ciphertext
}

type EncryptedKindsBo

type EncryptedKindsBo struct {
	Ciphertext encrypt.Ciphertext
}

type EncryptedKindsBy

type EncryptedKindsBy struct {
	Ciphertext encrypt.Ciphertext
	Equality   encrypt.EqualityTerm
}

type EncryptedKindsD

type EncryptedKindsD struct {
	Ciphertext encrypt.Ciphertext
	Ore        encrypt.OreTerm
}

type EncryptedKindsE

type EncryptedKindsE struct {
	Ciphertext encrypt.Ciphertext
	Equality   encrypt.EqualityTerm
	Match      encrypt.MatchTerm
	Ore        encrypt.OreTerm
}

type EncryptedKindsF32

type EncryptedKindsF32 struct {
	Ciphertext encrypt.Ciphertext
}

type EncryptedKindsF64

type EncryptedKindsF64 struct {
	Ciphertext encrypt.Ciphertext
	Ore        encrypt.OreTerm
}

type EncryptedKindsI

type EncryptedKindsI struct {
	Ciphertext encrypt.Ciphertext
	Ore        encrypt.OreTerm
}

type EncryptedKindsI8

type EncryptedKindsI8 struct {
	Ciphertext encrypt.Ciphertext
	Equality   encrypt.EqualityTerm
	Ore        encrypt.OreTerm
}

type EncryptedKindsI16

type EncryptedKindsI16 struct {
	Ciphertext encrypt.Ciphertext
	Ope        encrypt.OpeTerm
}

type EncryptedKindsI32

type EncryptedKindsI32 struct {
	Ciphertext encrypt.Ciphertext
	Equality   encrypt.EqualityTerm
}

type EncryptedKindsI64

type EncryptedKindsI64 struct {
	Ciphertext encrypt.Ciphertext
}

type EncryptedKindsS

type EncryptedKindsS struct {
	Ciphertext encrypt.Ciphertext
	Equality   encrypt.EqualityTerm
	Match      encrypt.MatchTerm
}

type EncryptedKindsSc

type EncryptedKindsSc struct {
	Ciphertext encrypt.Ciphertext
	Ore        encrypt.OreTerm
}

type EncryptedKindsSt

type EncryptedKindsSt struct {
	Ciphertext encrypt.Ciphertext
	Equality   encrypt.EqualityTerm
}

type EncryptedKindsU

type EncryptedKindsU struct {
	Ciphertext encrypt.Ciphertext
}

type EncryptedKindsU8

type EncryptedKindsU8 struct {
	Ciphertext encrypt.Ciphertext
	Equality   encrypt.EqualityTerm
}

type EncryptedKindsU16

type EncryptedKindsU16 struct {
	Ciphertext encrypt.Ciphertext
}

type EncryptedKindsU32

type EncryptedKindsU32 struct {
	Ciphertext encrypt.Ciphertext
	Equality   encrypt.EqualityTerm
	Ore        encrypt.OreTerm
}

type EncryptedKindsU64

type EncryptedKindsU64 struct {
	Ciphertext encrypt.Ciphertext
	Ope        encrypt.OpeTerm
}

type EncryptedLookup

type EncryptedLookup struct {
	ID    int64
	Email EncryptedLookupEmail
	Score EncryptedLookupScore
	Code  EncryptedLookupCode
}

func EncryptLookup

func EncryptLookup(ctx context.Context, cipher *encrypt.Cipher, values []Lookup) ([]EncryptedLookup, error)

EncryptLookup seals each Lookup, 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 (EncryptedLookup) LogValue

func (e EncryptedLookup) LogValue() slog.Value

func (EncryptedLookup) String

func (e EncryptedLookup) String() string

type EncryptedLookupCode

type EncryptedLookupCode struct {
	Equality encrypt.EqualityTerm
}

type EncryptedLookupEmail

type EncryptedLookupEmail struct {
	Ciphertext encrypt.Ciphertext
}

type EncryptedLookupScore

type EncryptedLookupScore struct {
	Ore encrypt.OreTerm
}

type EncryptedMember

type EncryptedMember struct {
	ID    int64
	Age   EncryptedMemberAge
	Email EncryptedMemberEmail
	Notes EncryptedMemberNotes
}

func EncryptMember

func EncryptMember(ctx context.Context, cipher *encrypt.Cipher, values []testmember.Member) ([]EncryptedMember, error)

EncryptMember 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 EncryptedNote

type EncryptedNote struct {
	Tenant string
	Text   EncryptedNoteText
	ID     uint32
}

func EncryptNote

func EncryptNote(ctx context.Context, cipher *encrypt.Cipher, values []Note) ([]EncryptedNote, error)

EncryptNote seals each Note, 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 (EncryptedNote) LogValue

func (e EncryptedNote) LogValue() slog.Value

func (EncryptedNote) String

func (e EncryptedNote) String() string

type EncryptedNoteText

type EncryptedNoteText struct {
	Ciphertext encrypt.Ciphertext
	Equality   encrypt.EqualityTerm
}

type EncryptedProbe

func EncryptProbe

func EncryptProbe(ctx context.Context, cipher *encrypt.Cipher, values []Probe) ([]EncryptedProbe, error)

EncryptProbe seals each Probe, 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 (EncryptedProbe) LogValue

func (e EncryptedProbe) LogValue() slog.Value

func (EncryptedProbe) String

func (e EncryptedProbe) String() string

type EncryptedProbeB

type EncryptedProbeB struct {
	Ciphertext encrypt.Ciphertext
	Ore        encrypt.OreTerm
	Ope        encrypt.OpeTerm
}

type EncryptedProbeI64

type EncryptedProbeI64 struct {
	Ciphertext encrypt.Ciphertext
	Ore        encrypt.OreTerm
	Ope        encrypt.OpeTerm
}

type EncryptedProbeS

type EncryptedProbeS struct {
	Ciphertext encrypt.Ciphertext
	Ore        encrypt.OreTerm
	Ope        encrypt.OpeTerm
}

type EncryptedProbeU32

type EncryptedProbeU32 struct {
	Ciphertext encrypt.Ciphertext
	Ore        encrypt.OreTerm
	Ope        encrypt.OpeTerm
}

type EncryptedProbeU64

type EncryptedProbeU64 struct {
	Ciphertext encrypt.Ciphertext
	Ore        encrypt.OreTerm
	Ope        encrypt.OpeTerm
}

type EncryptedProfile

type EncryptedProfile struct {
	ID      int64
	Visits  eql.Integer
	Balance eql.Bigint
	Active  eql.Boolean
	Ratio   eql.Real
	Score   eql.Double
	Note    eql.Text
	Name    eql.TextMatch
}

func EncryptProfile

func EncryptProfile(ctx context.Context, cipher *encrypt.Cipher, values []Profile) ([]EncryptedProfile, error)

EncryptProfile seals each Profile, 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 (EncryptedProfile) LogValue

func (e EncryptedProfile) LogValue() slog.Value

func (EncryptedProfile) String

func (e EncryptedProfile) String() string

type EncryptedSecret

type EncryptedSecret struct {
	ID    int64
	Value EncryptedSecretValue
}

func EncryptSecret

func EncryptSecret(ctx context.Context, cipher *encrypt.Cipher, values []Secret) ([]EncryptedSecret, error)

EncryptSecret seals each Secret, 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 (EncryptedSecret) LogValue

func (e EncryptedSecret) LogValue() slog.Value

func (EncryptedSecret) String

func (e EncryptedSecret) String() string

type EncryptedSecretValue

type EncryptedSecretValue struct {
	Ciphertext encrypt.Ciphertext
}

type EncryptedUser

type EncryptedUser struct {
	ID    int64
	Age   EncryptedUserAge
	Email EncryptedUserEmail
	Notes EncryptedUserNotes
}

func Encrypt

func Encrypt(ctx context.Context, cipher *encrypt.Cipher, testusers []User) ([]EncryptedUser, error)

Encrypt seals each User, 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 (EncryptedUser) LogValue

func (e EncryptedUser) LogValue() slog.Value

func (EncryptedUser) String

func (e EncryptedUser) String() string

type EncryptedUserAge

type EncryptedUserAge struct {
	Ciphertext encrypt.Ciphertext
	Equality   encrypt.EqualityTerm
	Ore        encrypt.OreTerm
}

type EncryptedUserEmail

type EncryptedUserEmail struct {
	Ciphertext encrypt.Ciphertext
	Equality   encrypt.EqualityTerm
	Match      encrypt.MatchTerm
}

type EncryptedUserNotes

type EncryptedUserNotes struct {
	Ciphertext encrypt.Ciphertext
}

type Everything

type Everything struct {
	S      string
	E      Email
	Bo     bool
	I8     int8
	I      int
	U64    uint64
	F32    float32
	F64    float64
	By     []byte
	Bl     Blob
	Sc     Score
	Tags   []string
	Ints   []int
	F32s   []float32
	St     Status
	D      time.Duration
	Emails []Email
	Counts map[string]int
	Labels map[string]string
	ByKey  map[int]string
	In     Inner
	Ins    []Inner
	P      *string
	PI     *Inner
	T      time.Time
	N      sql.NullTime
	Nested [][]byte
	Arr    [2]uint8
	// contains filtered or unexported fields
}

Everything is an opaque struct with a field of every type JSON carries both ways. It crosses as one document and comes back as it was.

func DecryptEverything

func DecryptEverything(ctx context.Context, d encrypt.Decrypter, encrypted []EncryptedEverything) ([]Everything, error)

DecryptEverything opens each EncryptedEverything, with one ZeroKMS request for each 500 sealed values, plus one the first time a keyset is used.

type Inner

type Inner struct {
	Name string
	N    int32
}

Inner is a struct carried through a passthrough field and inside an opaque struct.

type Kinds

type Kinds struct {
	S   string        `stash:"s,encrypt,index=equality;match"`
	E   Email         `stash:"e,encrypt,index=equality;match;ore"`
	Bo  bool          `stash:"bo,encrypt"`
	I8  int8          `stash:"i8,encrypt,index=equality;ore"`
	I16 int16         `stash:"i16,encrypt,index=ope"`
	I32 int32         `stash:"i32,encrypt,index=equality"`
	I   int           `stash:"i,encrypt,index=ore"`
	I64 int64         `stash:"i64,encrypt"`
	U8  uint8         `stash:"u8,encrypt,index=equality"`
	U16 uint16        `stash:"u16,encrypt"`
	U32 uint32        `stash:"u32,encrypt,index=equality;ore"`
	U   uint          `stash:"u,encrypt"`
	U64 uint64        `stash:"u64,encrypt,index=ope"`
	F32 float32       `stash:"f32,encrypt"`
	F64 float64       `stash:"f64,encrypt,index=ore"`
	By  []byte        `stash:"by,encrypt,index=equality"`
	Bl  Blob          `stash:"bl,encrypt"`
	Sc  Score         `stash:"sc,encrypt,index=ore"`
	St  Status        `stash:"st,encrypt,index=equality"`
	D   time.Duration `stash:"d,encrypt,index=ore"`

	P  *int              `stash:"p,passthrough"`
	M  map[string]string `stash:"m,passthrough"`
	T  time.Time         `stash:"t,passthrough"`
	N  sql.NullTime      `stash:"n,passthrough"`
	In Inner             `stash:"in,passthrough"`
	Sk []Inner           `stash:"sk,passthrough"`
	A  any               `stash:"a,passthrough"`
	Er error             `stash:"er,passthrough"`
	// contains filtered or unexported fields
}

Kinds has one sealed field of every scalar kind stashgen accepts outside an opaque struct, with defined types among them, and passthrough fields of types the codec cannot carry. Everything it accepts round-trips.

func DecryptKinds

func DecryptKinds(ctx context.Context, d encrypt.Decrypter, encrypted []EncryptedKinds) ([]Kinds, error)

DecryptKinds opens each EncryptedKinds, with one ZeroKMS request for each 500 sealed values, plus one the first time a keyset is used.

type KindsBlField

type KindsBlField struct {
	// contains filtered or unexported fields
}

func (KindsBlField) Encrypt

type KindsBoField

type KindsBoField struct {
	// contains filtered or unexported fields
}

func (KindsBoField) Encrypt

type KindsByField

type KindsByField struct {
	// contains filtered or unexported fields
}

func (KindsByField) Encrypt

func (f KindsByField) Encrypt(ctx context.Context, c *encrypt.Cipher, v []byte) (EncryptedKindsBy, error)

func (KindsByField) Equality

func (f KindsByField) Equality(ctx context.Context, c *encrypt.Cipher, v []byte) (encrypt.EqualityTerm, error)

type KindsDField

type KindsDField struct {
	// contains filtered or unexported fields
}

func (KindsDField) Encrypt

func (KindsDField) Ore

type KindsEField

type KindsEField struct {
	// contains filtered or unexported fields
}

func (KindsEField) Encrypt

func (KindsEField) Equality

func (KindsEField) Match

func (KindsEField) Ore

type KindsF32Field

type KindsF32Field struct {
	// contains filtered or unexported fields
}

func (KindsF32Field) Encrypt

type KindsF64Field

type KindsF64Field struct {
	// contains filtered or unexported fields
}

func (KindsF64Field) Encrypt

func (KindsF64Field) Ore

type KindsI8Field

type KindsI8Field struct {
	// contains filtered or unexported fields
}

func (KindsI8Field) Encrypt

func (KindsI8Field) Equality

func (KindsI8Field) Ore

type KindsI16Field

type KindsI16Field struct {
	// contains filtered or unexported fields
}

func (KindsI16Field) Encrypt

func (KindsI16Field) Ope

type KindsI32Field

type KindsI32Field struct {
	// contains filtered or unexported fields
}

func (KindsI32Field) Encrypt

func (KindsI32Field) Equality

type KindsI64Field

type KindsI64Field struct {
	// contains filtered or unexported fields
}

func (KindsI64Field) Encrypt

type KindsIField

type KindsIField struct {
	// contains filtered or unexported fields
}

func (KindsIField) Encrypt

func (f KindsIField) Encrypt(ctx context.Context, c *encrypt.Cipher, v int) (EncryptedKindsI, error)

func (KindsIField) Ore

type KindsSField

type KindsSField struct {
	// contains filtered or unexported fields
}

func (KindsSField) Encrypt

func (KindsSField) Equality

func (KindsSField) Match

type KindsScField

type KindsScField struct {
	// contains filtered or unexported fields
}

func (KindsScField) Encrypt

func (KindsScField) Ore

type KindsStField

type KindsStField struct {
	// contains filtered or unexported fields
}

func (KindsStField) Encrypt

func (KindsStField) Equality

type KindsU8Field

type KindsU8Field struct {
	// contains filtered or unexported fields
}

func (KindsU8Field) Encrypt

func (KindsU8Field) Equality

type KindsU16Field

type KindsU16Field struct {
	// contains filtered or unexported fields
}

func (KindsU16Field) Encrypt

type KindsU32Field

type KindsU32Field struct {
	// contains filtered or unexported fields
}

func (KindsU32Field) Encrypt

func (KindsU32Field) Equality

func (KindsU32Field) Ore

type KindsU64Field

type KindsU64Field struct {
	// contains filtered or unexported fields
}

func (KindsU64Field) Encrypt

func (KindsU64Field) Ope

type KindsUField

type KindsUField struct {
	// contains filtered or unexported fields
}

func (KindsUField) Encrypt

type Lookup

type Lookup struct {
	ID    int64  `stash:"id,passthrough"`
	Email string `stash:"email,encrypt"`
	Score int32  `stash:"score,index=ore"`
	Code  Status `stash:"code,index=equality"`
	// contains filtered or unexported fields
}

Lookup has index-only fields: each stores its terms and no ciphertext, so Decrypt leaves it at its zero value and still opens the sealed field.

func DecryptLookup

func DecryptLookup(ctx context.Context, d encrypt.Decrypter, encrypted []EncryptedLookup) ([]Lookup, error)

DecryptLookup opens each EncryptedLookup, with one ZeroKMS request for each 500 sealed values, plus one the first time a keyset is used.

DecryptLookup leaves Score and Code at the zero value: an index-only field stores no ciphertext, so nothing opens for it. Do not pass a decrypted value back to EncryptLookup to update its row, because EncryptLookup would then store the term for zero. Derive the index-only terms again from the real values through LookupFields.

type LookupCodeField

type LookupCodeField struct {
	// contains filtered or unexported fields
}

func (LookupCodeField) Encrypt

func (LookupCodeField) Equality

type LookupEmailField

type LookupEmailField struct {
	// contains filtered or unexported fields
}

func (LookupEmailField) Encrypt

type LookupScoreField

type LookupScoreField struct {
	// contains filtered or unexported fields
}

func (LookupScoreField) Encrypt

func (LookupScoreField) Ore

type MemberAgeField

type MemberAgeField struct {
	// contains filtered or unexported fields
}

func (MemberAgeField) Encrypt

func (MemberAgeField) Equality

func (MemberAgeField) Ore

type MemberEmailField

type MemberEmailField struct {
	// contains filtered or unexported fields
}

func (MemberEmailField) Encrypt

func (MemberEmailField) Equality

func (MemberEmailField) Match

type MemberNotesField

type MemberNotesField struct {
	// contains filtered or unexported fields
}

func (MemberNotesField) Encrypt

type Note

type Note struct {
	Tenant string `stash:"tenant,context_field"`
	Text   string `stash:"text,encrypt,index=equality"`
	ID     uint32 `stash:"id,passthrough"`
}

Note takes its context from its own Tenant field, as the Rust record fixture's context-field case does (the `context_field` key of packages/stack-encrypt/tests/fixtures/record_lowering.json): the same field names, kinds and index, so the fixture's records open through the generated code and its term compares.

func DecryptNote

func DecryptNote(ctx context.Context, d encrypt.Decrypter, encrypted []EncryptedNote) ([]Note, error)

DecryptNote opens each EncryptedNote, with one ZeroKMS request for each 500 sealed values, plus one the first time a keyset is used.

type NoteTextField

type NoteTextField struct {
	// contains filtered or unexported fields
}

func (NoteTextField) Encrypt

func (NoteTextField) Equality

type NotesField

type NotesField struct {
	// contains filtered or unexported fields
}

func (NotesField) Encrypt

type Probe

type Probe struct {
	U32 uint32 `stash:"u32,encrypt,index=ore;ope"`
	U64 uint64 `stash:"u64,encrypt,index=ore;ope"`
	I64 int64  `stash:"i64,encrypt,index=ore;ope"`
	S   string `stash:"s,encrypt,index=ore;ope"`
	B   []byte `stash:"b,encrypt,index=ore;ope"`
	// contains filtered or unexported fields
}

Probe has one field of each scalar type the ORE and OPE indexes order, for the property tests of term ordering.

func DecryptProbe

func DecryptProbe(ctx context.Context, d encrypt.Decrypter, encrypted []EncryptedProbe) ([]Probe, error)

DecryptProbe opens each EncryptedProbe, with one ZeroKMS request for each 500 sealed values, plus one the first time a keyset is used.

type ProbeBField

type ProbeBField struct {
	// contains filtered or unexported fields
}

func (ProbeBField) Encrypt

func (f ProbeBField) Encrypt(ctx context.Context, c *encrypt.Cipher, v []byte) (EncryptedProbeB, error)

func (ProbeBField) Ope

func (ProbeBField) Ore

type ProbeI64Field

type ProbeI64Field struct {
	// contains filtered or unexported fields
}

func (ProbeI64Field) Encrypt

func (ProbeI64Field) Ope

func (ProbeI64Field) Ore

type ProbeSField

type ProbeSField struct {
	// contains filtered or unexported fields
}

func (ProbeSField) Encrypt

func (ProbeSField) Ope

func (ProbeSField) Ore

type ProbeU32Field

type ProbeU32Field struct {
	// contains filtered or unexported fields
}

func (ProbeU32Field) Encrypt

func (ProbeU32Field) Ope

func (ProbeU32Field) Ore

type ProbeU64Field

type ProbeU64Field struct {
	// contains filtered or unexported fields
}

func (ProbeU64Field) Encrypt

func (ProbeU64Field) Ope

func (ProbeU64Field) Ore

type Profile

type Profile struct {
	ID      int64   `stash:"id,passthrough"`
	Visits  int32   `stash:"visits,encrypt_into=Integer"`
	Balance int64   `stash:"balance,encrypt_into=Bigint"`
	Active  bool    `stash:"active,encrypt_into=Boolean"`
	Ratio   float32 `stash:"ratio,encrypt_into=Real"`
	Score   float64 `stash:"score,encrypt_into=Double"`
	Note    string  `stash:"note,encrypt_into=Text"`
	Name    string  `stash:"name,encrypt_into=TextMatch"`
	// contains filtered or unexported fields
}

Profile stores one field in each EQL v4 type the engine produces besides TextEq, the shape the cross-language fixtures under packages/eql/tests/encryption/fixtures (v4_queries.json, v4_rows.json) are derived under (table profiles).

func DecryptProfile

func DecryptProfile(ctx context.Context, d encrypt.Decrypter, encrypted []EncryptedProfile) ([]Profile, error)

DecryptProfile opens each EncryptedProfile, with one ZeroKMS request for each 500 sealed values, plus one the first time a keyset is used.

type ProfileActiveField

type ProfileActiveField struct {
	// contains filtered or unexported fields
}

func (ProfileActiveField) Encrypt

type ProfileBalanceField

type ProfileBalanceField struct {
	// contains filtered or unexported fields
}

func (ProfileBalanceField) Encrypt

type ProfileNameField

type ProfileNameField struct {
	// contains filtered or unexported fields
}

func (ProfileNameField) Encrypt

func (ProfileNameField) Query

type ProfileNoteField

type ProfileNoteField struct {
	// contains filtered or unexported fields
}

func (ProfileNoteField) Encrypt

func (f ProfileNoteField) Encrypt(ctx context.Context, c *encrypt.Cipher, v string) (eql.Text, error)

type ProfileRatioField

type ProfileRatioField struct {
	// contains filtered or unexported fields
}

func (ProfileRatioField) Encrypt

func (f ProfileRatioField) Encrypt(ctx context.Context, c *encrypt.Cipher, v float32) (eql.Real, error)

type ProfileScoreField

type ProfileScoreField struct {
	// contains filtered or unexported fields
}

func (ProfileScoreField) Encrypt

type ProfileVisitsField

type ProfileVisitsField struct {
	// contains filtered or unexported fields
}

func (ProfileVisitsField) Encrypt

type Score

type Score int16

Defined types over scalars: the engine returns the underlying type and the generated code converts.

type Secret

type Secret struct {
	ID    int64  `stash:"id,passthrough"`
	Value string `stash:"value,encrypt"`
	// contains filtered or unexported fields
}

Secret is generated with -redact, so it prints no sealed field.

func DecryptSecret

func DecryptSecret(ctx context.Context, d encrypt.Decrypter, encrypted []EncryptedSecret) ([]Secret, error)

DecryptSecret opens each EncryptedSecret, with one ZeroKMS request for each 500 sealed values, plus one the first time a keyset is used.

func (Secret) GoString

func (s Secret) GoString() string

GoString is what %#v prints; without it %#v prints every field.

func (Secret) LogValue

func (s Secret) LogValue() slog.Value

func (Secret) String

func (s Secret) String() string

Written because of -redact: Secret no longer prints its sealed fields.

type SecretValueField

type SecretValueField struct {
	// contains filtered or unexported fields
}

func (SecretValueField) Encrypt

type Status

type Status string

Defined types over scalars: the engine returns the underlying type and the generated code converts.

type User

type User struct {
	ID       int64  `stash:"id,passthrough"`
	Age      uint32 `stash:"age,encrypt,index=equality;ore"`
	Email    string `stash:"email,encrypt,index=equality;match"`
	Notes    string `stash:"notes,encrypt"`
	Internal string `stash:"-"`
	// contains filtered or unexported fields
}

User is the record of the Rust record fixture (packages/stack-encrypt/tests/fixtures/record_lowering.json): the same context, identities, kinds and indexes, so the fixture's records open through the generated code and its terms compare.

func Decrypt

func Decrypt(ctx context.Context, d encrypt.Decrypter, encrypted []EncryptedUser) ([]User, error)

Decrypt opens each EncryptedUser, with one ZeroKMS request for each 500 sealed values, plus one the first time a keyset is used.

func DecryptRows

func DecryptRows(ctx context.Context, d encrypt.Decrypter, rows []UserRow) ([]User, error)

type UserRow

type UserRow struct {
	ID         int64                `stash:"id"`
	Age        encrypt.Ciphertext   `stash:"age"`
	AgeEq      encrypt.EqualityTerm `stash:"age,equality"`
	AgeOre     encrypt.OreTerm      `stash:"age,ore"`
	Email      encrypt.Ciphertext   `stash:"email"`
	EmailEq    encrypt.EqualityTerm `stash:"email,equality"`
	EmailMatch encrypt.MatchTerm    `stash:"email,match"`
	Notes      encrypt.Ciphertext   `stash:"notes"`
}

UserRow is a model for User in separate columns: one field for each output, each tagged with the output it holds, for a library that maps one struct field to one column.

func EncryptRows

func EncryptRows(ctx context.Context, cipher *encrypt.Cipher, testusers []User) ([]UserRow, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL