slopus--happy
98e40dac97
CLI Smoke Test / smoke-test-linux (20) (push) Has been cancelled
CLI Smoke Test / smoke-test-linux (24) (push) Has been cancelled
CLI Smoke Test / smoke-test-windows (20) (push) Has been cancelled
CLI Smoke Test / smoke-test-windows (24) (push) Has been cancelled
Expo App TypeScript typecheck / typecheck (push) Has been cancelled
78 行
1.7 KiB
TypeScript
78 行
1.7 KiB
TypeScript
export type HappyAuthStatus =
|
|
| 'starting'
|
|
| 'unconfigured'
|
|
| 'authenticating'
|
|
| 'authenticated'
|
|
| 'error'
|
|
|
|
export type HappyAuthMethod = 'link-device' | 'create-account' | 'restore-secret'
|
|
|
|
export interface HappyAuthFlowSnapshot {
|
|
method: HappyAuthMethod
|
|
authUrl?: string
|
|
publicKey?: string
|
|
startedAt: number
|
|
}
|
|
|
|
export interface HappyStateSnapshot {
|
|
status: HappyAuthStatus
|
|
serverUrl: string
|
|
webappUrl: string
|
|
clientReady: boolean
|
|
accountId?: string
|
|
tokenExpiresAt?: number
|
|
authFlow?: HappyAuthFlowSnapshot
|
|
error?: string
|
|
updatedAt: number
|
|
}
|
|
|
|
export interface HappyAuthenticatedClientStatus {
|
|
ready: boolean
|
|
serverUrl: string
|
|
accountId?: string
|
|
anonId?: string
|
|
contentPublicKey?: string
|
|
}
|
|
|
|
export type HappyWorkerRequest =
|
|
| { kind: 'getState' }
|
|
| { kind: 'createAccount' }
|
|
| { kind: 'startLinkDevice' }
|
|
| { kind: 'restoreSecret'; secretKey: string }
|
|
| { kind: 'cancelAuth' }
|
|
| { kind: 'logout' }
|
|
| { kind: 'clientStatus' }
|
|
|
|
export type HappyWorkerRequestWithId = HappyWorkerRequest & { requestId: string }
|
|
|
|
export type HappyWorkerResponse =
|
|
| {
|
|
kind: 'response'
|
|
requestId: string
|
|
ok: true
|
|
state: HappyStateSnapshot
|
|
value?: unknown
|
|
}
|
|
| {
|
|
kind: 'response'
|
|
requestId: string
|
|
ok: false
|
|
state: HappyStateSnapshot
|
|
error: string
|
|
}
|
|
|
|
export type HappyWorkerStateMessage = {
|
|
kind: 'state'
|
|
state: HappyStateSnapshot
|
|
}
|
|
|
|
export type HappyWorkerFatalMessage = {
|
|
kind: 'fatal'
|
|
error: string
|
|
}
|
|
|
|
export type HappyWorkerMessage =
|
|
| HappyWorkerResponse
|
|
| HappyWorkerStateMessage
|
|
| HappyWorkerFatalMessage
|