# Login ## Start Beeper app setup `client.app.login.start(RequestOptionsoptions?): LoginStartResponse` **post** `/v1/app/setup/start` Start setting up Beeper Desktop or Beeper Server. The flow supports existing Beeper accounts and new account creation. ### Returns - `LoginStartResponse` - `setupRequestID: string` Setup request ID to use in the next sign-in step. - `signInMethods: Array` Available sign-in methods for this setup request. ### Example ```typescript import BeeperDesktop from '@beeper/desktop-api'; const client = new BeeperDesktop(); const response = await client.app.login.start(); console.log(response.setupRequestID); ``` #### Response ```json { "setupRequestID": "setupRequestID", "signInMethods": [ "string" ] } ``` ## Send setup sign-in code `client.app.login.email(LoginEmailParamsbody, RequestOptionsoptions?): void` **post** `/v1/app/setup/email` Send a sign-in code to the user email address for app setup. ### Parameters - `body: LoginEmailParams` - `email: string` Email address to send the sign-in code to. - `setupRequestID: string` Setup request ID returned by the start step. ### Example ```typescript import BeeperDesktop from '@beeper/desktop-api'; const client = new BeeperDesktop(); await client.app.login.email({ email: 'dev@stainless.com', setupRequestID: 'setupRequestID' }); ``` ## Complete setup sign-in with code `client.app.login.response(LoginResponseParamsbody, RequestOptionsoptions?): LoginResponseResponse` **post** `/v1/app/setup/response` Finish setup sign-in with the code sent to the user email address. If the user needs a new account, the response includes account creation copy and username suggestions. ### Parameters - `body: LoginResponseParams` - `response: string` Sign-in code from the user email. - `setupRequestID: string` Setup request ID returned by the start step. ### Returns - `LoginResponseResponse = Success | RegistrationRequired` - `Success` - `matrix: Matrix` Account credentials for first-party app setup. - `accessToken: string` Beeper account access token. Returned once for first-party app setup. - `deviceID: string` Current device ID. - `homeserver: string` Beeper homeserver URL for this account. - `userID: string` Signed-in Beeper user ID. - `session: Session` Current app sign-in and encrypted messaging setup state after sign-in. - `e2ee: E2EE` Encrypted messaging setup status. - `crossSigning: boolean` Whether this account can verify trusted devices. - `firstSyncDone: boolean` Whether the first encrypted message sync is complete. - `hasBackedUpRecoveryKey: boolean` Whether the user confirmed that they saved their recovery key. - `initialized: boolean` Whether encrypted messaging setup has started. - `keyBackup: boolean` Whether encrypted message backup is available. - `secrets: Secrets` Encrypted messaging keys available on this device. - `masterKey: boolean` Whether the account identity key is available. - `megolmBackupKey: boolean` Whether the encrypted message backup key is available. - `recoveryKey: boolean` Whether a recovery key is available. - `selfSigningKey: boolean` Whether the device trust key is available. - `userSigningKey: boolean` Whether the user trust key is available. - `secretStorage: boolean` Whether secure key storage is available. - `verified: boolean` Whether this device is trusted for encrypted messages. - `recoveryKeyGeneratedAt?: number` Unix timestamp for when the recovery key was created. - `state: "needs-login" | "initializing" | "needs-cross-signing-setup" | 4 more` Current sign-in and encrypted messaging setup state for Beeper Desktop or Beeper Server. - `"needs-login"` - `"initializing"` - `"needs-cross-signing-setup"` - `"needs-verification"` - `"needs-secrets"` - `"needs-first-sync"` - `"ready"` - `matrix?: Matrix` Signed-in account details. Omitted until sign-in is complete. - `deviceID: string` Current device ID. - `homeserver: string` Beeper homeserver URL for this account. - `userID: string` Signed-in Beeper user ID. - `verification?: Verification` Trusted device verification progress. - `id: string` Verification ID to pass in verification action paths. - `availableActions: Array<"accept" | "cancel" | "qr.confirmScanned" | 2 more>` Verification actions that are valid for the current state. - `"accept"` - `"cancel"` - `"qr.confirmScanned"` - `"sas.start"` - `"sas.confirm"` - `direction: "incoming" | "outgoing"` Whether this device started or received the verification. - `"incoming"` - `"outgoing"` - `methods: Array<"qr" | "sas">` Verification methods supported for this transaction. - `"qr"` - `"sas"` - `purpose: "login" | "device"` Why this verification exists. - `"login"` - `"device"` - `state: "requested" | "ready" | "sas_ready" | 4 more` Current trusted-device verification state. - `"requested"` - `"ready"` - `"sas_ready"` - `"qr_scanned"` - `"done"` - `"cancelled"` - `"error"` - `error?: Error` Verification error details, if verification stopped. - `code: string` Verification error code. - `reason: string` User-facing verification error message. - `otherDevice?: OtherDevice` Other device participating in verification. - `id: string` Other device ID. - `name?: string` Other device display name, if known. - `otherUserID?: string` Other Beeper user participating in verification. - `qr?: Qr` QR verification data. - `data: string` QR code payload to display for verification. - `sas?: SAS` Emoji or number comparison data for verification. - `emojis: string` Emoji sequence to compare on both devices. - `decimals?: string` Number sequence to compare on both devices. - `RegistrationRequired` - `copy: Copy` Copy to display during account creation. - `submit: "Continue"` Submit button label. - `"Continue"` - `terms: "By continuing, you agree to the Terms of Use and acknowledge the Privacy Policy."` Terms and privacy notice to show before account creation. - `"By continuing, you agree to the Terms of Use and acknowledge the Privacy Policy."` - `title: "Choose your username"` Title for the username step. - `"Choose your username"` - `usernamePlaceholder: "Username"` Placeholder for the username field. - `"Username"` - `leadToken: string` Registration token returned by Beeper. - `registrationRequired: true` Indicates that the user needs to create a Beeper account. - `true` - `setupRequestID: string` Setup request ID to use when creating the account. - `usernameSuggestions?: Array` Suggested usernames for the new account. ### Example ```typescript import BeeperDesktop from '@beeper/desktop-api'; const client = new BeeperDesktop(); const response = await client.app.login.response({ response: 'response', setupRequestID: 'setupRequestID', }); console.log(response); ``` #### Response ```json { "matrix": { "accessToken": "accessToken", "deviceID": "deviceID", "homeserver": "homeserver", "userID": "userID" }, "session": { "e2ee": { "crossSigning": true, "firstSyncDone": true, "hasBackedUpRecoveryKey": true, "initialized": true, "keyBackup": true, "secrets": { "masterKey": true, "megolmBackupKey": true, "recoveryKey": true, "selfSigningKey": true, "userSigningKey": true }, "secretStorage": true, "verified": true, "recoveryKeyGeneratedAt": 0 }, "state": "needs-login", "matrix": { "deviceID": "deviceID", "homeserver": "homeserver", "userID": "userID" }, "verification": { "id": "id", "availableActions": [ "accept" ], "direction": "incoming", "methods": [ "qr" ], "purpose": "login", "state": "requested", "error": { "code": "code", "reason": "reason" }, "otherDevice": { "id": "id", "name": "name" }, "otherUserID": "otherUserID", "qr": { "data": "data" }, "sas": { "emojis": "emojis", "decimals": "decimals" } } } } ``` ## Create account for setup `client.app.login.register(LoginRegisterParamsbody, RequestOptionsoptions?): LoginRegisterResponse` **post** `/v1/app/setup/register` Create a Beeper account after the user chooses a username and accepts the Terms of Use. ### Parameters - `body: LoginRegisterParams` - `acceptTerms: true` Confirms that the user agreed to our [terms of use](https://www.beeper.com/terms-onboarding) and has read our [privacy policy](https://www.beeper.com/privacy). - `true` - `leadToken: string` Registration token returned by Beeper. - `setupRequestID: string` Setup request ID returned by the start step. - `username: string` Username selected by the user. ### Returns - `LoginRegisterResponse` - `matrix: Matrix` Account credentials for first-party app setup. - `accessToken: string` Beeper account access token. Returned once for first-party app setup. - `deviceID: string` Current device ID. - `homeserver: string` Beeper homeserver URL for this account. - `userID: string` Signed-in Beeper user ID. - `session: Session` Current app sign-in and encrypted messaging setup state after sign-in. - `e2ee: E2EE` Encrypted messaging setup status. - `crossSigning: boolean` Whether this account can verify trusted devices. - `firstSyncDone: boolean` Whether the first encrypted message sync is complete. - `hasBackedUpRecoveryKey: boolean` Whether the user confirmed that they saved their recovery key. - `initialized: boolean` Whether encrypted messaging setup has started. - `keyBackup: boolean` Whether encrypted message backup is available. - `secrets: Secrets` Encrypted messaging keys available on this device. - `masterKey: boolean` Whether the account identity key is available. - `megolmBackupKey: boolean` Whether the encrypted message backup key is available. - `recoveryKey: boolean` Whether a recovery key is available. - `selfSigningKey: boolean` Whether the device trust key is available. - `userSigningKey: boolean` Whether the user trust key is available. - `secretStorage: boolean` Whether secure key storage is available. - `verified: boolean` Whether this device is trusted for encrypted messages. - `recoveryKeyGeneratedAt?: number` Unix timestamp for when the recovery key was created. - `state: "needs-login" | "initializing" | "needs-cross-signing-setup" | 4 more` Current sign-in and encrypted messaging setup state for Beeper Desktop or Beeper Server. - `"needs-login"` - `"initializing"` - `"needs-cross-signing-setup"` - `"needs-verification"` - `"needs-secrets"` - `"needs-first-sync"` - `"ready"` - `matrix?: Matrix` Signed-in account details. Omitted until sign-in is complete. - `deviceID: string` Current device ID. - `homeserver: string` Beeper homeserver URL for this account. - `userID: string` Signed-in Beeper user ID. - `verification?: Verification` Trusted device verification progress. - `id: string` Verification ID to pass in verification action paths. - `availableActions: Array<"accept" | "cancel" | "qr.confirmScanned" | 2 more>` Verification actions that are valid for the current state. - `"accept"` - `"cancel"` - `"qr.confirmScanned"` - `"sas.start"` - `"sas.confirm"` - `direction: "incoming" | "outgoing"` Whether this device started or received the verification. - `"incoming"` - `"outgoing"` - `methods: Array<"qr" | "sas">` Verification methods supported for this transaction. - `"qr"` - `"sas"` - `purpose: "login" | "device"` Why this verification exists. - `"login"` - `"device"` - `state: "requested" | "ready" | "sas_ready" | 4 more` Current trusted-device verification state. - `"requested"` - `"ready"` - `"sas_ready"` - `"qr_scanned"` - `"done"` - `"cancelled"` - `"error"` - `error?: Error` Verification error details, if verification stopped. - `code: string` Verification error code. - `reason: string` User-facing verification error message. - `otherDevice?: OtherDevice` Other device participating in verification. - `id: string` Other device ID. - `name?: string` Other device display name, if known. - `otherUserID?: string` Other Beeper user participating in verification. - `qr?: Qr` QR verification data. - `data: string` QR code payload to display for verification. - `sas?: SAS` Emoji or number comparison data for verification. - `emojis: string` Emoji sequence to compare on both devices. - `decimals?: string` Number sequence to compare on both devices. ### Example ```typescript import BeeperDesktop from '@beeper/desktop-api'; const client = new BeeperDesktop(); const response = await client.app.login.register({ acceptTerms: true, leadToken: 'leadToken', setupRequestID: 'setupRequestID', username: 'x', }); console.log(response.matrix); ``` #### Response ```json { "matrix": { "accessToken": "accessToken", "deviceID": "deviceID", "homeserver": "homeserver", "userID": "userID" }, "session": { "e2ee": { "crossSigning": true, "firstSyncDone": true, "hasBackedUpRecoveryKey": true, "initialized": true, "keyBackup": true, "secrets": { "masterKey": true, "megolmBackupKey": true, "recoveryKey": true, "selfSigningKey": true, "userSigningKey": true }, "secretStorage": true, "verified": true, "recoveryKeyGeneratedAt": 0 }, "state": "needs-login", "matrix": { "deviceID": "deviceID", "homeserver": "homeserver", "userID": "userID" }, "verification": { "id": "id", "availableActions": [ "accept" ], "direction": "incoming", "methods": [ "qr" ], "purpose": "login", "state": "requested", "error": { "code": "code", "reason": "reason" }, "otherDevice": { "id": "id", "name": "name" }, "otherUserID": "otherUserID", "qr": { "data": "data" }, "sas": { "emojis": "emojis", "decimals": "decimals" } } } } ``` ## Domain Types ### Login Start Response - `LoginStartResponse` - `setupRequestID: string` Setup request ID to use in the next sign-in step. - `signInMethods: Array` Available sign-in methods for this setup request. ### Login Response Response - `LoginResponseResponse = Success | RegistrationRequired` - `Success` - `matrix: Matrix` Account credentials for first-party app setup. - `accessToken: string` Beeper account access token. Returned once for first-party app setup. - `deviceID: string` Current device ID. - `homeserver: string` Beeper homeserver URL for this account. - `userID: string` Signed-in Beeper user ID. - `session: Session` Current app sign-in and encrypted messaging setup state after sign-in. - `e2ee: E2EE` Encrypted messaging setup status. - `crossSigning: boolean` Whether this account can verify trusted devices. - `firstSyncDone: boolean` Whether the first encrypted message sync is complete. - `hasBackedUpRecoveryKey: boolean` Whether the user confirmed that they saved their recovery key. - `initialized: boolean` Whether encrypted messaging setup has started. - `keyBackup: boolean` Whether encrypted message backup is available. - `secrets: Secrets` Encrypted messaging keys available on this device. - `masterKey: boolean` Whether the account identity key is available. - `megolmBackupKey: boolean` Whether the encrypted message backup key is available. - `recoveryKey: boolean` Whether a recovery key is available. - `selfSigningKey: boolean` Whether the device trust key is available. - `userSigningKey: boolean` Whether the user trust key is available. - `secretStorage: boolean` Whether secure key storage is available. - `verified: boolean` Whether this device is trusted for encrypted messages. - `recoveryKeyGeneratedAt?: number` Unix timestamp for when the recovery key was created. - `state: "needs-login" | "initializing" | "needs-cross-signing-setup" | 4 more` Current sign-in and encrypted messaging setup state for Beeper Desktop or Beeper Server. - `"needs-login"` - `"initializing"` - `"needs-cross-signing-setup"` - `"needs-verification"` - `"needs-secrets"` - `"needs-first-sync"` - `"ready"` - `matrix?: Matrix` Signed-in account details. Omitted until sign-in is complete. - `deviceID: string` Current device ID. - `homeserver: string` Beeper homeserver URL for this account. - `userID: string` Signed-in Beeper user ID. - `verification?: Verification` Trusted device verification progress. - `id: string` Verification ID to pass in verification action paths. - `availableActions: Array<"accept" | "cancel" | "qr.confirmScanned" | 2 more>` Verification actions that are valid for the current state. - `"accept"` - `"cancel"` - `"qr.confirmScanned"` - `"sas.start"` - `"sas.confirm"` - `direction: "incoming" | "outgoing"` Whether this device started or received the verification. - `"incoming"` - `"outgoing"` - `methods: Array<"qr" | "sas">` Verification methods supported for this transaction. - `"qr"` - `"sas"` - `purpose: "login" | "device"` Why this verification exists. - `"login"` - `"device"` - `state: "requested" | "ready" | "sas_ready" | 4 more` Current trusted-device verification state. - `"requested"` - `"ready"` - `"sas_ready"` - `"qr_scanned"` - `"done"` - `"cancelled"` - `"error"` - `error?: Error` Verification error details, if verification stopped. - `code: string` Verification error code. - `reason: string` User-facing verification error message. - `otherDevice?: OtherDevice` Other device participating in verification. - `id: string` Other device ID. - `name?: string` Other device display name, if known. - `otherUserID?: string` Other Beeper user participating in verification. - `qr?: Qr` QR verification data. - `data: string` QR code payload to display for verification. - `sas?: SAS` Emoji or number comparison data for verification. - `emojis: string` Emoji sequence to compare on both devices. - `decimals?: string` Number sequence to compare on both devices. - `RegistrationRequired` - `copy: Copy` Copy to display during account creation. - `submit: "Continue"` Submit button label. - `"Continue"` - `terms: "By continuing, you agree to the Terms of Use and acknowledge the Privacy Policy."` Terms and privacy notice to show before account creation. - `"By continuing, you agree to the Terms of Use and acknowledge the Privacy Policy."` - `title: "Choose your username"` Title for the username step. - `"Choose your username"` - `usernamePlaceholder: "Username"` Placeholder for the username field. - `"Username"` - `leadToken: string` Registration token returned by Beeper. - `registrationRequired: true` Indicates that the user needs to create a Beeper account. - `true` - `setupRequestID: string` Setup request ID to use when creating the account. - `usernameSuggestions?: Array` Suggested usernames for the new account. ### Login Register Response - `LoginRegisterResponse` - `matrix: Matrix` Account credentials for first-party app setup. - `accessToken: string` Beeper account access token. Returned once for first-party app setup. - `deviceID: string` Current device ID. - `homeserver: string` Beeper homeserver URL for this account. - `userID: string` Signed-in Beeper user ID. - `session: Session` Current app sign-in and encrypted messaging setup state after sign-in. - `e2ee: E2EE` Encrypted messaging setup status. - `crossSigning: boolean` Whether this account can verify trusted devices. - `firstSyncDone: boolean` Whether the first encrypted message sync is complete. - `hasBackedUpRecoveryKey: boolean` Whether the user confirmed that they saved their recovery key. - `initialized: boolean` Whether encrypted messaging setup has started. - `keyBackup: boolean` Whether encrypted message backup is available. - `secrets: Secrets` Encrypted messaging keys available on this device. - `masterKey: boolean` Whether the account identity key is available. - `megolmBackupKey: boolean` Whether the encrypted message backup key is available. - `recoveryKey: boolean` Whether a recovery key is available. - `selfSigningKey: boolean` Whether the device trust key is available. - `userSigningKey: boolean` Whether the user trust key is available. - `secretStorage: boolean` Whether secure key storage is available. - `verified: boolean` Whether this device is trusted for encrypted messages. - `recoveryKeyGeneratedAt?: number` Unix timestamp for when the recovery key was created. - `state: "needs-login" | "initializing" | "needs-cross-signing-setup" | 4 more` Current sign-in and encrypted messaging setup state for Beeper Desktop or Beeper Server. - `"needs-login"` - `"initializing"` - `"needs-cross-signing-setup"` - `"needs-verification"` - `"needs-secrets"` - `"needs-first-sync"` - `"ready"` - `matrix?: Matrix` Signed-in account details. Omitted until sign-in is complete. - `deviceID: string` Current device ID. - `homeserver: string` Beeper homeserver URL for this account. - `userID: string` Signed-in Beeper user ID. - `verification?: Verification` Trusted device verification progress. - `id: string` Verification ID to pass in verification action paths. - `availableActions: Array<"accept" | "cancel" | "qr.confirmScanned" | 2 more>` Verification actions that are valid for the current state. - `"accept"` - `"cancel"` - `"qr.confirmScanned"` - `"sas.start"` - `"sas.confirm"` - `direction: "incoming" | "outgoing"` Whether this device started or received the verification. - `"incoming"` - `"outgoing"` - `methods: Array<"qr" | "sas">` Verification methods supported for this transaction. - `"qr"` - `"sas"` - `purpose: "login" | "device"` Why this verification exists. - `"login"` - `"device"` - `state: "requested" | "ready" | "sas_ready" | 4 more` Current trusted-device verification state. - `"requested"` - `"ready"` - `"sas_ready"` - `"qr_scanned"` - `"done"` - `"cancelled"` - `"error"` - `error?: Error` Verification error details, if verification stopped. - `code: string` Verification error code. - `reason: string` User-facing verification error message. - `otherDevice?: OtherDevice` Other device participating in verification. - `id: string` Other device ID. - `name?: string` Other device display name, if known. - `otherUserID?: string` Other Beeper user participating in verification. - `qr?: Qr` QR verification data. - `data: string` QR code payload to display for verification. - `sas?: SAS` Emoji or number comparison data for verification. - `emojis: string` Emoji sequence to compare on both devices. - `decimals?: string` Number sequence to compare on both devices. # Verification # Recovery Key ## Verify with recovery key `client.app.login.verification.recoveryKey.verify(RecoveryKeyVerifyParamsbody, RequestOptionsoptions?): RecoveryKeyVerifyResponse` **post** `/v1/app/setup/verification/recovery-key` Unlock encrypted messages with the user recovery key. ### Parameters - `body: RecoveryKeyVerifyParams` - `recoveryKey: string` Recovery key saved by the user. ### Returns - `RecoveryKeyVerifyResponse` - `session: Session` Current app sign-in and encrypted messaging setup state. - `e2ee: E2EE` Encrypted messaging setup status. - `crossSigning: boolean` Whether this account can verify trusted devices. - `firstSyncDone: boolean` Whether the first encrypted message sync is complete. - `hasBackedUpRecoveryKey: boolean` Whether the user confirmed that they saved their recovery key. - `initialized: boolean` Whether encrypted messaging setup has started. - `keyBackup: boolean` Whether encrypted message backup is available. - `secrets: Secrets` Encrypted messaging keys available on this device. - `masterKey: boolean` Whether the account identity key is available. - `megolmBackupKey: boolean` Whether the encrypted message backup key is available. - `recoveryKey: boolean` Whether a recovery key is available. - `selfSigningKey: boolean` Whether the device trust key is available. - `userSigningKey: boolean` Whether the user trust key is available. - `secretStorage: boolean` Whether secure key storage is available. - `verified: boolean` Whether this device is trusted for encrypted messages. - `recoveryKeyGeneratedAt?: number` Unix timestamp for when the recovery key was created. - `state: "needs-login" | "initializing" | "needs-cross-signing-setup" | 4 more` Current sign-in and encrypted messaging setup state for Beeper Desktop or Beeper Server. - `"needs-login"` - `"initializing"` - `"needs-cross-signing-setup"` - `"needs-verification"` - `"needs-secrets"` - `"needs-first-sync"` - `"ready"` - `matrix?: Matrix` Signed-in account details. Omitted until sign-in is complete. - `deviceID: string` Current device ID. - `homeserver: string` Beeper homeserver URL for this account. - `userID: string` Signed-in Beeper user ID. - `verification?: Verification` Trusted device verification progress. - `id: string` Verification ID to pass in verification action paths. - `availableActions: Array<"accept" | "cancel" | "qr.confirmScanned" | 2 more>` Verification actions that are valid for the current state. - `"accept"` - `"cancel"` - `"qr.confirmScanned"` - `"sas.start"` - `"sas.confirm"` - `direction: "incoming" | "outgoing"` Whether this device started or received the verification. - `"incoming"` - `"outgoing"` - `methods: Array<"qr" | "sas">` Verification methods supported for this transaction. - `"qr"` - `"sas"` - `purpose: "login" | "device"` Why this verification exists. - `"login"` - `"device"` - `state: "requested" | "ready" | "sas_ready" | 4 more` Current trusted-device verification state. - `"requested"` - `"ready"` - `"sas_ready"` - `"qr_scanned"` - `"done"` - `"cancelled"` - `"error"` - `error?: Error` Verification error details, if verification stopped. - `code: string` Verification error code. - `reason: string` User-facing verification error message. - `otherDevice?: OtherDevice` Other device participating in verification. - `id: string` Other device ID. - `name?: string` Other device display name, if known. - `otherUserID?: string` Other Beeper user participating in verification. - `qr?: Qr` QR verification data. - `data: string` QR code payload to display for verification. - `sas?: SAS` Emoji or number comparison data for verification. - `emojis: string` Emoji sequence to compare on both devices. - `decimals?: string` Number sequence to compare on both devices. ### Example ```typescript import BeeperDesktop from '@beeper/desktop-api'; const client = new BeeperDesktop({ accessToken: process.env['BEEPER_ACCESS_TOKEN'], // This is the default and can be omitted }); const response = await client.app.login.verification.recoveryKey.verify({ recoveryKey: 'x' }); console.log(response.session); ``` #### Response ```json { "session": { "e2ee": { "crossSigning": true, "firstSyncDone": true, "hasBackedUpRecoveryKey": true, "initialized": true, "keyBackup": true, "secrets": { "masterKey": true, "megolmBackupKey": true, "recoveryKey": true, "selfSigningKey": true, "userSigningKey": true }, "secretStorage": true, "verified": true, "recoveryKeyGeneratedAt": 0 }, "state": "needs-login", "matrix": { "deviceID": "deviceID", "homeserver": "homeserver", "userID": "userID" }, "verification": { "id": "id", "availableActions": [ "accept" ], "direction": "incoming", "methods": [ "qr" ], "purpose": "login", "state": "requested", "error": { "code": "code", "reason": "reason" }, "otherDevice": { "id": "id", "name": "name" }, "otherUserID": "otherUserID", "qr": { "data": "data" }, "sas": { "emojis": "emojis", "decimals": "decimals" } } } } ``` ## Domain Types ### Recovery Key Verify Response - `RecoveryKeyVerifyResponse` - `session: Session` Current app sign-in and encrypted messaging setup state. - `e2ee: E2EE` Encrypted messaging setup status. - `crossSigning: boolean` Whether this account can verify trusted devices. - `firstSyncDone: boolean` Whether the first encrypted message sync is complete. - `hasBackedUpRecoveryKey: boolean` Whether the user confirmed that they saved their recovery key. - `initialized: boolean` Whether encrypted messaging setup has started. - `keyBackup: boolean` Whether encrypted message backup is available. - `secrets: Secrets` Encrypted messaging keys available on this device. - `masterKey: boolean` Whether the account identity key is available. - `megolmBackupKey: boolean` Whether the encrypted message backup key is available. - `recoveryKey: boolean` Whether a recovery key is available. - `selfSigningKey: boolean` Whether the device trust key is available. - `userSigningKey: boolean` Whether the user trust key is available. - `secretStorage: boolean` Whether secure key storage is available. - `verified: boolean` Whether this device is trusted for encrypted messages. - `recoveryKeyGeneratedAt?: number` Unix timestamp for when the recovery key was created. - `state: "needs-login" | "initializing" | "needs-cross-signing-setup" | 4 more` Current sign-in and encrypted messaging setup state for Beeper Desktop or Beeper Server. - `"needs-login"` - `"initializing"` - `"needs-cross-signing-setup"` - `"needs-verification"` - `"needs-secrets"` - `"needs-first-sync"` - `"ready"` - `matrix?: Matrix` Signed-in account details. Omitted until sign-in is complete. - `deviceID: string` Current device ID. - `homeserver: string` Beeper homeserver URL for this account. - `userID: string` Signed-in Beeper user ID. - `verification?: Verification` Trusted device verification progress. - `id: string` Verification ID to pass in verification action paths. - `availableActions: Array<"accept" | "cancel" | "qr.confirmScanned" | 2 more>` Verification actions that are valid for the current state. - `"accept"` - `"cancel"` - `"qr.confirmScanned"` - `"sas.start"` - `"sas.confirm"` - `direction: "incoming" | "outgoing"` Whether this device started or received the verification. - `"incoming"` - `"outgoing"` - `methods: Array<"qr" | "sas">` Verification methods supported for this transaction. - `"qr"` - `"sas"` - `purpose: "login" | "device"` Why this verification exists. - `"login"` - `"device"` - `state: "requested" | "ready" | "sas_ready" | 4 more` Current trusted-device verification state. - `"requested"` - `"ready"` - `"sas_ready"` - `"qr_scanned"` - `"done"` - `"cancelled"` - `"error"` - `error?: Error` Verification error details, if verification stopped. - `code: string` Verification error code. - `reason: string` User-facing verification error message. - `otherDevice?: OtherDevice` Other device participating in verification. - `id: string` Other device ID. - `name?: string` Other device display name, if known. - `otherUserID?: string` Other Beeper user participating in verification. - `qr?: Qr` QR verification data. - `data: string` QR code payload to display for verification. - `sas?: SAS` Emoji or number comparison data for verification. - `emojis: string` Emoji sequence to compare on both devices. - `decimals?: string` Number sequence to compare on both devices. # Reset ## Create new recovery key `client.app.login.verification.recoveryKey.reset.create(ResetCreateParamsbody?, RequestOptionsoptions?): ResetCreateResponse` **post** `/v1/app/setup/verification/recovery-key/reset` Create a new recovery key when the user cannot use the existing one. ### Parameters - `body: ResetCreateParams` - `existingRecoveryKey?: string` Existing recovery key, if the user has it. ### Returns - `ResetCreateResponse` - `recoveryKey: string` New recovery key. Show it once and ask the user to save it. - `session: Session` Current app sign-in and encrypted messaging setup state after creating the new recovery key. - `e2ee: E2EE` Encrypted messaging setup status. - `crossSigning: boolean` Whether this account can verify trusted devices. - `firstSyncDone: boolean` Whether the first encrypted message sync is complete. - `hasBackedUpRecoveryKey: boolean` Whether the user confirmed that they saved their recovery key. - `initialized: boolean` Whether encrypted messaging setup has started. - `keyBackup: boolean` Whether encrypted message backup is available. - `secrets: Secrets` Encrypted messaging keys available on this device. - `masterKey: boolean` Whether the account identity key is available. - `megolmBackupKey: boolean` Whether the encrypted message backup key is available. - `recoveryKey: boolean` Whether a recovery key is available. - `selfSigningKey: boolean` Whether the device trust key is available. - `userSigningKey: boolean` Whether the user trust key is available. - `secretStorage: boolean` Whether secure key storage is available. - `verified: boolean` Whether this device is trusted for encrypted messages. - `recoveryKeyGeneratedAt?: number` Unix timestamp for when the recovery key was created. - `state: "needs-login" | "initializing" | "needs-cross-signing-setup" | 4 more` Current sign-in and encrypted messaging setup state for Beeper Desktop or Beeper Server. - `"needs-login"` - `"initializing"` - `"needs-cross-signing-setup"` - `"needs-verification"` - `"needs-secrets"` - `"needs-first-sync"` - `"ready"` - `matrix?: Matrix` Signed-in account details. Omitted until sign-in is complete. - `deviceID: string` Current device ID. - `homeserver: string` Beeper homeserver URL for this account. - `userID: string` Signed-in Beeper user ID. - `verification?: Verification` Trusted device verification progress. - `id: string` Verification ID to pass in verification action paths. - `availableActions: Array<"accept" | "cancel" | "qr.confirmScanned" | 2 more>` Verification actions that are valid for the current state. - `"accept"` - `"cancel"` - `"qr.confirmScanned"` - `"sas.start"` - `"sas.confirm"` - `direction: "incoming" | "outgoing"` Whether this device started or received the verification. - `"incoming"` - `"outgoing"` - `methods: Array<"qr" | "sas">` Verification methods supported for this transaction. - `"qr"` - `"sas"` - `purpose: "login" | "device"` Why this verification exists. - `"login"` - `"device"` - `state: "requested" | "ready" | "sas_ready" | 4 more` Current trusted-device verification state. - `"requested"` - `"ready"` - `"sas_ready"` - `"qr_scanned"` - `"done"` - `"cancelled"` - `"error"` - `error?: Error` Verification error details, if verification stopped. - `code: string` Verification error code. - `reason: string` User-facing verification error message. - `otherDevice?: OtherDevice` Other device participating in verification. - `id: string` Other device ID. - `name?: string` Other device display name, if known. - `otherUserID?: string` Other Beeper user participating in verification. - `qr?: Qr` QR verification data. - `data: string` QR code payload to display for verification. - `sas?: SAS` Emoji or number comparison data for verification. - `emojis: string` Emoji sequence to compare on both devices. - `decimals?: string` Number sequence to compare on both devices. ### Example ```typescript import BeeperDesktop from '@beeper/desktop-api'; const client = new BeeperDesktop({ accessToken: process.env['BEEPER_ACCESS_TOKEN'], // This is the default and can be omitted }); const reset = await client.app.login.verification.recoveryKey.reset.create(); console.log(reset.recoveryKey); ``` #### Response ```json { "recoveryKey": "recoveryKey", "session": { "e2ee": { "crossSigning": true, "firstSyncDone": true, "hasBackedUpRecoveryKey": true, "initialized": true, "keyBackup": true, "secrets": { "masterKey": true, "megolmBackupKey": true, "recoveryKey": true, "selfSigningKey": true, "userSigningKey": true }, "secretStorage": true, "verified": true, "recoveryKeyGeneratedAt": 0 }, "state": "needs-login", "matrix": { "deviceID": "deviceID", "homeserver": "homeserver", "userID": "userID" }, "verification": { "id": "id", "availableActions": [ "accept" ], "direction": "incoming", "methods": [ "qr" ], "purpose": "login", "state": "requested", "error": { "code": "code", "reason": "reason" }, "otherDevice": { "id": "id", "name": "name" }, "otherUserID": "otherUserID", "qr": { "data": "data" }, "sas": { "emojis": "emojis", "decimals": "decimals" } } } } ``` ## Confirm new recovery key `client.app.login.verification.recoveryKey.reset.confirm(ResetConfirmParamsbody, RequestOptionsoptions?): ResetConfirmResponse` **post** `/v1/app/setup/verification/recovery-key/reset/confirm` Confirm that the new recovery key should be used for this account. ### Parameters - `body: ResetConfirmParams` - `recoveryKey: string` New recovery key returned by the reset step. ### Returns - `ResetConfirmResponse` - `session: Session` Current app sign-in and encrypted messaging setup state. - `e2ee: E2EE` Encrypted messaging setup status. - `crossSigning: boolean` Whether this account can verify trusted devices. - `firstSyncDone: boolean` Whether the first encrypted message sync is complete. - `hasBackedUpRecoveryKey: boolean` Whether the user confirmed that they saved their recovery key. - `initialized: boolean` Whether encrypted messaging setup has started. - `keyBackup: boolean` Whether encrypted message backup is available. - `secrets: Secrets` Encrypted messaging keys available on this device. - `masterKey: boolean` Whether the account identity key is available. - `megolmBackupKey: boolean` Whether the encrypted message backup key is available. - `recoveryKey: boolean` Whether a recovery key is available. - `selfSigningKey: boolean` Whether the device trust key is available. - `userSigningKey: boolean` Whether the user trust key is available. - `secretStorage: boolean` Whether secure key storage is available. - `verified: boolean` Whether this device is trusted for encrypted messages. - `recoveryKeyGeneratedAt?: number` Unix timestamp for when the recovery key was created. - `state: "needs-login" | "initializing" | "needs-cross-signing-setup" | 4 more` Current sign-in and encrypted messaging setup state for Beeper Desktop or Beeper Server. - `"needs-login"` - `"initializing"` - `"needs-cross-signing-setup"` - `"needs-verification"` - `"needs-secrets"` - `"needs-first-sync"` - `"ready"` - `matrix?: Matrix` Signed-in account details. Omitted until sign-in is complete. - `deviceID: string` Current device ID. - `homeserver: string` Beeper homeserver URL for this account. - `userID: string` Signed-in Beeper user ID. - `verification?: Verification` Trusted device verification progress. - `id: string` Verification ID to pass in verification action paths. - `availableActions: Array<"accept" | "cancel" | "qr.confirmScanned" | 2 more>` Verification actions that are valid for the current state. - `"accept"` - `"cancel"` - `"qr.confirmScanned"` - `"sas.start"` - `"sas.confirm"` - `direction: "incoming" | "outgoing"` Whether this device started or received the verification. - `"incoming"` - `"outgoing"` - `methods: Array<"qr" | "sas">` Verification methods supported for this transaction. - `"qr"` - `"sas"` - `purpose: "login" | "device"` Why this verification exists. - `"login"` - `"device"` - `state: "requested" | "ready" | "sas_ready" | 4 more` Current trusted-device verification state. - `"requested"` - `"ready"` - `"sas_ready"` - `"qr_scanned"` - `"done"` - `"cancelled"` - `"error"` - `error?: Error` Verification error details, if verification stopped. - `code: string` Verification error code. - `reason: string` User-facing verification error message. - `otherDevice?: OtherDevice` Other device participating in verification. - `id: string` Other device ID. - `name?: string` Other device display name, if known. - `otherUserID?: string` Other Beeper user participating in verification. - `qr?: Qr` QR verification data. - `data: string` QR code payload to display for verification. - `sas?: SAS` Emoji or number comparison data for verification. - `emojis: string` Emoji sequence to compare on both devices. - `decimals?: string` Number sequence to compare on both devices. ### Example ```typescript import BeeperDesktop from '@beeper/desktop-api'; const client = new BeeperDesktop({ accessToken: process.env['BEEPER_ACCESS_TOKEN'], // This is the default and can be omitted }); const response = await client.app.login.verification.recoveryKey.reset.confirm({ recoveryKey: 'x', }); console.log(response.session); ``` #### Response ```json { "session": { "e2ee": { "crossSigning": true, "firstSyncDone": true, "hasBackedUpRecoveryKey": true, "initialized": true, "keyBackup": true, "secrets": { "masterKey": true, "megolmBackupKey": true, "recoveryKey": true, "selfSigningKey": true, "userSigningKey": true }, "secretStorage": true, "verified": true, "recoveryKeyGeneratedAt": 0 }, "state": "needs-login", "matrix": { "deviceID": "deviceID", "homeserver": "homeserver", "userID": "userID" }, "verification": { "id": "id", "availableActions": [ "accept" ], "direction": "incoming", "methods": [ "qr" ], "purpose": "login", "state": "requested", "error": { "code": "code", "reason": "reason" }, "otherDevice": { "id": "id", "name": "name" }, "otherUserID": "otherUserID", "qr": { "data": "data" }, "sas": { "emojis": "emojis", "decimals": "decimals" } } } } ``` ## Domain Types ### Reset Create Response - `ResetCreateResponse` - `recoveryKey: string` New recovery key. Show it once and ask the user to save it. - `session: Session` Current app sign-in and encrypted messaging setup state after creating the new recovery key. - `e2ee: E2EE` Encrypted messaging setup status. - `crossSigning: boolean` Whether this account can verify trusted devices. - `firstSyncDone: boolean` Whether the first encrypted message sync is complete. - `hasBackedUpRecoveryKey: boolean` Whether the user confirmed that they saved their recovery key. - `initialized: boolean` Whether encrypted messaging setup has started. - `keyBackup: boolean` Whether encrypted message backup is available. - `secrets: Secrets` Encrypted messaging keys available on this device. - `masterKey: boolean` Whether the account identity key is available. - `megolmBackupKey: boolean` Whether the encrypted message backup key is available. - `recoveryKey: boolean` Whether a recovery key is available. - `selfSigningKey: boolean` Whether the device trust key is available. - `userSigningKey: boolean` Whether the user trust key is available. - `secretStorage: boolean` Whether secure key storage is available. - `verified: boolean` Whether this device is trusted for encrypted messages. - `recoveryKeyGeneratedAt?: number` Unix timestamp for when the recovery key was created. - `state: "needs-login" | "initializing" | "needs-cross-signing-setup" | 4 more` Current sign-in and encrypted messaging setup state for Beeper Desktop or Beeper Server. - `"needs-login"` - `"initializing"` - `"needs-cross-signing-setup"` - `"needs-verification"` - `"needs-secrets"` - `"needs-first-sync"` - `"ready"` - `matrix?: Matrix` Signed-in account details. Omitted until sign-in is complete. - `deviceID: string` Current device ID. - `homeserver: string` Beeper homeserver URL for this account. - `userID: string` Signed-in Beeper user ID. - `verification?: Verification` Trusted device verification progress. - `id: string` Verification ID to pass in verification action paths. - `availableActions: Array<"accept" | "cancel" | "qr.confirmScanned" | 2 more>` Verification actions that are valid for the current state. - `"accept"` - `"cancel"` - `"qr.confirmScanned"` - `"sas.start"` - `"sas.confirm"` - `direction: "incoming" | "outgoing"` Whether this device started or received the verification. - `"incoming"` - `"outgoing"` - `methods: Array<"qr" | "sas">` Verification methods supported for this transaction. - `"qr"` - `"sas"` - `purpose: "login" | "device"` Why this verification exists. - `"login"` - `"device"` - `state: "requested" | "ready" | "sas_ready" | 4 more` Current trusted-device verification state. - `"requested"` - `"ready"` - `"sas_ready"` - `"qr_scanned"` - `"done"` - `"cancelled"` - `"error"` - `error?: Error` Verification error details, if verification stopped. - `code: string` Verification error code. - `reason: string` User-facing verification error message. - `otherDevice?: OtherDevice` Other device participating in verification. - `id: string` Other device ID. - `name?: string` Other device display name, if known. - `otherUserID?: string` Other Beeper user participating in verification. - `qr?: Qr` QR verification data. - `data: string` QR code payload to display for verification. - `sas?: SAS` Emoji or number comparison data for verification. - `emojis: string` Emoji sequence to compare on both devices. - `decimals?: string` Number sequence to compare on both devices. ### Reset Confirm Response - `ResetConfirmResponse` - `session: Session` Current app sign-in and encrypted messaging setup state. - `e2ee: E2EE` Encrypted messaging setup status. - `crossSigning: boolean` Whether this account can verify trusted devices. - `firstSyncDone: boolean` Whether the first encrypted message sync is complete. - `hasBackedUpRecoveryKey: boolean` Whether the user confirmed that they saved their recovery key. - `initialized: boolean` Whether encrypted messaging setup has started. - `keyBackup: boolean` Whether encrypted message backup is available. - `secrets: Secrets` Encrypted messaging keys available on this device. - `masterKey: boolean` Whether the account identity key is available. - `megolmBackupKey: boolean` Whether the encrypted message backup key is available. - `recoveryKey: boolean` Whether a recovery key is available. - `selfSigningKey: boolean` Whether the device trust key is available. - `userSigningKey: boolean` Whether the user trust key is available. - `secretStorage: boolean` Whether secure key storage is available. - `verified: boolean` Whether this device is trusted for encrypted messages. - `recoveryKeyGeneratedAt?: number` Unix timestamp for when the recovery key was created. - `state: "needs-login" | "initializing" | "needs-cross-signing-setup" | 4 more` Current sign-in and encrypted messaging setup state for Beeper Desktop or Beeper Server. - `"needs-login"` - `"initializing"` - `"needs-cross-signing-setup"` - `"needs-verification"` - `"needs-secrets"` - `"needs-first-sync"` - `"ready"` - `matrix?: Matrix` Signed-in account details. Omitted until sign-in is complete. - `deviceID: string` Current device ID. - `homeserver: string` Beeper homeserver URL for this account. - `userID: string` Signed-in Beeper user ID. - `verification?: Verification` Trusted device verification progress. - `id: string` Verification ID to pass in verification action paths. - `availableActions: Array<"accept" | "cancel" | "qr.confirmScanned" | 2 more>` Verification actions that are valid for the current state. - `"accept"` - `"cancel"` - `"qr.confirmScanned"` - `"sas.start"` - `"sas.confirm"` - `direction: "incoming" | "outgoing"` Whether this device started or received the verification. - `"incoming"` - `"outgoing"` - `methods: Array<"qr" | "sas">` Verification methods supported for this transaction. - `"qr"` - `"sas"` - `purpose: "login" | "device"` Why this verification exists. - `"login"` - `"device"` - `state: "requested" | "ready" | "sas_ready" | 4 more` Current trusted-device verification state. - `"requested"` - `"ready"` - `"sas_ready"` - `"qr_scanned"` - `"done"` - `"cancelled"` - `"error"` - `error?: Error` Verification error details, if verification stopped. - `code: string` Verification error code. - `reason: string` User-facing verification error message. - `otherDevice?: OtherDevice` Other device participating in verification. - `id: string` Other device ID. - `name?: string` Other device display name, if known. - `otherUserID?: string` Other Beeper user participating in verification. - `qr?: Qr` QR verification data. - `data: string` QR code payload to display for verification. - `sas?: SAS` Emoji or number comparison data for verification. - `emojis: string` Emoji sequence to compare on both devices. - `decimals?: string` Number sequence to compare on both devices.