delegate

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2026 License: Apache-2.0 Imports: 9 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

func Held(out []Outcome) []string

Held is the keys of outcomes that are not allowed: what an anchoring run holds (bstore anchor -hold-writer).

func Permission

func Permission(site [32]byte) string

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.

Jump to

Keyboard shortcuts

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