wired:peer
Local identity and per-document authorship and physics authority.
A document's author is the DID owning its write key (fixed). Its
holder is the peer currently driving its physics simulation (defaults to
the author and can be transferred via take-hold and release-hold).
Interface identity
self-did
Returns the local user's DID.
Interface authority
author
Returns the author's DID for document, or none if unauthenticated.
holder
Returns the current holder's DID (the latest peer to call take-hold, or
the author by default). Returns none outside a space.
is-author
Returns whether the local user authored document.
is-holder
Returns whether this peer currently holds document.
take-hold
Claims physics authority for a writable document. The most recent claim takes precedence over earlier ones.
release-hold
Releases this peer's hold, falling back to the next-most-recent holder or the author.
Source
/// Local identity and per-document authorship and physics authority.
///
/// A document's **author** is the DID owning its write key (fixed). Its
/// **holder** is the peer currently driving its physics simulation (defaults to
/// the author and can be transferred via `take-hold` and `release-hold`).
package wired:peer;
interface identity {
use wired:core/ids.{did};
use wired:core/error.{error};
/// Returns the local user's DID.
self-did: func() -> result<did, error>;
}
interface authority {
use wired:core/ids.{did};
use wired:core/error.{error};
use wired:scene/document.{document};
/// Returns the author's DID for `document`, or `none` if unauthenticated.
author: func(document: borrow<document>) -> result<option<did>, error>;
/// Returns the current holder's DID (the latest peer to call `take-hold`, or
/// the author by default). Returns `none` outside a space.
holder: func(document: borrow<document>) -> result<option<did>, error>;
/// Returns whether the local user authored `document`.
is-author: func(document: borrow<document>) -> result<bool, error>;
/// Returns whether this peer currently holds `document`.
is-holder: func(document: borrow<document>) -> result<bool, error>;
/// Claims physics authority for a writable document. The most recent claim
/// takes precedence over earlier ones.
take-hold: func(document: borrow<document>) -> result<_, error>;
/// Releases this peer's hold, falling back to the next-most-recent holder or
/// the author.
release-hold: func(document: borrow<document>) -> result<_, error>;
}