Synq Docs
SDK reference

@synqauth/plugin-passkey

A Synq plugin for passkeys from your own UI.

@synqauth/plugin-passkey

call

Function. Calls the mount and reads its JSON; a problem it answers, or no answer, is the result's error.

function call<T>(request: MountRequest, path: string, init?: RequestInit | undefined): Promise<PasskeyResult<T>>

MountRequest

Type. Calls the app's route mount, from its own page: what

type MountRequest = (path: string, init?: RequestInit) => Promise<Response>;

Passkey

Type. A passkey of the signed-in person's, as the account API lists it.

type Passkey = AccountComponents['schemas']['Passkey'];

PASSKEY_PLUGIN_ID

Constant. The plugin's id: its actions are under it in usePlugin and the mount's plugin list.

const PASSKEY_PLUGIN_ID: "passkey"

PasskeyActions

Interface. What the passkey plugin does from the page: where to send the person, and their passkeys.

interface PasskeyActions {
    signIn: (options?: {
        returnTo?: string;
        loginHint?: string;
    }) => Promise<PasskeyResult<PasskeySignIn>>;
    signInUrl: (options?: {
        returnTo?: string;
        loginHint?: string;
    }) => string;
    addUrl: (options?: {
        returnTo?: string;
    }) => string;
    list: () => Promise<PasskeyResult<readonly Passkey[]>>;
    remove: (id: string) => Promise<PasskeyResult<null>>;
}

passkeyPlugin

Function. The passkey plugin: sign-in and adding a passkey at the brand's issuer, and the person's passkeys through the route mount.

function passkeyPlugin(options?: PasskeyPluginOptions): PasskeyPlugin

PasskeyPlugin

Interface. The passkey plugin, in SynqClientPlugin's shape: for <SynqProvider plugins> or @synqauth/nextjs/client.

interface PasskeyPlugin {
    readonly id: typeof PASSKEY_PLUGIN_ID;
    actions: (request: MountRequest) => PasskeyActions;
}

PasskeyPluginOptions

Interface. What passkeyPlugin() takes.

interface PasskeyPluginOptions {
    basePath?: string;
}

PasskeyResult

Type. A call's outcome: its data, or the SynqError it failed with.

type PasskeyResult<T> = {
    readonly data: T;
    readonly error: null;
} | {
    readonly data: null;
    readonly error: SynqError;
};

PasskeySignIn

Type. How signIn() went: signed in on the page, or the hosted page to go to.

type PasskeySignIn = {
    readonly signedIn: true;
    readonly returnTo: string;
} | {
    readonly signedIn: false;
    readonly url: string;
};

See every package.

On this page