Module authors
Expand description
Who wrote a change, as data: an automerge actor id decoded to the handle its process chose, the actors one device writes as, and the author a history names, with the colour presence paints them in.
Three shapes of actor occur in documents: a raw 32-byte public key (the
only cryptographically meaningful one); a self-declared handle
(ActorId::from(app_id.as_bytes()), unverified), read back by
actor_handle; and a random id, which resolves to nobody. Naming
someone in the reader’s words (the toolkit’s AuthorDirectory) is
presentation and stays above; a revert asks for names through
ResolveAuthor.
Structs§
- Device
Actors - The actors a device writes as, to tell its changes apart: its record
writer, and the
device_actorof any handle on it. - History
Attribution - An author that acted for someone: an agent’s change is the agent’s, on behalf of its person, in every history (an app’s, the Files history, and what the history actions return).
- History
Author - Not crypto material — just enough metadata to render a per-author colour dot, display name, and a short identity hash for disambiguation when two authors share a name.
Enums§
- Author
Relation - Who an author is to the person reading the history. Rows draw the reader’s own changes, a collaborator’s and an agent’s differently.
Constants§
- UNKNOWN_
AUTHOR_ NAME - Display name used for an actor with no registered identity and no self-declared handle. Deliberately not a person’s name.
Traits§
- Resolve
Author - Resolves an actor to the author history names: what a revert says when somebody’s later edits held part of it back.
Functions§
- actor_
handle - Decode an actor id back to the handle the authoring process chose for
itself, when it did.
ActorId::from(&[u8])stores the bytes verbatim, soset_actor(ActorId::from(app_id.as_bytes()))leaves the UTF-8 ofapp_idin the hex. ReturnsNonefor anything not a plausible handle (odd-length /non-hex input, non-UTF-8, control chars, empty, or too long); a 32-byte public key almost never survives this filter. - author_
coloured - History row whose colour is already decided (a person’s own colour).
- device_
actor - The actor
handlewrites a document as from the device whose record writer isdevice: the handle, whichactor_handlereads back, and a part only that device has. Automerge numbers each actor’s changes, so one person writing from two devices under the bare handle would make two different changes with the same number, which no replica can merge. - hue_
to_ rgb HSV(h, 0.65, 0.95)→ RGB. Saturation and value held constant so generated author colours stay visually coherent (no neon outliers, no muddy ones).- short_
id - First
SHORT_LENhex characters of an actor id, for the dim monospace label next to the name. Short ids are returned whole. - stable_
hue - Deterministic avatar hue for an actor with no registered colour: FNV-1a
over the actor hex, folded into
[0, 360). Same actor, same hue in every process and on every peer.