Skip to main content

Module authors

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§

DeviceActors
The actors a device writes as, to tell its changes apart: its record writer, and the device_actor of any handle on it.
HistoryAttribution
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).
HistoryAuthor
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§

AuthorRelation
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§

ResolveAuthor
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, so set_actor(ActorId::from(app_id.as_bytes())) leaves the UTF-8 of app_id in the hex. Returns None for 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 handle writes a document as from the device whose record writer is device: the handle, which actor_handle reads 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_LEN hex 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.