techne-sdk 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md ADDED
@@ -0,0 +1,54 @@
1
+ # Changelog
2
+
3
+ `techne-sdk` on npm and the `techne-sdk` crate share a version. Each entry names what changes for an app or
4
+ a crate user.
5
+
6
+ ## 0.2.0
7
+
8
+ ### Changed: the verifier trusts operator-issued credentials (option (b))
9
+
10
+ `verify` (Rust `techne_sdk::verify`, `techne-sdk/wasm` in TypeScript) now trusts what the platform trusts
11
+ (regenOS `ee38bb7d7`, `provenancePolicy#vouchedWriter` at lexicons `v0.1.22-techne.45`):
12
+
13
+ - **Operator-issued credentials.** A credential counts when its issuer is the commons root, or an operator
14
+ named by one of the root's intact `pub.techne.draft.operator` records for a period that holds at the
15
+ credential's first-seen time (`validFrom` inclusive, `validUntil` exclusive, an absent `validUntil` is
16
+ open). With no first-seen time, only an open period holds. 0.1.0 trusted root-issued credentials only.
17
+ - **Root same-rkey revocation.** A credential is revoked by a record at its own revocation address, as
18
+ before, or at the same rkey in the root's repo.
19
+ - Both apply to `decide`'s `vouchedWriter` verdicts and to `chainVerified`.
20
+
21
+ **Breaking (Rust):** `verify::Record` gains `pub first_seen: Option<String>` (`firstSeen` in JSON,
22
+ absent by default). Code that builds a `Record` with a struct literal no longer compiles until it adds the
23
+ field, e.g. `first_seen: None`. That is why this release is 0.2.0: a `techne-sdk = "0.1"` requirement does
24
+ not pick it up; move to `"0.2"` and add the field. JSON input without `firstSeen` still parses. In TypeScript `ReadRecord` gains an
25
+ optional `firstSeen`, so nothing breaks there.
26
+
27
+ ### Added: `techne-sdk/auth`
28
+
29
+ Browser OAuth sign-in ("Sign in with Techne"): `signIn`, `signUp`, `restore`, `signOut`,
30
+ `onSessionDeleted`, `clientMetadata`, `scopes`, `includeScope`, `resolveClientId`,
31
+ `setOAuthClientFactory`, `redirectState` (the `state` a sign-in sent, after its redirect), and the
32
+ constants `TECHNE_PLATFORM_DID`, `TECHNE_TOWN`, `TECHNE_TOWN_PDS`. `clientMetadata` answers
33
+ `@atproto/oauth-types`' `OAuthClientMetadataInput`. The React half (`techne-sdk/auth/react`:
34
+ `TechneProvider`, `SignInWithTechne`) is not included yet.
35
+
36
+ New dependencies for every install, whether or not an app imports `techne-sdk/auth`:
37
+ `@atproto/oauth-client-browser` (loaded only on first use, so it stays out of bundles that do not sign
38
+ in) and `@atproto/oauth-types`. Some of what they pull in declares Node >= 22, as this repo already
39
+ requires; npm warns (or fails under `engine-strict`) on older Node.
40
+
41
+ ### Changed: inputs
42
+
43
+ - Lexicons pinned at `v0.1.22-techne.45` (check `techne-lexicon-check` 0.3.0) and the platform's published
44
+ API at regenOS `ee38bb7d7`. Types and clients are regenerated from them.
45
+
46
+ ### Docs
47
+
48
+ - The techne.town defaults go live at the Techne release. Until then, pass `pds` (and `plcUrl`,
49
+ `handleDomain`, `platform`) explicitly; ask the Techne team for the current staging values. Neither the
50
+ package nor the crate names a staging host.
51
+
52
+ ## 0.1.0
53
+
54
+ First release, on npm and crates.io.
package/README.md CHANGED
@@ -25,6 +25,7 @@ Every import goes through the package's `exports`, so the resolver has to read t
25
25
  | `techne-sdk/types/<nsid path>` | one lexicon's types, e.g. `techne-sdk/types/social/scenius/getContactInvite` |
26
26
  | `techne-sdk/react` | `useEvent(uri)`: one commons event or place as its versions, with the check's verdict |
27
27
  | `techne-sdk/versions` | the same state without React: `eventState`, `verifyAnswer`, version labels |
28
+ | `techne-sdk/auth` | sign-in ("Sign in with Techne"): `signIn`, `signUp`, `restore`, `signOut`, `clientMetadata`, `scopes` (browser OAuth) |
28
29
  | `techne-sdk/connect` | `connect(session, platform)` / `connectHosted(did, fetchHandler)`: the clients over one session |
29
30
  | `techne-sdk/put` | `put(techne, records, { deletes })`: the one write, deletes included |
30
31
  | `techne-sdk/query` | the platform's generic queries: `listRecords`, `getRecords`, hosts |
