Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.quepass.com/llms.txt

Use this file to discover all available pages before exploring further.

1. Init

Quepass.init() is the first call your application must make. It authenticates the operator channel, completes the RSA handshake with the backend, and stores a session token for all subsequent API calls. The Quepass Agent Kiosk calls init() on the Welcome page every time the user returns to the home route or the page regains visibility.

a. Function

Quepass.init({
  email: string;
  password: string;
  channelId: string;
  baseUrl: string;
});

b. Init Parameters

ParameterTypeRequiredDescription
emailstringYesOperator email address registered with Quepass.
passwordstringYesOperator password.
channelIdstringYesChannel identifier issued by the Quepass team.
baseUrlstringYesRoot URL of the Quepass backend — no trailing slash.

c. Init Response

Required Parameters

  • email (string) – Operator email address registered with Quepass
  • password (string) – Operator password
  • channelId (string) – Channel identifier issued by the Quepass team
  • baseUrl (string) – Root URL of the Quepass backend (no trailing slash)

1. Success

Return Parameters

  • sessionId (string) – Unique identifier for the user session
  • token (string) – Authentication token for API access

Code Example

// Success
{
  "code": 200,
  "data": {
    "sessionId": "string",
    "token": "string"
  }
}

2. Failure

Return Parameters

  • code (number) – HTTP or API error code
  • errors (array) – List of error objects
    • code (string/number) – Error code identifier
    • message (string) – Detailed error description

Code Example

// Failure
{
  "code": "number",
  "errors": [
    {
      "code": "string | number",
      "message": "string"
    }
  ]
}

d. SDK Capabilities (Optional)

Use Quepass.getSdkCapabilities() to retrieve SDK metadata such as version details and device information.

Required Parameters

  • Empty

Return Parameters

data (object) – Object containing SDK metadata:
  • version (string) – SDK version
  • supportedPlatformVersion (object) – Supported browser versions:
    • minimum (string) – Minimum supported browser versions (e.g., "Chrome 90, Firefox 88, Safari 14, Edge 90")
    • maximum (string) – Maximum supported browser versions (e.g., "Latest")
  • apiVersion (array of strings) – Supported API versions
  • deviceInfo (object) – Device details:
    • model (string) – Device model
    • manufacturer (string) – Device manufacturer

Code Example

Quepass.getSdkCapabilities((success, data) => {
  if (success && data) {
    const version = data.version;
    const minPlatform = data.supportedPlatformVersion.minimum;
    const maxPlatform = data.supportedPlatformVersion.maximum;
    const apiVersions = data.apiVersion;
    const deviceModel = data.deviceInfo.model;
    const deviceManufacturer = data.deviceInfo.manufacturer;
  }
});

2. Configuration

Required Parameters

  • Empty

Return Parameters

  • s_SessionTimeout (number|string) – session timeout duration
  • onboardingFlow (object|array) – configuration for onboarding flow
  • verificationFlow (object|array) – configuration for verification flow
  • govIntegration (boolean) – government integration enabled or not
  • allowedJourneys (array of strings) – list of allowed journeys

Code Example

// Fetch channel configuration
    const config = await Quepass.getConfigurations();

3. Code Example  (Welcome.tsx)

The reference app calls init() then immediately calls getConfigurations():
import { Quepass } from '@quepass/sdk';

const initializeSdk = async (formData, themeMode = 'light') => {
  // 1. Apply theme before init (optional)
  Quepass.setTheme({ mode: themeMode });

  // 2. Initialize
  const initResponse = await Quepass.init(
    formData.email,
    formData.password,
    formData.channel,    // channelId
    formData.baseUrl
  );

  if (initResponse?.code === 200) {
    // 3. Fetch channel configuration
    const config = await Quepass.getConfigurations();

    if (config?.code === 200) {
      const data = config.data;

      // Store session expiry
      const expiry = Date.now() + Number(data.s_SessionTimeout) * 60_000;
      sessionStorage.setItem('sessionExpiration', expiry.toString());

      // Persist configuration for use across routes
      localStorage.setItem('configuration', JSON.stringify(data));

      // Gate feature buttons by allowed journeys
      const allowedJourneys = data.allowedJourneys as string[];
      setAllowedJourneys(allowedJourneys);
      setIsDisabled(false);   // unlock UI
    } else {
      setInitError(config?.errors?.[0]?.message ?? 'Failed to get configurations');
    }
  } else if (initResponse?.code === 401) {
    setInitError(initResponse?.errors?.[0]?.message ?? 'Authentication failed.');
  } else {
    setInitError(initResponse?.errors?.[0]?.message ?? 'Initialization failed.');
  }
};
sessionStorage is cleared before each re-initialization to ensure the old session token is not reused.