Pick any line to see why it is the way it is: the commit, the pull request and issue it came from, and what the agent was thinking.
| Initial g1t: services, event bus, intents and attempts | 1 | import type { Result } from "./result"; |
| 2 | ||
| 3 | export type User = { id: string; username: string }; | |
| 4 | ||
| 5 | /** Who is asking. Every read and write in every service takes one. */ | |
| 6 | export type Viewer = User | null; | |
| 7 | ||
| 8 | export type SshKey = { | |
| 9 | id: string; | |
| 10 | title: string; | |
| 11 | fingerprint: string; | |
| 12 | createdAt: number; | |
| 13 | }; | |
| 14 | ||
| 15 | export type AccessToken = { id: string; name: string; createdAt: number }; | |
| 16 | ||
| 17 | /** Accounts, credentials and sessions. */ | |
| 18 | export interface IdentityApi { | |
| API and MCP server, Rust identity service, registration, site redesign | 19 | /** Creates an account and signs it in. */ |
| 20 | register(username: string, email: string, password: string): Promise<Result<{ user: User; sessionToken: string }>>; | |
| Initial g1t: services, event bus, intents and attempts | 21 | /** Verifies a username and password for website sign-in. */ |
| 22 | signIn(username: string, password: string): Promise<Result<{ user: User; sessionToken: string }>>; | |
| 23 | signOut(sessionToken: string): Promise<void>; | |
| 24 | userForSession(sessionToken: string): Promise<Viewer>; | |
| 25 | ||
| 26 | /** Verifies git credentials: the account password or an access token. */ | |
| 27 | userForGitCredentials(username: string, secret: string): Promise<Viewer>; | |
| API and MCP server, Rust identity service, registration, site redesign | 28 | /** Resolves a `g1t_…` access token, as sent to the API and MCP server. */ |
| 29 | userForAccessToken(token: string): Promise<Viewer>; | |
| Initial g1t: services, event bus, intents and attempts | 30 | userForSshKey(fingerprint: string): Promise<Viewer>; |
| 31 | userByUsername(username: string): Promise<Viewer>; | |
| 32 | ||
| 33 | listSshKeys(user: User): Promise<SshKey[]>; | |
| 34 | /** Takes one line in OpenSSH public key format. */ | |
| 35 | addSshKey(user: User, title: string, publicKey: string): Promise<Result<SshKey>>; | |
| 36 | removeSshKey(user: User, id: string): Promise<void>; | |
| 37 | ||
| 38 | listAccessTokens(user: User): Promise<AccessToken[]>; | |
| 39 | /** The plaintext token is returned once and never stored. */ | |
| 40 | createAccessToken(user: User, name: string): Promise<{ token: string; info: AccessToken }>; | |
| 41 | removeAccessToken(user: User, id: string): Promise<void>; | |
| 42 | } |