Documentation
¶
Overview ¶
Package peer implements peer identity using did:key with ed25519 keys.
did:key is the simplest DID method: the DID itself encodes the public key, so resolution requires no network and no registry. Sufficient for v0.1 (single binary, no inter-Coggo federation). v0.3+ may add did:web.
Index ¶
- func DecodePublicKey(did string) ([]byte, error)
- func NewDID() (did string, pub, priv []byte, err error)
- func NewPeer(name, description string) (*types.Peer, error)
- type Registry
- func (r *Registry) Add(p *types.Peer) error
- func (r *Registry) ByDID(did string) *types.Peer
- func (r *Registry) ByName(name string) *types.Peer
- func (r *Registry) List() []*types.Peer
- func (r *Registry) Rename(oldName, newName string) error
- func (r *Registry) Resolve(nameOrDID string) (*types.Peer, error)
- func (r *Registry) UpdateSettings(name string, s types.PeerSettings) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecodePublicKey ¶
DecodePublicKey parses a did:key DID back to its 32-byte ed25519 public key.
Types ¶
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry is the in-memory + on-disk index of peers hosted by this binary. Backed by a single peers.json file under the data dir; rewritten atomically.
Per-peer state (events, entities) lives in the Store, not here. The Registry is the directory of identities and their settings only.
func (*Registry) UpdateSettings ¶
func (r *Registry) UpdateSettings(name string, s types.PeerSettings) error
UpdateSettings replaces the settings for a peer (looked up by name).