@@ -54,6 +55,35 @@ function Event({ uri }: { uri: string }) {
54
55
 
55
56
  Pass `{ claims }` too, and `verification` holds the check's answer for every record (valid, signer, chain verified).
56
57
 
58
+ ## Sign in with Techne
59
+
60
+ `techne-sdk/auth` signs a person in from the browser. Each app is its own atproto OAuth client, the way "Sign in with Google" works: the app serves its client metadata at its client id, the person signs in at their own PDS, and the app keeps the session (an `OAuthSession`, with `did` and `fetchHandler`) that `connect` takes. It runs on `@atproto/oauth-client-browser`, loaded the first time it is used.
61
+
62
+ ```ts
63
+ import { clientMetadata, restore, signIn, TECHNE_PLATFORM_DID } from 'techne-sdk/auth'
64
+ import { connect } from 'techne-sdk/connect'
65
+
66
+ const clientId = 'https://cafes.example/oauth-client-metadata.json'
67
+
68
+ // Serve this JSON at clientId (a static file or a route).
69
+ const metadata = clientMetadata({ clientId, clientName: 'Cafe finder' })
70
+
71
+ // On every page load: finishes a sign-in when the page is the redirect back, else restores a kept session.
72
+ const session = await restore({ clientId })
73
+ if (!session) await signIn({ clientId, handle: 'alice' }) // alice.techne.town, once techne.town is live (see below)
74
+ else {
75
+ const techne = connect(session, TECHNE_PLATFORM_DID)
76
+ }
77
+ ```
78
+
79
+ - **Who:** with no `handle`, the sign-in starts at the default PDS (techne.town), which asks who you are. A bare name (`alice`) is a handle on the default handle domain. A full handle, a DID or a PDS URL from any PDS is used as given. `signUp({ clientId })` opens the PDS's create-account screen.
80
+ - **Scopes:** `scopes()` is what it asks for by default: `atproto`, the platform's `authRead` and `authWrite` permission sets with the platform as their audience, and a `repo:` scope for the public `community.lexicon.*` records. `clientMetadata` lists the same scopes, so the two always match. Pass `scope` to ask for other scopes, and pass it to both.
81
+ - **Development:** on `localhost` or `127.0.0.1` you can leave `clientId` out. The SDK then uses atproto's loopback client, so you don't need to host anything.
82
+ - **Sessions:** the library refreshes tokens itself. `restore` returns the session, `null` when nobody is signed in, and rejects when a sign-in or refresh failed. `signOut({ clientId, session })` revokes the session. `onSessionDeleted` tells you when the library drops a session. A `state` passed to `signIn` comes back from `redirectState({ clientId })` on the page the redirect lands on.
83
+ - **Another deployment:** `platform` names the platform's DID (`TECHNE_PLATFORM_DID` by default). `pds`, `plcUrl` and `handleDomain` name the PDS people sign in at, its PLC directory and its handle domain. Pass them the same way to every call.
84
+
85
+ **Before the Techne release:** the techne.town defaults (`TECHNE_PLATFORM_DID`, the techne.town PDS and handle domain) go live at the Techne release. Until then, `signIn()` without `pds` fails: pass `pds`, `plcUrl`, `handleDomain` and `platform` explicitly, and ask the Techne team for the current staging values.
86
+
57
87
  ## Layout
58
88
 
59
89
  | Path | What |
@@ -0,0 +1,151 @@
1
+ /**
2
+ * techne-sdk/auth — sign-in for an app on Techne ("Sign in with Techne"). Each app is its own atproto OAuth client, the
3
+ * "Sign in with Google" shape: it serves its own client metadata ({@link clientMetadata}) at its client id,
4
+ * the person signs in at their own PDS, and the app holds the session (an OAuthSession: `did` and
5
+ * `fetchHandler`) that `connect` takes. Browser only, over `@atproto/oauth-client-browser`.
6
+ *
7
+ * ```ts
8
+ * const clientId = 'https://cafes.example/oauth-client-metadata.json'
9
+ * const session = await restore({ clientId }) // after the redirect back, or a later visit
10
+ * if (!session) await signIn({ clientId, handle: 'alice' }) // redirects; alice.techne.town
11
+ * const techne = connect(session, TECHNE_PLATFORM_DID)
12
+ * ```
13
+ *
14
+ * What it asks for ({@link scopes}): `atproto`, the platform's two permission sets with the platform's
15
+ * appview as their audience (`include:…authRead?aud=<platform>%23atproto_appview`, and authWrite), and a
16
+ * `repo:` scope for the public homes outside our namespace (`community.lexicon.*`, which a pub.techne set
17
+ * may not name), read from the placement manifest (`placement.gen.ts`). The platform is
18
+ * {@link TECHNE_PLATFORM_DID} unless a `platform` option names another (a test deployment's did:plc).
19
+ *
20
+ * Where it starts: no handle starts at the techne.town PDS ({@link TECHNE_TOWN_PDS}), which asks who you
21
+ * are; a bare name (`alice`) is a techne.town handle (`alice.techne.town`); a full handle, a DID or a PDS
22
+ * URL from any PDS goes as given. `signUp` goes to the techne.town PDS with `prompt: 'create'`, its
23
+ * create-account screen. An app whose people live on another PDS (a test deployment's) names it with the `pds`
24
+ * option, and its PLC directory with `plcUrl`: handles then resolve at that PDS, a sign-in with no
25
+ * handle and every sign-up start there, a bare name takes `handleDomain`, and DIDs resolve at that PLC.
26
+ *
27
+ * On localhost (or 127.0.0.1), or with no client id, the client is atproto's loopback client
28
+ * (`http://localhost?redirect_uri=http://127.0.0.1:<port>/&scope=…`), so an app runs in development with
29
+ * nothing hosted. A page elsewhere with no client id cannot sign in.
30
+ *
31
+ * Restore and refresh. {@link restore} is the library's `init()`: it finishes a sign-in when the page is
32
+ * the redirect back, else restores the session kept in IndexedDB. It does not force a refresh: the
33
+ * library refreshes the tokens when they are about to expire, and again on every request whose token has
34
+ * expired (the session's `fetchHandler` does it), so a restored session is used as it is. It answers the
35
+ * session, `null` when nobody is signed in, and rejects when the sign-in failed (the person said no) or the
36
+ * kept session could not be refreshed (the library has then deleted it); what signed out looks like is the
37
+ * caller's (the React provider shows the anonymous client). One `init()` runs per client however many ask
38
+ * (the redirect's code can be used once), until {@link signOut}. A session the library deletes later (its
39
+ * refresh token revoked) is announced to {@link onSessionDeleted} listeners. The `state` a {@link signIn}
40
+ * sent comes back from {@link redirectState} on the page the redirect lands on (the same `init()`).
41
+ *
42
+ * One BrowserOAuthClient per client id, made on first use. Tests (and other runtimes) inject their own
43
+ * with {@link setOAuthClientFactory}.
44
+ */
45
+ import type { AuthorizeOptions, OAuthSession } from '@atproto/oauth-client-browser';
46
+ import { type OAuthClientMetadataInput } from '@atproto/oauth-types';
47
+ import { TECHNE_PLATFORM_DID } from '../platform.js';
48
+ export { TECHNE_PLATFORM_DID };
49
+ export type { OAuthSession };
50
+ /** The techne.town handle domain: a bare name signs in as `<name>.techne.town`. */
51
+ export declare const TECHNE_TOWN = "techne.town";
52
+ /** The techne.town PDS: where a sign-in with no handle, and every sign-up, starts. */
53
+ export declare const TECHNE_TOWN_PDS = "https://pds.techne.town";
54
+ /** The OAuth client the module drives: what it uses of BrowserOAuthClient. */
55
+ export interface OAuthClientLike {
56
+ init(refresh?: boolean): Promise<{
57
+ session: OAuthSession;
58
+ state?: string | null;
59
+ } | undefined>;
60
+ signInRedirect(input: string, options?: AuthorizeOptions): Promise<unknown>;
61
+ revoke(sub: string): Promise<void>;
62
+ }
63
+ /** What a factory is given to make a client. */
64
+ export interface ClientConfig {
65
+ /** The client id: the app's https metadata URL, or a loopback id. */
66
+ clientId: string;
67
+ /** Where handles are resolved: the home PDS (`pds`, techne.town by default), which answers `resolveHandle`. */
68
+ handleResolver: string;
69
+ /** The PLC directory a did:plc resolves at; the library's (plc.directory) when absent. */
70
+ plcDirectoryUrl?: string;
71
+ /** Call when the library deletes a session (a failed refresh, a revocation). */
72
+ onSessionDeleted: (sub: string, cause: unknown) => void;
73
+ }
74
+ export type OAuthClientFactory = (config: ClientConfig) => OAuthClientLike | Promise<OAuthClientLike>;
75
+ /** Make every client with `make` instead of BrowserOAuthClient (tests, other runtimes); `undefined` goes
76
+ * back to the default. Forgets every client made so far. */
77
+ export declare function setOAuthClientFactory(make: OAuthClientFactory | undefined): void;
78
+ /** What every call takes to name its client. */
79
+ export interface ClientOptions {
80
+ /** The app's client id: the https URL of the metadata it serves (conventionally ending
81
+ * `/oauth-client-metadata.json`). Omitted, or on a loopback page, the loopback client. */
82
+ clientId?: string;
83
+ /** The platform's service DID: the audience of the scopes. {@link TECHNE_PLATFORM_DID} by default. */
84
+ platform?: string;
85
+ /** The scopes to ask for; {@link scopes} by default. */
86
+ scope?: string | readonly string[];
87
+ /** The page's location; `globalThis.location` by default. */
88
+ location?: Pick<Location, 'protocol' | 'hostname' | 'port'>;
89
+ /** The home PDS: where handles resolve, and where a sign-in with no handle and every sign-up start.
90
+ * {@link TECHNE_TOWN_PDS} by default. Read when the client id's client is first made. */
91
+ pds?: string;
92
+ /** The PLC directory a did:plc resolves at (a test deployment may run its own); plc.directory by default. Read when
93
+ * the client id's client is first made. */
94
+ plcUrl?: string;
95
+ /** The handle domain a bare name signs in under; {@link TECHNE_TOWN} by default. */
96
+ handleDomain?: string;
97
+ }
98
+ /** The `include:` scope for the permission set `nsid` with `platform`'s appview as its audience:
99
+ * `include:<nsid>?aud=<platform>%23atproto_appview`. {@link TECHNE_PLATFORM_DID} by default; another
100
+ * platform (a local stack, a test deployment) passes its own DID. */
101
+ export declare function includeScope(nsid: string, platform?: string): string;
102
+ /** The scopes signIn asks for by default (see the module doc). */
103
+ export declare function scopes({ platform }?: {
104
+ platform?: string;
105
+ }): string[];
106
+ /** What {@link clientMetadata} takes. */
107
+ export interface ClientMetadataOptions {
108
+ /** The https URL the document is served at. */
109
+ clientId: string;
110
+ /** Where the sign-in comes back to; `[<origin of clientId>/]` by default. */
111
+ redirectUris?: [string, ...string[]];
112
+ clientName?: string;
113
+ clientUri?: string;
114
+ logoUri?: string;
115
+ /** The scopes, as {@link ClientOptions.scope}. */
116
+ scope?: string | readonly string[];
117
+ platform?: string;
118
+ }
119
+ /** The client-metadata document an app serves at its client id: a public browser client (no secret,
120
+ * DPoP-bound tokens), asking for {@link scopes} by default. */
121
+ export declare function clientMetadata(o: ClientMetadataOptions): OAuthClientMetadataInput;
122
+ /** The client id a call signs in as: the loopback client on a loopback page or with no client id, else
123
+ * `clientId`. */
124
+ export declare function resolveClientId(o: ClientOptions): string;
125
+ /** Listen for the library deleting a session of this client (a refresh that failed, a revocation
126
+ * elsewhere). Answers the unsubscribe. */
127
+ export declare function onSessionDeleted(o: ClientOptions, listener: (sub: string, cause: unknown) => void): () => void;
128
+ /** What {@link signIn} takes. */
129
+ export interface SignInOptions extends ClientOptions {
130
+ /** Who: a bare name (under `handleDomain`), a full handle, a DID or a PDS URL. None starts at the home PDS.
131
+ * With `signUp` only an https PDS URL is used (the PDS to create the account at); any other handle is
132
+ * ignored and the sign-up starts at the home PDS, which asks for the new handle itself. */
133
+ handle?: string;
134
+ /** Create an account at the home PDS (`prompt: 'create'`). */
135
+ signUp?: boolean;
136
+ /** Handed back by the redirect: {@link redirectState} answers it there. */
137
+ state?: string;
138
+ }
139
+ /** Sign in: redirects to the person's PDS, and comes back to the app's redirect URI (then {@link restore}). */
140
+ export declare function signIn(o?: SignInOptions): Promise<void>;
141
+ /** {@link signIn} with `signUp: true`. */
142
+ export declare function signUp(o?: Omit<SignInOptions, 'signUp'>): Promise<void>;
143
+ /** The signed-in session, or `null` (see the module doc for the redirect, refresh and errors). */
144
+ export declare function restore(o?: ClientOptions): Promise<OAuthSession | null>;
145
+ /** The `state` the {@link signIn} that led here sent, on the page its redirect lands on; `null` when the
146
+ * page is not that redirect (a session restored from storage, or nobody signed in). */
147
+ export declare function redirectState(o?: ClientOptions): Promise<string | null>;
148
+ /** Sign out: revokes `session` at its PDS and forgets it here. */
149
+ export declare function signOut(o: ClientOptions & {
150
+ session: Pick<OAuthSession, 'did'>;
151
+ }): Promise<void>;
@@ -0,0 +1,167 @@
1
+ import { buildAtprotoLoopbackClientId, isLoopbackHost } from '@atproto/oauth-types';
2
+ import { NSID } from '../generated/nsid.js';
3
+ import { appviewRef, TECHNE_PLATFORM_DID } from '../platform.js';
4
+ import { PUBLIC_HOMES } from './placement.gen.js';
5
+ export { TECHNE_PLATFORM_DID };
6
+ /** The techne.town handle domain: a bare name signs in as `<name>.techne.town`. */
7
+ export const TECHNE_TOWN = 'techne.town';
8
+ /** The techne.town PDS: where a sign-in with no handle, and every sign-up, starts. */
9
+ export const TECHNE_TOWN_PDS = 'https://pds.techne.town';
10
+ /** The default: a BrowserOAuthClient, loaded on first use (so the module imports under node). For an https
11
+ * client id the library fetches the metadata the app serves; for a loopback id it builds it. */
12
+ const browserFactory = async (config) => {
13
+ const { BrowserOAuthClient } = await import('@atproto/oauth-client-browser');
14
+ return BrowserOAuthClient.load(config);
15
+ };
16
+ let factory = browserFactory;
17
+ const clients = new Map();
18
+ const restoring = new Map();
19
+ const deletedListeners = new Map();
20
+ /** Make every client with `make` instead of BrowserOAuthClient (tests, other runtimes); `undefined` goes
21
+ * back to the default. Forgets every client made so far. */
22
+ export function setOAuthClientFactory(make) {
23
+ factory = make ?? browserFactory;
24
+ clients.clear();
25
+ restoring.clear();
26
+ }
27
+ /** The `include:` scope for the permission set `nsid` with `platform`'s appview as its audience:
28
+ * `include:<nsid>?aud=<platform>%23atproto_appview`. {@link TECHNE_PLATFORM_DID} by default; another
29
+ * platform (a local stack, a test deployment) passes its own DID. */
30
+ export function includeScope(nsid, platform = TECHNE_PLATFORM_DID) {
31
+ return `include:${nsid}?aud=${appviewRef(platform).replace('#', '%23')}`;
32
+ }
33
+ /** The scopes signIn asks for by default (see the module doc). */
34
+ export function scopes({ platform = TECHNE_PLATFORM_DID } = {}) {
35
+ const community = PUBLIC_HOMES.filter((c) => c.startsWith(`${NSID.COMMUNITY_AUTHORITY}.`));
36
+ return ['atproto', includeScope(NSID.AUTH_READ, platform), includeScope(NSID.AUTH_WRITE, platform), ...(community.length ? [repoScope(community)] : [])];
37
+ }
38
+ /** A `repo` scope for `collections`, every action (Rust `nsid_rewrite::repo_scope`). */
39
+ function repoScope(collections) {
40
+ const actions = 'action=create&action=update&action=delete';
41
+ return collections.length === 1 ? `repo:${collections[0]}?${actions}` : `repo?${collections.map((c) => `collection=${c}`).join('&')}&${actions}`;
42
+ }
43
+ const scopeString = (o) => typeof o.scope === 'string' ? o.scope : (o.scope ?? scopes({ platform: o.platform })).join(' ');
44
+ /** The client-metadata document an app serves at its client id: a public browser client (no secret,
45
+ * DPoP-bound tokens), asking for {@link scopes} by default. */
46
+ export function clientMetadata(o) {
47
+ const url = new URL(o.clientId);
48
+ if (url.protocol !== 'https:')
49
+ throw new TypeError(`techne-sdk/auth: a client id is an https URL (got ${o.clientId}); in development leave it out for the loopback client`);
50
+ return {
51
+ client_id: o.clientId,
52
+ ...(o.clientName !== undefined && { client_name: o.clientName }),
53
+ ...(o.clientUri !== undefined && { client_uri: o.clientUri }),
54
+ ...(o.logoUri !== undefined && { logo_uri: o.logoUri }),
55
+ application_type: 'web',
56
+ token_endpoint_auth_method: 'none',
57
+ dpop_bound_access_tokens: true,
58
+ grant_types: ['authorization_code', 'refresh_token'],
59
+ response_types: ['code'],
60
+ scope: scopeString(o),
61
+ redirect_uris: o.redirectUris ?? [`${url.origin}/`],
62
+ };
63
+ }
64
+ /** The client id a call signs in as: the loopback client on a loopback page or with no client id, else
65
+ * `clientId`. */
66
+ export function resolveClientId(o) {
67
+ const location = o.location ?? globalThis.location;
68
+ if (location && isLoopbackHost(location.hostname)) {
69
+ const host = location.hostname === 'localhost' ? '127.0.0.1' : location.hostname;
70
+ const redirect = `http://${host}${location.port ? `:${location.port}` : ''}/`;
71
+ return buildAtprotoLoopbackClientId({ scope: scopeString(o), redirect_uris: [redirect] });
72
+ }
73
+ if (!o.clientId)
74
+ throw new Error('techne-sdk/auth: no clientId (the https URL of the client metadata the app serves); only a localhost page may leave it out');
75
+ return o.clientId;
76
+ }
77
+ const homePds = (o) => o.pds ?? TECHNE_TOWN_PDS;
78
+ /** The OAuth client for these options: one per client id (made with the first call's `pds` and `plcUrl`;
79
+ * a later call naming others for the same client id gets that client). */
80
+ async function oauthClient(o) {
81
+ const clientId = resolveClientId(o);
82
+ let client = clients.get(clientId);
83
+ if (!client) {
84
+ const onSessionDeleted = (sub, cause) => {
85
+ restoring.delete(clientId);
86
+ for (const fn of deletedListeners.get(clientId) ?? [])
87
+ fn(sub, cause);
88
+ };
89
+ const config = { clientId, handleResolver: homePds(o), onSessionDeleted, ...(o.plcUrl && { plcDirectoryUrl: o.plcUrl }) };
90
+ client = Promise.resolve(factory(config));
91
+ client.catch(() => clients.delete(clientId));
92
+ clients.set(clientId, client);
93
+ }
94
+ return client;
95
+ }
96
+ /** Listen for the library deleting a session of this client (a refresh that failed, a revocation
97
+ * elsewhere). Answers the unsubscribe. */
98
+ export function onSessionDeleted(o, listener) {
99
+ const clientId = resolveClientId(o);
100
+ const set = deletedListeners.get(clientId) ?? new Set();
101
+ deletedListeners.set(clientId, set);
102
+ set.add(listener);
103
+ return () => {
104
+ set.delete(listener);
105
+ if (!set.size && deletedListeners.get(clientId) === set)
106
+ deletedListeners.delete(clientId);
107
+ };
108
+ }
109
+ /** Where a sign-in for `handle` starts: see the module doc. */
110
+ function signInTarget(handle, o = {}) {
111
+ const h = handle?.trim().replace(/^@/, '');
112
+ if (!h)
113
+ return homePds(o);
114
+ if (h.startsWith('did:') || /^https?:\/\//.test(h) || h.includes('.'))
115
+ return h;
116
+ return `${h}.${o.handleDomain ?? TECHNE_TOWN}`;
117
+ }
118
+ /** Sign in: redirects to the person's PDS, and comes back to the app's redirect URI (then {@link restore}). */
119
+ export async function signIn(o = {}) {
120
+ const client = await oauthClient(o);
121
+ // A sign-up is at the home PDS unless the app names another PDS by its URL.
122
+ const input = o.signUp ? (o.handle && /^https:\/\//.test(o.handle) ? o.handle : homePds(o)) : signInTarget(o.handle, o);
123
+ const options = { scope: scopeString(o) };
124
+ if (o.signUp)
125
+ options.prompt = 'create';
126
+ if (o.state !== undefined)
127
+ options.state = o.state;
128
+ await client.signInRedirect(input, options);
129
+ }
130
+ /** {@link signIn} with `signUp: true`. */
131
+ export function signUp(o = {}) {
132
+ return signIn({ ...o, signUp: true });
133
+ }
134
+ /** The one `init()` per client id that {@link restore} and {@link redirectState} share. */
135
+ function restored(o) {
136
+ let clientId;
137
+ try {
138
+ clientId = resolveClientId(o);
139
+ }
140
+ catch (e) {
141
+ return Promise.reject(e);
142
+ }
143
+ let pending = restoring.get(clientId);
144
+ if (!pending) {
145
+ pending = oauthClient(o)
146
+ .then((c) => c.init())
147
+ .then((r) => (r ? { session: r.session, state: r.state ?? null } : null));
148
+ pending.catch(() => restoring.delete(clientId));
149
+ restoring.set(clientId, pending);
150
+ }
151
+ return pending;
152
+ }
153
+ /** The signed-in session, or `null` (see the module doc for the redirect, refresh and errors). */
154
+ export function restore(o = {}) {
155
+ return restored(o).then((r) => r?.session ?? null);
156
+ }
157
+ /** The `state` the {@link signIn} that led here sent, on the page its redirect lands on; `null` when the
158
+ * page is not that redirect (a session restored from storage, or nobody signed in). */
159
+ export function redirectState(o = {}) {
160
+ return restored(o).then((r) => r?.state ?? null);
161
+ }
162
+ /** Sign out: revokes `session` at its PDS and forgets it here. */
163
+ export async function signOut(o) {
164
+ const client = await oauthClient(o);
165
+ restoring.delete(resolveClientId(o));
166
+ await client.revoke(o.session.did);
167
+ }
@@ -0,0 +1 @@
1
+ export declare const PUBLIC_HOMES: readonly ["pub.techne.draft.appConfig", "pub.techne.draft.approval", "pub.techne.draft.connection", "pub.techne.draft.contactChannel", "pub.techne.draft.channelVerification", "pub.techne.draft.containedIn", "pub.techne.draft.derivation", "pub.techne.draft.distinctFrom", "pub.techne.draft.geo", "pub.techne.draft.heldAt", "pub.techne.draft.operator", "pub.techne.draft.org", "pub.techne.draft.profile", "pub.techne.draft.assessment", "pub.techne.draft.provenance", "pub.techne.draft.questionSet", "pub.techne.draft.receipt", "pub.techne.draft.verdict", "pub.techne.draft.verification", "pub.techne.draft.retirement", "pub.techne.draft.credential", "pub.techne.draft.credentialRevocation", "pub.techne.draft.publisher", "pub.techne.draft.sameAs", "pub.techne.draft.source", "pub.techne.draft.sourceAttribution", "pub.techne.draft.sourceRef", "pub.techne.draft.evaluation", "pub.techne.draft.event.config", "pub.techne.draft.event.listing", "pub.techne.draft.feed.recipe", "pub.techne.draft.query", "pub.techne.draft.invite", "pub.techne.draft.market.ask", "pub.techne.draft.market.offer", "pub.techne.draft.membership", "pub.techne.draft.place", "pub.techne.draft.presence", "pub.techne.draft.actor.profile", "pub.techne.draft.collective", "community.lexicon.calendar.event", "community.lexicon.calendar.rsvp"];
@@ -0,0 +1,49 @@
1
+ // @generated by scripts/gen-placement.mjs from the placement manifest. DO NOT EDIT BY HAND.
2
+ // The record collections whose legal homes include the public firehose (the placement manifest's
3
+ // `public` list), in the manifest's order. Regenerate: npm run codegen:placement.
4
+ /* eslint-disable */
5
+ import { NSID } from '../generated/nsid.js';
6
+ export const PUBLIC_HOMES = [
7
+ NSID.APP_CONFIG,
8
+ NSID.APPROVAL,
9
+ NSID.CONNECTION,
10
+ NSID.CONTACT_CHANNEL,
11
+ NSID.CHANNEL_VERIFICATION,
12
+ NSID.CONTAINED_IN,
13
+ NSID.DERIVATION,
14
+ NSID.DISTINCT_FROM,
15
+ NSID.GEO,
16
+ NSID.HELD_AT,
17
+ NSID.OPERATOR,
18
+ NSID.ORG,
19
+ NSID.PROFILE,
20
+ NSID.ASSESSMENT,
21
+ NSID.PROVENANCE,
22
+ NSID.QUESTION_SET,
23
+ NSID.RECEIPT,
24
+ NSID.VERDICT,
25
+ NSID.VERIFICATION,
26
+ NSID.RETIREMENT,
27
+ NSID.CREDENTIAL,
28
+ NSID.CREDENTIAL_REVOCATION,
29
+ NSID.PUBLISHER,
30
+ NSID.SAME_AS,
31
+ NSID.SOURCE,
32
+ NSID.SOURCE_ATTRIBUTION,
33
+ NSID.SOURCE_REF,
34
+ NSID.EVALUATION,
35
+ NSID.EVENT_CONFIG,
36
+ NSID.EVENT_LISTING,
37
+ NSID.FEED_RECIPE,
38
+ NSID.QUERY,
39
+ NSID.INVITE,
40
+ NSID.MARKET_ASK,
41
+ NSID.MARKET_OFFER,
42
+ NSID.MEMBERSHIP,
43
+ NSID.PLACE,
44
+ NSID.PRESENCE,
45
+ NSID.ACTOR_PROFILE,
46
+ NSID.COLLECTIVE,
47
+ NSID.CALENDAR_EVENT,
48
+ NSID.CALENDAR_RSVP,
49
+ ];
@@ -3813,13 +3813,13 @@ export const catalog = {
3813
3813
  "name": "revocation",
3814
3814
  "type": "string<at-uri>",
3815
3815
  "required": true,
3816
- "description": "Where the issuer publishes a pub.techne.draft.credentialRevocation if it withdraws this credential (and every re-issue at the same binding id). Absent there = not revoked."
3816
+ "description": "Where the issuer publishes a pub.techne.draft.credentialRevocation if it withdraws this credential (and every re-issue at the same binding id). Absent there = not revoked by the issuer. The commons root can also revoke a commons credential an operator issued, with its own credentialRevocation at the same rkey in the root's repo; a reader counts either."
3817
3817
  },
3818
3818
  {
3819
3819
  "name": "signature",
3820
3820
  "type": "→ #signature",
3821
3821
  "required": false,
3822
- "description": "Present exactly when the credential is stored by its subject; absent only when the commons root publishes it in its own repo (the commit is the proof)."
3822
+ "description": "Present exactly when the credential is stored by its subject; absent only for a commons credential, which its issuer (the commons root, or an operator the root names) publishes in its own repo (the commit is the proof)."
3823
3823
  },
3824
3824
  {
3825
3825
  "name": "createdAt",
@@ -3895,12 +3895,12 @@ export const catalog = {
3895
3895
  "revocation": {
3896
3896
  "type": "string",
3897
3897
  "format": "at-uri",
3898
- "description": "Where the issuer publishes a pub.techne.draft.credentialRevocation if it withdraws this credential (and every re-issue at the same binding id). Absent there = not revoked."
3898
+ "description": "Where the issuer publishes a pub.techne.draft.credentialRevocation if it withdraws this credential (and every re-issue at the same binding id). Absent there = not revoked by the issuer. The commons root can also revoke a commons credential an operator issued, with its own credentialRevocation at the same rkey in the root's repo; a reader counts either."
3899
3899
  },
3900
3900
  "signature": {
3901
3901
  "type": "ref",
3902
3902
  "ref": "#signature",
3903
- "description": "Present exactly when the credential is stored by its subject; absent only when the commons root publishes it in its own repo (the commit is the proof)."
3903
+ "description": "Present exactly when the credential is stored by its subject; absent only for a commons credential, which its issuer (the commons root, or an operator the root names) publishes in its own repo (the commit is the proof)."
3904
3904
  },
3905
3905
  "createdAt": {
3906
3906
  "type": "string",
@@ -3971,13 +3971,13 @@ export const catalog = {
3971
3971
  "group": "pub.techne",
3972
3972
  "kind": "record",
3973
3973
  "key": "any",
3974
- "description": "An issuer's withdrawal of a pub.techne.draft.credential: present at the address the credential names in `revocation` = that credential and every re-issue at the same binding id are revoked. Absent = not revoked. Names no subject. PUBLIC, in the issuer's repo; the record key is the binding id (random, so a revocation address is not guessable from the channel or the holder).",
3974
+ "description": "An issuer's withdrawal of a pub.techne.draft.credential: present at the address the credential names in `revocation` = that credential and every re-issue at the same binding id are revoked. Absent = not revoked, unless it is a commons credential and the commons root holds a revocation at the same rkey in its own repo (the root can revoke an operator's credential). Names no subject. PUBLIC, in the issuer's repo; the record key is the binding id (random, so a revocation address is not guessable from the channel or the holder).",
3975
3975
  "fields": [
3976
3976
  {
3977
3977
  "name": "reason",
3978
3978
  "type": "string (enum)",
3979
3979
  "required": true,
3980
- "description": "`unlinked`: the holder removed the method; `deleted`: the holder's account was deleted; `folded`: the method moved to the holder's other account; `superseded`: replaced by a newer binding; `compromised`: the key or the binding was compromised; `withdrawn`: the issuer no longer vouches for it (the commons root revoking a publisher declaration).",
3980
+ "description": "`unlinked`: the holder removed the method; `deleted`: the holder's account was deleted; `folded`: the method moved to the holder's other account; `superseded`: replaced by a newer binding; `compromised`: the key or the binding was compromised; `withdrawn`: the issuer no longer vouches for it (a commons admin writer, the root or an operator, withdrawing its vouching for a publisher declaration).",
3981
3981
  "knownValues": [
3982
3982
  "unlinked",
3983
3983
  "deleted",
@@ -3996,7 +3996,7 @@ export const catalog = {
3996
3996
  "doc": ({
3997
3997
  "lexicon": 1,
3998
3998
  "id": "pub.techne.draft.credentialRevocation",
3999
- "description": "An issuer's withdrawal of a pub.techne.draft.credential: present at the address the credential names in `revocation` = that credential and every re-issue at the same binding id are revoked. Absent = not revoked. Names no subject. PUBLIC, in the issuer's repo; the record key is the binding id (random, so a revocation address is not guessable from the channel or the holder).",
3999
+ "description": "An issuer's withdrawal of a pub.techne.draft.credential: present at the address the credential names in `revocation` = that credential and every re-issue at the same binding id are revoked. Absent = not revoked, unless it is a commons credential and the commons root holds a revocation at the same rkey in its own repo (the root can revoke an operator's credential). Names no subject. PUBLIC, in the issuer's repo; the record key is the binding id (random, so a revocation address is not guessable from the channel or the holder).",
4000
4000
  "defs": {
4001
4001
  "main": {
4002
4002
  "type": "record",
@@ -4019,7 +4019,7 @@ export const catalog = {
4019
4019
  "compromised",
4020
4020
  "withdrawn"
4021
4021
  ],
4022
- "description": "`unlinked`: the holder removed the method; `deleted`: the holder's account was deleted; `folded`: the method moved to the holder's other account; `superseded`: replaced by a newer binding; `compromised`: the key or the binding was compromised; `withdrawn`: the issuer no longer vouches for it (the commons root revoking a publisher declaration)."
4022
+ "description": "`unlinked`: the holder removed the method; `deleted`: the holder's account was deleted; `folded`: the method moved to the holder's other account; `superseded`: replaced by a newer binding; `compromised`: the key or the binding was compromised; `withdrawn`: the issuer no longer vouches for it (a commons admin writer, the root or an operator, withdrawing its vouching for a publisher declaration)."
4023
4023
  },
4024
4024
  "createdAt": {
4025
4025
  "type": "string",
@@ -7919,7 +7919,7 @@ export const catalog = {
7919
7919
  "doc": ({
7920
7920
  "lexicon": 1,
7921
7921
  "id": "pub.techne.draft.operator",
7922
- "description": "The commons root's statement that an account is an operator of the commons for a period. An operator may call the commons' operator methods (rerun jobs, adjudicate pairs, take records down, record releases, and the admin writes the commons makes in the root's repo for it: endorse and revoke rules, retire and un-retire identities, grant and revoke operators) with an atproto service-auth JWT it signs itself, and writes the commons' admin records (credentials that endorse a rule and their revocations, retirements) in its OWN repo, under its own account: a reader counts such a record when its writer is the root, or an operator a record here names whose period held when the reader first saw that version of the record. So an operator's acts stay counted after the period ends, and acts first seen after it do not. Only the root's own operator records count. An operator is cut off by ending the period (`validUntil`, which may be earlier than the edit, back to a compromise), never by deleting the record, which would erase the period the operator's past acts hang on. PUBLIC. Written in the commons root's repo only: by the commons' grantOperator (a new period at `{did}-{millis}` after an ended one) and revokeOperator (sets `validUntil`), which write as the root, or by the root signed in as itself. Each operator ends only its own acts (a revocation at its credential's address, deleting its own retirement). Read by the commons, the AppView and the rules runner.",
7922
+ "description": "The commons root's statement that an account is an operator of the commons for a period. An operator may call the commons' operator methods (rerun jobs and rules, pause rules, index a record, grant provider allowances, record releases, register and run scrapers, and the operator-only lists) with an atproto service-auth JWT it signs itself, and writes in its OWN repo, under its own account, the commons' admin records (credentials that endorse a rule and their revocations, retirements), which a reader counts when its writer is the root, or an operator a record here names whose period held when the reader first saw that version of the record. An operator's pair decisions and `!takedown` verdicts are ordinary records of its own: they count only while a live commons credential vouches for its declaration (provenancePolicy#vouchedWriter). So an operator's acts stay counted after the period ends, and acts first seen after it do not. Only the root's own operator records count. An operator is cut off by ending the period (`validUntil`, which may be earlier than the edit, back to a compromise), never by deleting the record, which would erase the period the operator's past acts hang on. PUBLIC. Written in the commons root's repo only, by the root signed in as itself (the commons' web app: granting writes a new period, at `{did}-{millis}` after an ended one; revoking sets `validUntil`). Each operator ends only its own acts (a revocation at its credential's address, deleting its own retirement); the root can also revoke an operator's credential, at the same rkey in the root's repo, but never ends an operator's retirement. Read by the commons, the AppView and the rules runner.",
7923
7923
  "defs": {
7924
7924
  "main": {
7925
7925
  "type": "record",
@@ -9938,7 +9938,7 @@ export const catalog = {
9938
9938
  },
9939
9939
  "composition": {
9940
9940
  "type": "object",
9941
- "description": "How the curated record was composed from its sources. Each source is a version, ranked: 1 a source the commons root vouches for in the collection (a mirror, a rule, a collective: its pub.techne.draft.publisher `writes` holds the collection and a live root pub.techne.draft.credential pins that declaration), 2 a verified account (a pub.techne.draft.verification by an issuer whose vouched declaration writes pub.techne.draft.verification) or a member of a collective vouched for to write membership claims (its vouched declaration's `writes` holds pub.techne.draft.membership), 3 everyone else. Per field the best rank wins, ties going to the newest edit; a rank 3 version only fills blanks or stands alone. A version with a moderation verdict the curator honours is left out (it has no rank here and gives no field), and so is a source by a retired identity: it is not a version. Readers show the composition as the default and may let a person pick another version.",
9941
+ "description": "How the curated record was composed from its sources. Each source is a version, ranked: 1 a source an admin writer vouches for in the collection (a mirror, a rule, a collective: its pub.techne.draft.publisher `writes` holds the collection and a live pub.techne.draft.credential from the commons root, or from an operator the root names, pins that declaration), 2 a verified account (a pub.techne.draft.verification by an issuer whose vouched declaration writes pub.techne.draft.verification) or a member of a collective vouched for to write membership claims (its vouched declaration's `writes` holds pub.techne.draft.membership), 3 everyone else. Per field the best rank wins, ties going to the newest edit; a rank 3 version only fills blanks or stands alone. A version with a moderation verdict the curator honours is left out (it has no rank here and gives no field), and so is a source by a retired identity: it is not a version. Readers show the composition as the default and may let a person pick another version.",
9942
9942
  "required": [
9943
9943
  "byline",
9944
9944
  "ranks"
@@ -10120,7 +10120,7 @@ export const catalog = {
10120
10120
  "name": "issues",
10121
10121
  "type": "array<→ #issue>",
10122
10122
  "required": false,
10123
- "description": "The credentials the account issues about a holder's record. Its pub.techne.draft.credential counts only while the root vouches for this declaration and the attested record is in an entry's `collection`, signed and stored by the subject, when the credential's `fields` are a subset of that entry's `fields` (a whole-record credential, by `cid`, only when that entry's `fields` is empty). Absent or empty: it issues none."
10123
+ "description": "The credentials the account issues about a holder's record. Its pub.techne.draft.credential counts only while an admin writer (the root, or an operator the root names) vouches for this declaration and the attested record is in an entry's `collection`, signed and stored by the subject, when the credential's `fields` are a subset of that entry's `fields` (a whole-record credential, by `cid`, only when that entry's `fields` is empty). Absent or empty: it issues none."
10124
10124
  },
10125
10125
  {
10126
10126
  "name": "createdAt",
@@ -10225,7 +10225,7 @@ export const catalog = {
10225
10225
  "type": "ref",
10226
10226
  "ref": "#issue"
10227
10227
  },
10228
- "description": "The credentials the account issues about a holder's record. Its pub.techne.draft.credential counts only while the root vouches for this declaration and the attested record is in an entry's `collection`, signed and stored by the subject, when the credential's `fields` are a subset of that entry's `fields` (a whole-record credential, by `cid`, only when that entry's `fields` is empty). Absent or empty: it issues none."
10228
+ "description": "The credentials the account issues about a holder's record. Its pub.techne.draft.credential counts only while an admin writer (the root, or an operator the root names) vouches for this declaration and the attested record is in an entry's `collection`, signed and stored by the subject, when the credential's `fields` are a subset of that entry's `fields` (a whole-record credential, by `cid`, only when that entry's `fields` is empty). Absent or empty: it issues none."
10229
10229
  },
10230
10230
  "createdAt": {
10231
10231
  "type": "string",
@@ -11685,7 +11685,7 @@ export const catalog = {
11685
11685
  "doc": ({
11686
11686
  "lexicon": 1,
11687
11687
  "id": "pub.techne.draft.retirement",
11688
- "description": "A statement, in its writer's repo, that an identity is retired: its records are kept but are no versions. For the commons a reader counts one only at rkey = its subject and only from the commons root, or from an operator the root names (pub.techne.draft.operator) whose period held when the reader first saw this version of the retirement. A retired identity's records stay cluster members and provenance sources, so a pointer to one still resolves to its curated record, but they are never versions: not composed, ranked or bylined by the curator, not judged or counted by the features rule, not listed by pub.techne.draft.commons.getVersions, and a curated record with no other source is not curated for readers. Used for a publisher whose records were re-published under another identity (the old Almanac publisher). Its writer deleting it withdraws it; the identity is un-retired when no counted retirement of it is left. Modeled on pub.techne.draft.operator. PUBLIC. Written by the commons root or an operator in its own repo (the commons' web app, signed in as that account); read by the AppView, the commons, the curator and the features rule.",
11688
+ "description": "A statement, in its writer's repo, that an identity is retired: its records are kept but are no versions. For the commons a reader counts one only at rkey = its subject and only from the commons root, or from an operator the root names (pub.techne.draft.operator) whose period held when the reader first saw this version of the retirement. A retired identity's records stay cluster members and provenance sources, so a pointer to one still resolves to its curated record, but they are never versions: not composed, ranked or bylined by the curator, not judged or counted by the features rule, not listed by pub.techne.draft.commons.getVersions, and a curated record with no other source is not curated for readers. Used for a publisher whose records were re-published under another identity (the old Almanac publisher). Each counts on its own: the root's stands whatever an operator does with its own. Its writer deleting it withdraws it; the identity is un-retired when no counted retirement of it is left. Modeled on pub.techne.draft.operator. PUBLIC. Written by the commons root or an operator in its own repo (the commons' web app, signed in as that account); read by the AppView, the commons, the curator and the features rule.",
11689
11689
  "defs": {
11690
11690
  "main": {
11691
11691
  "type": "record",
@@ -12754,7 +12754,7 @@ export const catalog = {
12754
12754
  "doc": ({
12755
12755
  "lexicon": 1,
12756
12756
  "id": "pub.techne.draft.verdict",
12757
- "description": "A moderation verdict on a record. It names a version (a strongRef) and what it is (`spam`, `obscene`, `!takedown`). `spam` and `obscene` are judged on all of that version's fields and cover that version only, so an edit is a new version they do not cover. `!takedown` is an operator's takedown: it covers every version of the subject record, including later edits. Only bad versions get one; a version with no verdict was judged clean or not judged. Withdrawing a verdict is deleting it (or updating it with other values) in a commit. A reader drops a version with a verdict it honours before composing a cluster's default view, and before deriving anything from it: the commons curator leaves it out of the curated record, the features rule out of its evidence. A reader honours a verdict only from an author whose pub.techne.draft.publisher declaration lists those values in `labels` and is vouched for by the commons root (a live root pub.techne.draft.credential pinned to its CID). atproto labels (`com.atproto.label.queryLabels`) are an export generated from these records for Bluesky-style clients, never the source of truth. Written in the writer's own repo: `spam` and `obscene` by the commons features rule, `!takedown` by the commons' operator account (whichever account the root vouches for with `verdict` in `writes` and `!takedown` in `labels`). PUBLIC.",
12757
+ "description": "A moderation verdict on a record. It names a version (a strongRef) and what it is (`spam`, `obscene`, `!takedown`). `spam` and `obscene` are judged on all of that version's fields and cover that version only, so an edit is a new version they do not cover. `!takedown` is an operator's takedown: it covers every version of the subject record, including later edits. Only bad versions get one; a version with no verdict was judged clean or not judged. Withdrawing a verdict is deleting it (or updating it with other values) in a commit. A reader drops a version with a verdict it honours before composing a cluster's default view, and before deriving anything from it: the commons curator leaves it out of the curated record, the features rule out of its evidence. A reader honours a verdict only from an author whose pub.techne.draft.publisher declaration lists those values in `labels` and is vouched for by an admin writer (a live pub.techne.draft.credential pinned to its CID from the commons root, or from an operator the root names; pub.techne.draft.provenancePolicy#vouchedWriter). atproto labels (`com.atproto.label.queryLabels`) are an export generated from these records for Bluesky-style clients, never the source of truth. Written in the writer's own repo: `spam` and `obscene` by the commons features rule, `!takedown` by the commons' operator account (whichever account an admin writer vouches for with `verdict` in `writes` and `!takedown` in `labels`). PUBLIC.",
12758
12758
  "defs": {
12759
12759
  "main": {
12760
12760
  "type": "record",
@@ -12827,7 +12827,7 @@ export const catalog = {
12827
12827
  "doc": ({
12828
12828
  "lexicon": 1,
12829
12829
  "id": "pub.techne.draft.verification",
12830
- "description": "A statement that a verified person is behind an account. The issuer checked a channel it counts as verification (which channel counts is the issuer's decision; for this commons, a phone number proved with a one-time code, and an email alone does not count). It names only the DID: no handle, no name, no channel, so a rename keeps it and nothing about the person is published beyond the fact. What it means is the endorser's call: a reader counts it only while its author's pub.techne.draft.publisher declaration lists pub.techne.draft.verification in `writes` and the commons root vouches for that declaration (a live root pub.techne.draft.credential pinned to its CID), read at runtime. Unlike app.bsky.graph.verification it does not vouch for a handle or a display name. The person's own pub.techne.draft.credential stays private in their wallet; this is the public signal. Deleting it withdraws it. Written by the credential issuer in its own repo. PUBLIC.",
12830
+ "description": "A statement that a verified person is behind an account. The issuer checked a channel it counts as verification (which channel counts is the issuer's decision; for this commons, a phone number proved with a one-time code, and an email alone does not count). It names only the DID: no handle, no name, no channel, so a rename keeps it and nothing about the person is published beyond the fact. What it means is the endorser's call: a reader counts it only while its author's pub.techne.draft.publisher declaration lists pub.techne.draft.verification in `writes` and an admin writer vouches for that declaration (a live pub.techne.draft.credential pinned to its CID from the commons root, or from an operator the root names; pub.techne.draft.provenancePolicy#vouchedWriter), read at runtime. Unlike app.bsky.graph.verification it does not vouch for a handle or a display name. The person's own pub.techne.draft.credential stays private in their wallet; this is the public signal. Deleting it withdraws it. Written by the credential issuer in its own repo. PUBLIC.",
12831
12831
  "defs": {
12832
12832
  "main": {
12833
12833
  "type": "record",