Documentation
¶
Overview ¶
Package identity is the member key: lt_ plus 48 hex characters (24 bytes). The node stores SHA-256(key); HMAC/HKDF need the plaintext in members.keys.
Index ¶
- func Match(plain, sha string) bool
- func NewKey() (plain, sha string, err error)
- func Short(sha string) string
- func Sum(plain string) string
- type Ring
- func (r *Ring) Delete(id string)
- func (r *Ring) Filter(want map[string]string)
- func (r *Ring) IDFor(token []byte) string
- func (r *Ring) Len() int
- func (r *Ring) Put(id, token string)
- func (r *Ring) Replace(src *Ring)
- func (r *Ring) Save(path string) error
- func (r *Ring) TokenFor(id string) []byte
- func (r *Ring) Tokens() [][]byte
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Ring ¶
type Ring struct {
// contains filtered or unexported fields
}
Ring is the in-memory set of member keys. HMAC and HKDF need the plaintext; network.conf keeps only SHA-256. One id may hold several tokens (the live key plus a reissue waiting for apply).
func Load ¶
Load reads `{dir}/members.keys` (YAML map id → lt_… or a list of them). Missing file is empty.
func (*Ring) Filter ¶
Filter drops ids unknown to network.conf and tokens whose SHA-256 does not match. A reissue keeps the old token on disk until apply; Filter then keeps whichever token matches want.
func (*Ring) Put ¶
Put stores plaintext token for id. A second token for the same id is kept (reissue before apply) so a reload still matches network.conf.
func (*Ring) Save ¶
Save writes id: lt_… YAML with mode 0600, sorted by id. One token stays a scalar so older nodes still read the file; several become a list.