/*! * Copyright (c) 2026 Interop Alliance. All rights reserved. */ /** * The `wallet-activity` wire shape and the pure payload builders for it. * * {@link WalletActivity} is the decrypted body of one `wallet-activity` * document: an ActivityStreams-shaped record (a typed action carrying a * human-readable summary and a creation timestamp). Both wallet replicas read * and write this exact shape, so each reads the other's entries. Every field is * optional because a payload arrives from the storage server and is not * schema-validated on read. * * The builders are pure: each returns the activity payload object only -- no * storage, no port calls. `id` and `created` are injectable (a caller that wants * a specific resource id or timestamp passes them); otherwise `id` defaults to * `crypto.randomUUID()` and `created` to `new Date().toISOString()`. The * `type` strings and `summary` phrasings are byte-significant: two replicas that * build the same activity must produce the same `type` / `summary`, so these are * kept verbatim. */ /** * The decrypted body of one `wallet-activity` document. Reconciles the web * wallet's `WalletActivity` interface and the mobile wallet's * `WalletActivityPayload`, which are the same shape. */ export interface WalletActivity { id?: string; type?: string[]; summary?: string; actor?: unknown; object?: unknown; created?: string; } /** * The activity `type` strings the wallet uses, verbatim on the wire. */ export declare const ACTIVITY_TYPE: { readonly Create: "Create"; readonly Delete: "Delete"; readonly Share: "Share"; readonly Unshare: "Unshare"; readonly Login: "Login"; readonly Revoke: "Revoke"; readonly ClientRevoke: "ClientRevoke"; readonly CollectionShare: "CollectionShare"; readonly CollectionUnshare: "CollectionUnshare"; readonly GenerationCollect: "GenerationCollect"; }; /** * A minimal actor descriptor; the wallet records the user's email. */ type Actor = { email?: string; id?: string; }; /** * The Create activity for a freshly generated bootstrap `did:key` DID. * * @param options {object} * @param options.user {Actor} * @param [options.id] {string} * @param [options.created] {string} * @returns {WalletActivity} */ export declare function addHistoryNewAccount({ user, id, created }: { user: Actor; id?: string; created?: string; }): WalletActivity; /** * The Create activity for the wallet's storage collections (and, when a remote * replica is configured, the remote Space). `object` -- the created Space / * Collection descriptors -- is supplied by the caller (it comes from the app's * storage layer); `remote` selects the summary phrasing. * * @param options {object} * @param options.actor {unknown} recorded as the activity actor * @param options.object {unknown} the created Space / Collection descriptors * @param [options.remote] {boolean} whether a remote Space was created * @param [options.id] {string} * @param [options.created] {string} * @returns {WalletActivity} */ export declare function addHistorySpaceCreated({ actor, object, remote, id, created }: { actor: unknown; object: unknown; remote?: boolean; id?: string; created?: string; }): WalletActivity; /** * The Create activity for a wallet profile (the mobile wallet's per-profile * account unit). Carries no actor or object: a profile is created before any * account identity exists to attribute it to. * * @param options {object} * @param options.profileName {string} the profile's display name * @param [options.id] {string} * @param [options.created] {string} * @returns {WalletActivity} */ export declare function addHistoryProfileCreated({ profileName, id, created }: { profileName: string; id?: string; created?: string; }): WalletActivity; /** * The Create activity for a credential. */ export declare function addHistoryCredentialCreated({ cid, title, user, id, created }: { cid: string; title?: string; user: Actor; id?: string; created?: string; }): WalletActivity; /** * The Delete activity for a credential. */ export declare function addHistoryCredentialDeleted({ cid, title, user, id, created }: { cid: string; title?: string; user: Actor; id?: string; created?: string; }): WalletActivity; /** * The Share activity for a credential (a public link created). */ export declare function addHistoryCredentialShared({ cid, title, user, id, created }: { cid: string; title?: string; user: Actor; id?: string; created?: string; }): WalletActivity; /** * The Unshare activity for a credential (a public link revoked). */ export declare function addHistoryCredentialUnshared({ cid, title, user, id, created }: { cid: string; title?: string; user: Actor; id?: string; created?: string; }): WalletActivity; /** * One capability grant recorded on a Login activity. `zcap` is kept verbatim. */ export interface ActivityGrant { id: string; target: string; allowedActions: string[]; expires: string; zcap?: unknown; } /** * The Login activity: the user logged in to a relying party (or connected an * app) via "Login with Wallet", granting the listed capabilities. The recorded * zcap ids are the hook for a later revocation UI. * * @param options {object} * @param options.user {Actor} * @param options.origin {string} the relying party's origin * @param options.grants {ActivityGrant[]} * @param [options.appConnect] {{ name: string; firstRun: boolean; appUrl?: * string }} set for an App Connect login: the app's display name, whether * the app key was minted on this connect (first run) or matched (returning), * and optionally the connected app's `appUrl` -- the validated App Connect * request's parsed-URL serialization * @param [options.actor] {{ name: string }} set for a standalone capability * request that named its requester: the agent's self-declared display name * (the VPR's `agent.name`), recorded as `object.actor` -- the ActivityStreams * vocabulary for who acted on the granted object -- so a listing can show * the name beside the grantee key. Self-declared, never verified. * @param [options.id] {string} * @param [options.created] {string} * @returns {WalletActivity} */ export declare function addHistoryLogin({ user, origin, grants, appConnect, actor, id, created }: { user: Actor; origin: string; grants: ActivityGrant[]; appConnect?: { name: string; firstRun: boolean; appUrl?: string; }; actor?: { name: string; }; id?: string; created?: string; }): WalletActivity; /** * The Login activity for a local wallet unlock -- the user opened their own * wallet, no relying party involved ({@link addHistoryLogin} covers "Login * with Wallet" grants to an origin). * * @param options {object} * @param [options.user] {Actor} omitted when the wallet has no account email * @param [options.id] {string} * @param [options.created] {string} * @returns {WalletActivity} */ export declare function addHistoryWalletLogin({ user, id, created }?: { user?: Actor; id?: string; created?: string; }): WalletActivity; /** * The ClientRevoke activity: the user disconnected an enrolled wallet client * -- its verification methods and update key left the did:webvh document, the * user key rotated, and the encrypted collections re-epoch'd (the revocation * cascade). * * @param options {object} * @param options.user {Actor} * @param options.signingKeyMultibase {string} the revoked client's signing * key multibase (its document identity) * @param [options.label] {string} a display label for the revoked client, * when one is known * @param [options.rotated] {number} how many encrypted collections took a * fresh epoch * @param [options.failed] {number} how many collections failed to rotate * (the completion sweep's remainder) * @param [options.id] {string} * @param [options.created] {string} * @returns {WalletActivity} */ export declare function addHistoryClientRevoked({ user, signingKeyMultibase, label, rotated, failed, id, created }: { user: Actor; signingKeyMultibase: string; label?: string; rotated?: number; failed?: number; id?: string; created?: string; }): WalletActivity; /** * The GenerationCollect activity: client-annex GC collected one generation -- * the owner-side digest written BEFORE the generation collection is deleted, * and the only record of the collected window's visits that survives the * delete. One row per collected generation. * * The id is the generation id VERBATIM -- a deliberate exception to the * uuidv7 id convention (readers must not assume activity ids are UUIDs): * the deterministic payload id is what lets a torn re-run's second row * collapse at read time under the store's documented dedupe model. * * `firstEntry` / `lastEntry` quote the collected annex log's first and * last entries' `versionTime` strings verbatim (the digest outlives the log * it describes, so it does not launder its source), and `entryCount` is the * log's total entry count, genesis included -- an entry count, deliberately * not a visit count. * * @param options {object} * @param options.user {Actor} * @param options.generationId {string} the collected generation's id (the * `gen-` collection name); doubles as the activity id * @param [options.firstEntry] {string} the log's first entry * `versionTime`, verbatim * @param [options.lastEntry] {string} the log's last entry `versionTime`, * verbatim * @param [options.entryCount] {number} total log entries, genesis included * @param [options.created] {string} * @returns {WalletActivity} */ export declare function addHistoryGenerationCollected({ user, generationId, firstEntry, lastEntry, entryCount, created }: { user: Actor; generationId: string; firstEntry?: string; lastEntry?: string; entryCount?: number; created?: string; }): WalletActivity; /** * The Revoke activity for an agent grant: the user revoked the standalone * storage grants answered from an interaction-URL request (an agent's * `di was request-grant` link), which have no app key and no App Connect * membership. The recorded `controller` is the grantee did:key -- the key the * Applications listing joins its rows on -- and `zcaps` carries the ids of the * capabilities whose revocation was POSTed, the audit trail of what was * retired. `actor` mirrors the Login activity's self-declared agent name when * one was recorded; it is display-only and never evidence of identity. * * @param options {object} * @param options.user {Actor} * @param options.origin {string} the recorded origin marker the grant was * answered under * @param options.controller {string} the grantee did:key * @param [options.zcaps] {Array<{ id: string }>} the revoked capability ids * @param [options.actor] {{ name: string }} the agent's self-declared name * @param [options.revoked] {number} how many grants were revoked * @param [options.skipped] {number} how many grants needed no revocation * (already expired, already revoked, or summary-only records) * @param [options.id] {string} * @param [options.created] {string} * @returns {WalletActivity} */ export declare function addHistoryAgentRevoke({ user, origin, controller, zcaps, actor, revoked, skipped, id, created }: { user: Actor; origin: string; controller: string; zcaps?: Array<{ id: string; }>; actor?: { name: string; }; revoked?: number; skipped?: number; id?: string; created?: string; }): WalletActivity; /** * The Revoke activity: the user revoked a connected app's access, retiring its * app-key credential and its storage grants. * * @param options {object} * @param options.user {Actor} * @param options.origin {string} the connected app's origin * @param options.name {string} the connected app's display name * @param [options.cid] {string} the retired app-key credential's cid * @param [options.revoked] {number} how many storage grants were revoked * @param [options.skipped] {number} how many grants needed no revocation * @param [options.id] {string} * @param [options.created] {string} * @returns {WalletActivity} */ export declare function addHistoryAppRevoke({ user, origin, name, cid, revoked, skipped, id, created }: { user: Actor; origin: string; name: string; cid?: string; revoked?: number; skipped?: number; id?: string; created?: string; }): WalletActivity; /** * The CollectionShare activity: the user shared one encrypted collection with * a grantee -- the grantee's key-agreement key escrowed into the collection's * epochs and a read-only zcap delegated on the collection URL. The full * delegated `zcap` document is recorded verbatim, since it is the revocation * hook the unshare reads back. * * @param options {object} * @param options.user {Actor} * @param options.collectionId {string} * @param options.recipientId {string} the escrowed recipient's key id * @param options.controller {string} the grantee DID the zcap is delegated to * @param options.zcap {unknown} the delegated zcap document, verbatim * @param options.expires {string} the delegation's expiry, ISO 8601 * @param [options.app] {{ name: string; origin: string }} the connected app * the share was made for, when one was * @param [options.id] {string} * @param [options.created] {string} * @returns {WalletActivity} */ export declare function addHistoryCollectionShared({ user, collectionId, recipientId, controller, zcap, expires, app, id, created }: { user: Actor; collectionId: string; recipientId: string; controller: string; zcap: unknown; expires: string; app?: { name: string; origin: string; }; id?: string; created?: string; }): WalletActivity; /** * The CollectionUnshare activity: the user stopped sharing one encrypted * collection with a recipient -- the recipient struck from the collection's * epochs and its recorded share zcaps revoked. * * @param options {object} * @param options.user {Actor} * @param options.collectionId {string} * @param options.recipientId {string} the removed recipient's key id * @param [options.id] {string} * @param [options.created] {string} * @returns {WalletActivity} */ export declare function addHistoryCollectionUnshared({ user, collectionId, recipientId, id, created }: { user: Actor; collectionId: string; recipientId: string; id?: string; created?: string; }): WalletActivity; export {}; //# sourceMappingURL=activity.d.ts.map