g1t/packages/contracts/src/identity.ts

603 lines24,953 bytesCodeBlame
1import type { AccessClient, BasePermission, RepoGrant } from "./access";
2import type { Acting, CreateRunCredentialInput, RunBinding } from "./audit";
3import type { RepoPath } from "./repos";
4import type { Result } from "./result";
5
6export type User = {
7 id: string;
8 username: string;
9 /**
10 * `workspace` when a workspace is acting through one of its own access
11 * tokens: `id` is then the workspace's and `username` its slug. Absent
12 * means `user`.
13 */
14 kind?: "user" | "workspace" | "agent";
15 /**
16 * Whether the account's email address is confirmed. Only set on users
17 * resolved from credentials; unverified accounts cannot change anything.
18 */
19 verified?: boolean;
20 /**
21 * The workspaces this user belongs to. Set on users resolved from
22 * credentials, so any service can authorize from it.
23 */
24 workspaces?: Membership[];
25 /**
26 * The person's uploaded avatar: the SHA-256 of its bytes, served at
27 * `/avatars/<avatar>`. Only set on the signed-in person; absent means
28 * the generated letter avatar.
29 */
30 avatar?: string;
31 /**
32 * Set on an agent resolved from its token: who it acts for ("g1t-agent
33 * on behalf of syntaqx"), with which credential, and what it may do.
34 */
35 acting?: Acting;
36 /**
37 * The repositories this user has a role on directly, whether or not they
38 * belong to its workspace. Set with `workspaces`; see `access.ts`.
39 */
40 grants?: RepoGrant[];
41};
42
43/** What a member may do: an owner also manages the workspace's members. */
44export type Role = "owner" | "member";
45
46export type Membership = {
47 /** The workspace's name in URLs: `g1t.sh/<slug>`. */
48 slug: string;
49 role: Role;
50 /** Its display name. Set on users resolved from credentials. */
51 name?: string;
52 /** Its uploaded icon, as `Workspace.avatar`. */
53 avatar?: string;
54 /** The workspace's base permission: what members get on every repository. Absent means `write`. */
55 base_permission?: BasePermission;
56};
57
58/** How long an old workspace slug redirects, and stays reserved for it, after a rename. */
59export const SLUG_HOLD_DAYS = 90;
60
61/** How long a workspace must wait between renames. */
62export const RENAME_COOLDOWN_HOURS = 24;
63
64/** The largest avatar that can be uploaded, in bytes. */
65export const MAX_AVATAR_BYTES = 1024 * 1024;
66
67/**
68 * A workspace: the owner of repositories, and the first segment of their
69 * URLs. A person's own space and a team's are the same thing.
70 */
71export type Workspace = {
72 id: string;
73 slug: string;
74 name: string;
75 /** One line saying what the workspace is for. */
76 description: string | null;
77 /** RFC 3339. */
78 createdAt: string;
79 memberCount: number;
80 /**
81 * The workspace's uploaded icon: the SHA-256 of its bytes, served at
82 * `/avatars/<avatar>`. Null means the generated letter avatar.
83 */
84 avatar: string | null;
85 /** What every member gets on each repository; owners have Admin. */
86 basePermission?: BasePermission;
87};
88
89export type Member = {
90 username: string;
91 role: Role;
92 /** Their display name, when they set one. */
93 name?: string | null;
94 /** Their uploaded avatar's hash, served at `/avatars/<avatar>`; null for the generated letter avatar. */
95 avatar?: string | null;
96};
97
98/** An owner of a workspace, as staff see them. */
99export type AdminOwner = { username: string; email: string | null };
100
101/** A workspace as staff see it. Mirrors `AdminWorkspace` in `crates/contracts/src/identity.rs`. */
102export type AdminWorkspace = {
103 slug: string;
104 name: string;
105 /** RFC 3339. */
106 createdAt: string;
107 owners: AdminOwner[];
108 memberCount: number;
109};
110
111/** A member of a workspace, as staff see them. */
112export type AdminMember = { username: string; email: string | null; role: Role; /** RFC 3339. */ joined: string };
113
114export type AdminWorkspaceDetail = {
115 slug: string;
116 name: string;
117 description: string | null;
118 /** RFC 3339. */
119 createdAt: string;
120 /** Owners first, then by username. */
121 members: AdminMember[];
122};
123
124/** The most workspaces one `workspaces` call returns. */
125export const ADMIN_WORKSPACES_LIMIT = 500;
126
127/**
128 * Whether anyone may make an account, or only someone with an invite.
129 * Identity's `REGISTRATION_MODE`; unset means `invite`.
130 */
131export type RegistrationMode = "invite" | "open";
132
133/** How many invites a person may have out at once, unless identity's `INVITES_PER_USER` says otherwise. */
134export const INVITES_PER_USER = 5;
135/** How long an invite works, unless identity's `INVITE_TTL_DAYS` says otherwise. */
136export const INVITE_TTL_DAYS = 30;
137
138/** Only a pending invite can be used or revoked. Revoked and expired ones never used give the invite back. */
139export type InviteStatus = "pending" | "redeemed" | "expired" | "revoked";
140
141/** One invite. Mirrors `Invite` in `crates/contracts/src/identity.rs`. */
142export type Invite = {
143 id: string;
144 /** `g1t-k7m2-…`: returned when it is made, and to its maker while pending. */
145 code: string | null;
146 /** The code's first group, such as `g1t-k7m2`. */
147 hint: string;
148 /** Only this address can use it. */
149 email: string | null;
150 /** `account` makes an account; `workspace` joins an existing one to `workspace`. */
151 kind: "account" | "workspace";
152 /** The workspace using it joins. */
153 workspace: string | null;
154 status: InviteStatus;
155 /** Whose allowance it used. */
156 chargedTo: "user" | "workspace" | "none";
157 /** Its maker's username; null when g1t staff made it. */
158 invitedBy: string | null;
159 /** The account that used it. */
160 redeemedBy: string | null;
161 /** RFC 3339. */
162 createdAt: string;
163 /** RFC 3339. */
164 expiresAt: string;
165 redeemedAt: string | null;
166 revokedAt: string | null;
167 /** The staff member who minted it; only in staff views. */
168 staff?: string | null;
169};
170
171/** How many invites someone may have out. `limit` and `remaining` are null for no limit. */
172export type Allowance = { limit: number | null; used: number; remaining: number | null };
173
174export type InvitesOverview = {
175 mode: RegistrationMode;
176 allowance: Allowance;
177 /** Workspaces the person owns that were granted invites to share. */
178 workspaces: { slug: string; allowance: Allowance }[];
179 invites: Invite[];
180};
181
182/** What a valid code is for, before it is used. */
183export type InvitePreview = {
184 kind: "account" | "workspace";
185 /** Pending, unless `anyStatus` asked about a code that is spent. */
186 status: InviteStatus;
187 /** Null when g1t staff sent it. */
188 invitedBy: { username: string; name: string | null; avatar: string | null } | null;
189 workspace: ProfileWorkspace | null;
190 /** The repository it accepts an invitation to, such as `{ name: "flagon-io/g1t", role: "write" }`. */
191 repository: { name: string; role: string } | null;
192 /** Partly hidden, such as `a•••@example.com`. */
193 email: string | null;
194 /** The bound address in full, while the invite is pending: it fills in and locks the sign-up form. */
195 address: string | null;
196 /** Whether the bound address has a g1t account already: sign in to accept. */
197 hasAccount: boolean;
198 /** With a viewer: whether it is theirs (for one of their confirmed addresses, or used by them). */
199 forViewer: boolean | null;
200 expiresAt: string;
201};
202
203export type WaitlistStatus = "waiting" | "invited" | "dismissed";
204
205export type WaitlistEntry = {
206 id: string;
207 email: string;
208 about: string | null;
209 status: WaitlistStatus;
210 inviteId: string | null;
211 decidedBy: string | null;
212 decidedAt: string | null;
213 /** What staff wrote when approving; it went in the invite email. */
214 note: string | null;
215 /** The account made with the invite, once it was used. */
216 joinedAs: string | null;
217 /** When they first asked. */
218 createdAt: string;
219 /** When they last asked. */
220 updatedAt: string;
221};
222
223export type InviteGrant = { amount: number; note: string | null; grantedBy: string; createdAt: string };
224export type InviteTreeNode = { username: string; joinedAt: string; invited: InviteTreeNode[] };
225
226/** Where a person came from and whom they brought. For a workspace, `username` is its slug. */
227export type InviteTree = {
228 username: string;
229 /** Who invited them, then who invited that person, and so on. */
230 invitedBy: string[];
231 /** The staff member who minted their invite, when staff did. */
232 staff: string | null;
233 allowance: Allowance;
234 grants: InviteGrant[];
235 invites: Invite[];
236 /** Whom they invited, three levels down. */
237 invited: InviteTreeNode[];
238};
239
240/** The most rows one staff listing of invites or the waitlist returns. */
241export const ADMIN_INVITES_LIMIT = 500;
242
243/**
244 * Staff-only identity, for sudo.g1t.sh. It takes no viewer and checks no
245 * membership: only sudo calls it, over its service binding, once Cloudflare
246 * Access and its staff list have let someone in. Never call it on behalf of
247 * a customer.
248 */
249export interface IdentityAdminApi {
250 /** Every workspace, newest first, at most 500; `query` matches slug, name, or an owner's username or email. */
251 workspaces(query?: string): Promise<AdminWorkspace[]>;
252 /** One workspace with all its members, or null. */
253 workspace(slug: string): Promise<AdminWorkspaceDetail | null>;
254
255 /** The waitlist, newest first; `query` matches the address or what they said. */
256 waitlist(query?: string | null, status?: WaitlistStatus | null): Promise<WaitlistEntry[]>;
257 /** How many requests are waiting, for the navigation's badge. */
258 waitlistPending(): Promise<number>;
259 /**
260 * Approving mints an invite bound to the address and emails it, with
261 * `note` (up to 500 characters) if given; dismissing only marks it.
262 */
263 decideWaitlist(id: string, approve: boolean, staff: string, note?: string | null): Promise<Result<WaitlistEntry>>;
264 /** Invites, newest first; `query` is a code's start, or part of an email, inviter or redeemer. */
265 invites(query?: string | null): Promise<Invite[]>;
266 revokeInvite(id: string, staff: string): Promise<Result<Invite>>;
267 /** An invite that uses nobody's allowance, optionally bound to (and emailed to) `email`. */
268 mintInvite(email: string | null, staff: string): Promise<Result<Invite>>;
269 /** More invites (or fewer, with a negative amount) for a person or a workspace. */
270 grantInvites(
271 target: "user" | "workspace",
272 name: string,
273 amount: number,
274 note: string,
275 staff: string,
276 ): Promise<Result<Allowance>>;
277 /** Where a person came from and whom they brought, or null. */
278 inviteTree(username: string): Promise<InviteTree | null>;
279 /** A workspace's granted invites and the invites made for it, or null. */
280 workspaceInvites(slug: string): Promise<InviteTree | null>;
281}
282
283/** Who is asking. Every read and write in every service takes one. */
284export type Viewer = User | null;
285
286export type SshKey = {
287 id: string;
288 title: string;
289 fingerprint: string;
290 /** RFC 3339. */
291 createdAt: string;
292};
293
294export type AccessToken = {
295 id: string;
296 name: string;
297 /** RFC 3339. */
298 createdAt: string;
299 /** RFC 3339, to within a few minutes. Null until it is first used. */
300 lastUsedAt: string | null;
301 /**
302 * For a workspace's token, the username of the member who made it. Null
303 * once that account is gone, and on personal tokens.
304 */
305 createdBy: string | null;
306};
307
308export type DeviceStart = {
309 /** Secret held by the tool and exchanged for a token once approved. */
310 deviceCode: string;
311 /** Short code shown to the person, e.g. `WDJB-MJHT`. */
312 userCode: string;
313 /** Seconds until both codes stop working. */
314 expiresIn: number;
315 /** Seconds the tool should wait between polls. */
316 interval: number;
317};
318
319export type DeviceRequest = { userCode: string; clientName: string };
320
321export type DeviceClaim =
322 | { status: "pending" | "denied" | "expired" }
323 | { status: "approved"; token: string; user: User };
324
325/** What the site passes on once a person has approved an application. */
326export type OAuthApproval = {
327 clientId: string;
328 /** Shown wherever the application's access is listed. */
329 clientName: string;
330 redirectUri: string;
331 /** PKCE challenge, method S256. */
332 codeChallenge: string;
333};
334
335export type OAuthTokens = {
336 accessToken: string;
337 /** Works once; using it returns the next one. */
338 refreshToken: string;
339 /** Seconds until the access token stops working. */
340 expiresIn: number;
341};
342
343/** An application a person has signed in to. */
344export type OAuthGrant = {
345 id: string;
346 clientName: string;
347 /** RFC 3339. */
348 createdAt: string;
349 /** RFC 3339. */
350 lastUsedAt: string;
351};
352
353/** Accounts, credentials and sessions. */
354/** What stands between a workspace and its deletion; nothing when both counts are 0 and `billing` is null. */
355export type WorkspaceDeletion = {
356 repositories: number;
357 projects: number;
358 /** Why billing cannot close it yet, in words for its owner. */
359 billing: string | null;
360};
361
362export interface IdentityApi extends AccessClient {
363 /**
364 * Creates an account and signs it in. While registration is invite-only,
365 * `inviteCode` must be an unused, unexpired invite (and, when it names an
366 * email, that address); it is ignored while registration is open.
367 */
368 register(
369 username: string,
370 email: string,
371 password: string,
372 inviteCode?: string | null,
373 /** Who is asking, such as the visitor's IP address, for rate limits. */
374 client?: string | null,
375 ): Promise<Result<{ user: User; sessionToken: string }>>;
376 /** Verifies a username and password for website sign-in. */
377 /**
378 * Verifies a username, or any confirmed address of the account, and its
379 * password. Wrong passwords are counted against the account and `client`
380 * (the visitor's IP address); past a limit nothing is checked for a while.
381 */
382 signIn(username: string, password: string, client?: string | null): Promise<Result<{ user: User; sessionToken: string }>>;
383 signOut(sessionToken: string): Promise<void>;
384
385 /** Sends the confirmation email again. */
386 resendVerification(user: User): Promise<Result<boolean>>;
387 /** Confirms the address the emailed token was sent to. */
388 verifyEmail(token: string): Promise<Result<User>>;
389 /** Emails a reset link if the address has an account. Always resolves. */
390 /**
391 * Any confirmed address of an account works; the link goes to it, and the
392 * primary and backup are told. A few an hour per address and per `client`.
393 */
394 requestPasswordReset(email: string, client?: string | null): Promise<boolean>;
395 /** Sets a new password from an emailed token and ends every session. */
396 resetPassword(token: string, password: string): Promise<Result<User>>;
397
398 /**
399 * Device sign-in (RFC 8628). A tool starts a request, a person approves
400 * its short code in a browser, and the tool claims an access token.
401 */
402 deviceStart(clientName: string): Promise<DeviceStart>;
403 /** What a user code is asking for, or null if it is not valid. */
404 deviceLookup(userCode: string): Promise<DeviceRequest | null>;
405 deviceResolve(userCode: string, user: User, approve: boolean): Promise<Result<boolean>>;
406 deviceClaim(deviceCode: string): Promise<DeviceClaim>;
407
408 /**
409 * OAuth 2.1 for applications that sign a person in through the browser.
410 * The caller has checked the client and its redirect address; this
411 * returns the one-time code the application exchanges for tokens.
412 */
413 oauthAuthorize(user: User, approval: OAuthApproval): Promise<{ code: string }>;
414 /** Redeems a code. It works once, for that client, with the PKCE verifier. */
415 oauthExchange(code: string, codeVerifier: string, clientId: string, redirectUri: string): Promise<Result<OAuthTokens>>;
416 /** Trades a refresh token for new tokens; the old ones stop working. */
417 oauthRefresh(refreshToken: string, clientId: string): Promise<Result<OAuthTokens>>;
418 /** Applications the user has signed in to, most recently used first. */
419 listOAuthGrants(user: User): Promise<OAuthGrant[]>;
420 /** Signs an application out. */
421 revokeOAuthGrant(user: User, id: string): Promise<void>;
422
423 createWorkspace(user: User, slug: string, name: string): Promise<Result<Workspace>>;
424 /** Public details of a workspace, or null. */
425 getWorkspace(slug: string): Promise<Workspace | null>;
426 /** Members only. */
427 listMembers(slug: string, viewer: Viewer): Promise<Result<Member[]>>;
428 /** Owners only. */
429 addMember(actor: User, slug: string, username: string): Promise<Result<boolean>>;
430 /** Owners only. */
431 removeMember(actor: User, slug: string, username: string): Promise<Result<boolean>>;
432 /** Owners only. An empty name falls back to the slug. */
433 updateWorkspace(actor: User, slug: string, details: { name: string; description: string }): Promise<Result<Workspace>>;
434 /**
435 * Owners only. Changes the slug, the first segment of the workspace's
436 * URLs; the display name is untouched. The old slug redirects to the new
437 * one, and stays reserved for this workspace, for `SLUG_HOLD_DAYS`.
438 * Publishes `workspace.renamed`.
439 */
440 renameWorkspace(actor: User, slug: string, newSlug: string): Promise<Result<Workspace>>;
441 /** Whether `renameWorkspace` would be allowed, changing nothing. */
442 checkWorkspaceRename(actor: User, slug: string, newSlug: string): Promise<Result<boolean>>;
443 /**
444 * The workspace's current slug when `slug` is one it was renamed from
445 * within `SLUG_HOLD_DAYS`; null otherwise, including for a slug in use.
446 */
447 resolveSlug(slug: string): Promise<string | null>;
448 /**
449 * Owners only, a person only. `confirm` is the slug, typed out. Refused
450 * while the workspace holds repositories or projects, or billing cannot
451 * settle it. Its slug is never given to anyone else; the person whose
452 * username it is may make it again. Publishes `workspace.deleted`.
453 */
454 deleteWorkspace(actor: User, slug: string, confirm: string): Promise<Result<boolean>>;
455 /** What stands in the way of `deleteWorkspace`, changing nothing. */
456 checkWorkspaceDeletion(actor: User, slug: string): Promise<Result<WorkspaceDeletion>>;
457 /**
458 * Owners only. `image` is the file in base64: PNG, JPEG, WebP or GIF, at
459 * most `MAX_AVATAR_BYTES`, checked by its bytes. Null removes the icon.
460 */
461 setWorkspaceAvatar(actor: User, slug: string, image: string | null): Promise<Result<Workspace>>;
462 /** A person's own avatar, as `setWorkspaceAvatar`: the new one, or null. */
463 setUserAvatar(user: User, image: string | null): Promise<Result<string | null>>;
464
465 /**
466 * A workspace's own access tokens. They belong to the workspace, act as
467 * it, and keep working when the member who made one leaves. Members only.
468 */
469 listWorkspaceTokens(slug: string, viewer: Viewer): Promise<Result<AccessToken[]>>;
470 /** Owners only. The plaintext token is returned once and never stored. */
471 createWorkspaceToken(actor: User, slug: string, name: string): Promise<Result<{ token: string; info: AccessToken }>>;
472 /** Owners only. */
473 removeWorkspaceToken(actor: User, slug: string, id: string): Promise<Result<boolean>>;
474
475 userForSession(sessionToken: string): Promise<Viewer>;
476
477 /** Whether registration is invite-only. */
478 registration(): Promise<RegistrationMode>;
479 /** A person's invites and what they have left. */
480 listInvites(user: User): Promise<InvitesOverview>;
481 /**
482 * A person makes an invite, optionally for one address (emailed to it),
483 * using one of theirs or, with `workspace`, one the workspace was granted.
484 * People only: never an agent or a workspace's token.
485 */
486 createInvite(user: User, options?: { email?: string | null; workspace?: string | null }): Promise<Result<Invite>>;
487 /** Its maker, or an owner of its workspace, revokes a pending invite; the invite comes back. */
488 revokeInvite(user: User, id: string): Promise<Result<Invite>>;
489 /**
490 * What a code is for. Unknown, used, revoked and expired codes all get the
491 * same answer, unless `anyStatus`: then a real code that is spent is
492 * described, with its `status`. `viewer` sets `forViewer`.
493 */
494 checkInvite(
495 code: string,
496 client?: string | null,
497 options?: { viewer?: User | null; anyStatus?: boolean },
498 ): Promise<Result<InvitePreview>>;
499 /**
500 * A signed-in person uses a workspace invite sent to their address, or one
501 * sent with a repository invitation; returns the workspace's slug, or
502 * `workspace/repo`.
503 */
504 acceptInvite(user: User, code: string): Promise<Result<string>>;
505 /** Owners only. Invites an address into a workspace, always with an invite bound to it. */
506 inviteMember(actor: User, slug: string, email: string): Promise<Result<Invite>>;
507 /** Owners only: the workspace's invites, newest first. */
508 workspaceInvites(slug: string, viewer: Viewer): Promise<Result<Invite[]>>;
509 /** Owners only. */
510 revokeWorkspaceInvite(actor: User, slug: string, id: string): Promise<Result<Invite>>;
511 /** Someone without an invite asks for one. Always the same answer for a valid address. */
512 requestAccess(email: string, about: string, client?: string | null): Promise<Result<boolean>>;
513
514 /** Verifies git credentials: the account password or an access token. */
515 userForGitCredentials(username: string, secret: string): Promise<Viewer>;
516 /** Resolves a `g1t_…` access token, as sent to the API and MCP server. */
517 userForAccessToken(token: string): Promise<Viewer>;
518 userForSshKey(fingerprint: string): Promise<Viewer>;
519 userByUsername(username: string): Promise<Viewer>;
520 /** The names behind account and workspace ids; unknown ids are left out. */
521 usernames(ids: string[]): Promise<Record<string, string>>;
522
523 /** A person's public profile, or null if there is no such account. Never an email address. */
524 profile(username: string): Promise<Profile | null>;
525 /** A person changes their own profile. Every field is replaced; an empty one is cleared. */
526 updateProfile(actor: User, fields: ProfileFields): Promise<Result<Profile>>;
527 /**
528 * The workspaces a profile shows `viewer`: those the viewer belongs to
529 * as well, and those of `publicIn` (where the person made a public
530 * project) that the person really belongs to. Nothing else.
531 */
532 profileWorkspaces(username: string, viewer: Viewer, publicIn: string[]): Promise<ProfileWorkspace[]>;
533
534 listSshKeys(user: User): Promise<SshKey[]>;
535 /** Takes one line in OpenSSH public key format. */
536 addSshKey(user: User, title: string, publicKey: string): Promise<Result<SshKey>>;
537 removeSshKey(user: User, id: string): Promise<void>;
538
539 listAccessTokens(user: User): Promise<AccessToken[]>;
540 /**
541 * The plaintext token is returned once and never stored. With
542 * `ttlSeconds` the token expires and is left out of token lists; that
543 * form is used for hosted agents. A token made for a workspace acting
544 * through a token of its own belongs to that workspace too.
545 */
546 createAccessToken(user: User, name: string, ttlSeconds?: number): Promise<{ token: string; info: AccessToken }>;
547 /**
548 * A token for a g1t agent working for `onBehalfOf`: it acts as
549 * `g1t-agent`, in `scope.repo` only, and only for `scope.operations`.
550 */
551 createAgentToken(
552 onBehalfOf: User,
553 scope: AgentScope,
554 ttlSeconds: number,
555 ): Promise<{ token: string; info: AccessToken }>;
556 removeAccessToken(user: User, id: string): Promise<void>;
557 /**
558 * A token for one sandbox run: it acts as the agent on behalf of
559 * `onBehalfOf`, can do only what the run's kind needs in `repo`, and
560 * expires after `ttlSeconds`. See `audit.ts`.
561 */
562 createRunCredential(input: CreateRunCredentialInput): Promise<{ token: string; info: AccessToken }>;
563 /** Ties tokens, by the SHA-256 of their text in hex, to the agent run their sandbox recorded. */
564 bindRunCredentials(tokenHashes: string[], runId: string): Promise<boolean>;
565 /** Ends a sandbox's run credentials, by hash or by run. Never touches another token. */
566 revokeRunCredentials(target: { tokenHashes?: string[]; runId?: string | null }): Promise<boolean>;
567}
568
569
570/** What an agent's token may do: these operations, in this repository. */
571export type AgentScope = { repo: RepoPath; operations: string[]; run?: RunBinding };
572
573/** The most characters each profile field takes. Mirrors `crates/contracts/src/identity.rs`. */
574export const PROFILE_LIMITS = { name: 80, bio: 160, location: 80, website: 200, pronouns: 40 } as const;
575
576/** What anyone may see about a person, at `g1t.sh/u/<username>`. */
577export type Profile = {
578 username: string;
579 /** The name they go by, if they gave one. */
580 name: string | null;
581 bio: string | null;
582 location: string | null;
583 /** Always an `https://` address. */
584 website: string | null;
585 pronouns: string | null;
586 /** The uploaded avatar's hash, served at `/avatars/<avatar>`. */
587 avatar: string | null;
588 /** When the account was made. RFC 3339. */
589 createdAt: string;
590};
591
592/** What a person may change on their profile. Empty clears a field. */
593export type ProfileFields = {
594 name: string;
595 bio: string;
596 location: string;
597 /** `https://…`; a bare `example.com` is taken as `https://example.com`. */
598 website: string;
599 pronouns: string;
600};
601
602/** A workspace on a person's profile. */
603export type ProfileWorkspace = { slug: string; name: string; avatar: string | null };