Documentation
¶
Overview ¶
Package pointer is how a worker or connector finds its harness from the key its token carries, or the network name a person types. pointer.mainplane.ai maps the key to the harness's current URL, signed by the key, and a name to the key that claimed it. Neither the pointer nor the URL is trusted: the harness at the URL proves the key before any secret goes there, and a name leads only to a device code exchange that a wrong key cannot finish.
PUT pointer.mainplane.ai/<key> {url, seq, sig} sig over "<key> <url> <seq>"
PUT pointer.mainplane.ai/name/<name> {key, seq, sig} sig over "name <name> <key> <seq>"
GET <url>/id?nonce=<n> {url, sig, sig over "id <url> <n>"
noise} noise over "noise <coordinator's Noise key>"
Index ¶
- Variables
- func Claim(ctx context.Context, k ed25519.PrivateKey, name string) error
- func Encode(k ed25519.PrivateKey) string
- func Find(ctx context.Context, key, cached string) (string, error)
- func ID(k ed25519.PrivateKey, url func() string, noise string) http.Handler
- func Key(file string) (ed25519.PrivateKey, error)
- func Named(ctx context.Context, name string) (string, error)
- func Prove(ctx context.Context, key, url string) error
- func ProveNoise(ctx context.Context, key, url, noise string) error
- func Publish(ctx context.Context, k ed25519.PrivateKey, url string) error
Constants ¶
This section is empty.
Variables ¶
var (
ErrTaken = errors.New("network name is taken") // another harness holds it
)
Functions ¶
func Claim ¶ added in v0.5.2
Claim makes name the network name of k's harness, in place of the one it had, which is then free. A name another harness holds is ErrTaken.
func Encode ¶
func Encode(k ed25519.PrivateKey) string
Encode is k's public half as tokens and the pointer carry it.
func Find ¶
Find is where the harness with key is: cached, when it proves the key there, else the URL on the pointer, once it proves the key there.
func ID ¶
ID answers a proof for the harness with k, now reached at url(), whose coordinator has the Noise key noise.
func Key ¶
func Key(file string) (ed25519.PrivateKey, error)
Key is the harness key kept in file, made there the first time. Only its owner may read it: whoever has it can move the harness's workers.
func Named ¶ added in v0.5.2
Named is the key of the harness that holds network name. It is a hint, as the URL is: a device code exchange with a harness that holds another key fails.
func Prove ¶
Prove is nil when the harness at url holds key. It signs a fresh nonce with the URL it knows itself by, which must be url: a host that relays another harness's answer fails.
func ProveNoise ¶ added in v0.3.0
ProveNoise is nil when the harness at url holds key and vouches for noise as its coordinator's Noise key.
Types ¶
This section is empty.