TypeScript Server SDK
Node.js / server SDK for Partner 2FA and OAuth Verify. Holds secret credentials; never use in the browser.
On this page
Installation
Package @keyra/typescript-sdk · version 0.1.0 (from package metadata).
npm install git+https://github.com/Ciright-Inc/keyra-typescript-sdk.gitRuntime
SERVER
Products supported
Method groups
Client Setup
createKeyraServer()— Creates an OAuth Verify helper object: createVerification, exchangeAuthorizationCode, getOAuthUserInfo, validateVerifica…createKeyraPartner2FA()— Creates a Partner 2FA client bound to projectId and secret credentials. Run only on your server.
Authorization
createVerification()— Starts OAuth Verify via POST /verify/start (default scope verify). Returned on createKeyraServer().
Token Exchange
exchangeAuthorizationCode()— Exchanges authorization code + PKCE verifier for access_token. Use access_token as verification_token for validateVerifi…
PKCE
generatePkce()— Synchronously generates PKCE S256 verifier/challenge using Node crypto.
User Information
getOAuthUserInfo()— GET /oauth/userinfo with Bearer access_token. Optional — validate remains the trust boundary.
Validation
validateVerification()— One-shot server validation. Pass access_token as verification_token. Replay returns already-used errors.
Verification
consumeChallenge()— Consumes the one-time verificationToken. After success, create your application session — KEYRA does not.
Management
disable2FA()— Revokes the identity after resolving identityId from get2FAStatus.
Enrollment
enable2FA()— Starts enrollment and returns enrollmentUrl. The SDK also exposes qrCode as an alias of enrollmentUrl (URL string, not a…get2FAStatus()— Returns whether the partner user is enrolled for KEYRA Partner 2FA.pollEnrollment()— Single poll of enrollment status. Prefer waitForEnrollment for the common loop.waitForEnrollment()— Polls enrollment until completed or a terminal failure/timeout.
Recovery
generateRecoveryCodes()— Rotates and returns recovery codes for the identity.recoverIdentity()— Starts recovery for an enrolled identity (resolves identityId via get2FAStatus).
Authentication
pollChallenge()— Single challenge poll. When status is approved, verificationToken is returned once — capture it immediately.startAuthentication()— Creates an authentication challenge for an enrolled identity. Present challengeUrl (qrCode alias) to the user.waitForChallengeApproval()— Polls until approved with verificationToken, or denied/expired/timeout. Returns the poll result including the one-shot t…
