Documentation
¶
Overview ¶
Package privacy holds the per-install privacy key (spec §7.6) and what it derives: pseudonyms that follow masked values, and keyed digests of audit-log values (spec Appendix C). The key itself is never used directly, printed or returned.
Index ¶
Constants ¶
const EnvKey = "TAILKEEPER_PRIVACY_KEY"
EnvKey is the variable that carries the key, beside the read credential.
Variables ¶
This section is empty.
Functions ¶
func Normalize ¶
Normalize is what a pseudonym is computed over: JSON escapes decoded, since a policy file may spell a login with them, and email addresses lower-cased.
Types ¶
type Key ¶
type Key struct {
// contains filtered or unexported fields
}
Key names values under the two keys derived from the privacy key: a pseudonym key and a digest key. The derived bytes are captured by two functions and held in no field, because fmt prints a struct's fields itself, without calling Format, in two cases: a bad verb (%p or %w on a value, %s on a field that is a pointer) prints what a pointer points to, and an unexported field of another struct is printed field by field. A function prints as an address under every verb, so no verb, on a Key, a pointer to one, a struct field, a slice element or a map value, can reach the bytes, and a Key copied or compared holds nothing to read.
func Parse ¶
Parse reads a key written as 64 hexadecimal characters. Its error never quotes the input.
func (*Key) Digest ¶
Digest is a keyed digest of b, which confirms nothing to whoever lacks the key.
func (Key) Format ¶
Format keeps key material out of every format verb. fmt calls it before any other way of printing, so the numeric verbs (%d %o %b %c %U %e %t), which expand a struct's fields and a byte slice's elements and would print the derived keys, print the same "privacy key" as %v. It has a value receiver: with a pointer receiver, printing a Key by value (a copy, a struct field, a slice element) would not call it.