threshold1

Device Recognition

Used together, in direct response to a real user tap — see Core Concepts → Passkey-first & smart fallback for the full three-state model these two complete.

Generated directly from @threshold1/auth@0.3.0 — the real, currently-installed package, not hand-typed. Regenerated on every build; if this page and the actual SDK ever disagree, the SDK is right and this page needs a rebuild, not an edit.

Methods

confirmDeviceSend()

confirmDeviceSend(): Promise<{
  maskedIdentifier: string;
}>;

State B, step 2: send a code to the recognized device's enrolled fallback identifier. Only call this in direct response to the user tapping a confirm UI you showed after login() returned { status: "confirm_required", maskedIdentifier } — never call it automatically.

Returns

Promise<{ maskedIdentifier: string; }>

The masked identifier the code was sent to, e.g. "h••••••@gmail.com"

Throws

if there is no recognized device (call login() first)


verifyDeviceCode()

verifyDeviceCode(code): Promise<UserProfile>;

State B, step 3: verify the code the user entered after confirmDeviceSend(). The real identifier is never sent to or known by the client — resolved server-side from the device token alone.

Fires auth.onAfterAuth("otp") on success, like every other successful auth path.

Parameters

code

string

The 6-digit code entered by the user

Returns

Promise<UserProfile>

The authenticated user profile

Throws

if there is no recognized device

Types

DeviceRecognitionCheckResult

type DeviceRecognitionCheckResult = 
  | {
  state: "A";
}
  | {
  channel: "otp";
  maskedIdentifier: string;
  state: "B";
};