Documentation
¶
Overview ¶
Package knownkeys is bfinger's pin store: the library's grammar and store (package knownkeys of github.com/lightwebinc/bcommon) at bfinger's path and under bfinger's header.
The library takes the header on every Save and has no default path. This package supplies both and keeps the API bfinger's callers were built on, so every store bfinger writes opens with the line it has always opened with.
testdata/known_keys.sample is the cross-repository contract for the file's grammar: docs/known-keys.md names it, and the verification oracle vendors the same bytes and parses them with its own code. It stays here, beside the test that parses it, rather than moving with the grammar.
Index ¶
- Constants
- Variables
- func DefaultPath() string
- func Fingerprint(compressed []byte) string
- func Save(path string, recs []Record) error
- type Kind
- type Record
- func ActiveFor(recs []Record, address string) (Record, bool)
- func Forget(recs []Record, address string, all bool) []Record
- func Load(path string) ([]Record, error)
- func Parse(r io.Reader) ([]Record, error)
- func Pin(recs []Record, address, keyHex string, seq uint64, fp string, now time.Time) ([]Record, error)
- func Retire(recs []Record, address string, now time.Time) []Record
- func Rotate(recs []Record, address, newKeyHex string, seq uint64, fp string, now time.Time) ([]Record, error)
Constants ¶
const ( Active = bcknownkeys.Active RotatedFrom = bcknownkeys.RotatedFrom Retired = bcknownkeys.Retired )
The record forms, the library's values.
const Header = "# bfinger known_keys v1"
Header is the first line of every store bfinger writes, and the first line of the contract sample. TestSaveBytesAreFrozen pins it byte for byte.
Variables ¶
var ErrPermissions = bcknownkeys.ErrPermissions
ErrPermissions is the library's sentinel, the same value, so errors.Is matches either name.
Functions ¶
func Fingerprint ¶
Fingerprint is SHA256: plus unpadded base64 over the 33-byte compressed key.
Types ¶
type Record ¶
type Record = bcknownkeys.Record
Record is one line.
func Pin ¶
func Pin(recs []Record, address, keyHex string, seq uint64, fp string, now time.Time) ([]Record, error)
Pin records a first contact or an advance of an existing pin.