Documentation
¶
Overview ¶
Package delegate is the owner's side of a site's delegation through borg (1bsv-ops docs/apps/bweb/design.md section 16.5): a site's owner names delegates as writers of the site's bucket, and its own service applies a delegate's entries only while borg allows the delegate the site's write permission. The decision is made where the owner signs, never by a node or a reader: no record changes, and the signed receipt of each decision is kept beside the publisher's data as the trail from a token back to the delegate it applied.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Held ¶
Held is the keys of outcomes that are not allowed: what an anchoring run holds (bstore anchor -hold-writer).
func Permission ¶
Permission is the borg permission a delegate needs to have its entries in a site's bucket applied: bweb/write/<site id in lower-case hex>.
Types ¶
type Decider ¶
type Decider interface {
Allow(ctx context.Context, subject []byte, permission string) (enforce.Verdict, error)
Forget()
}
Decider is borg's enforce.Enforcer as the owner's service uses it.
type Outcome ¶
type Outcome struct {
Key string // the delegate's identity key, hex
Allow bool
Reason string // why not, when not allowed
Receipt string // the file holding the signed receipt, when one was given
}
Outcome is one delegate's decision.
func Check ¶
func Check(ctx context.Context, d Decider, site [32]byte, delegates []string, dir string, now time.Time) ([]Outcome, error)
Check asks d afresh (Forget first: tokens are rare, so every anchoring rests on a read of the organization made for it) whether each delegate may write site, and keeps each signed receipt under dir. It fails closed: a delegate whose decision cannot be made is not allowed, with the reason. The owner is never a delegate.