ping-identity
    Preparing search index...

    Type Alias OathClient

    Native-backed OATH client handle returned by createOathClient.

    The client holds a reference to a native OATH session. Call close when the client is no longer needed to release native resources. Any method called after close() will throw an OathError with error: 'OATH_STATE_ERROR'.

    const client = await createOathClient();
    try {
    const credentials = await client.getCredentials();
    console.log('Stored credentials:', credentials.length);
    } finally {
    await client.close();
    }
    type OathClient = {
        addCredentialFromUri(uri: string): Promise<OathCredential>;
        close(): Promise<void>;
        deleteCredential(credentialId: string): Promise<boolean>;
        generateCode(credentialId: string): Promise<string>;
        generateCodeWithValidity(credentialId: string): Promise<OathCodeInfo>;
        getCredential(credentialId: string): Promise<OathCredential>;
        getCredentials(): Promise<OathCredential[]>;
        saveCredential(credential: OathCredential): Promise<OathCredential>;
    }
    Index

    Methods

    • Parse an otpauth:// URI and register the credential in the native store.

      Parameters

      • uri: string

        The URI string encoding the credential.

      Returns Promise<OathCredential>

      A promise that resolves to the newly created OathCredential.

      OathError when the URI is invalid or a duplicate credential exists.

      Both otpauth:// and mfauth:// URIs are accepted directly by this method and parsed by the native SDK. The mfauth:// scheme uses the same query parameters as otpauth:// (e.g. secret, algorithm, digits, period) — pass the raw URI and the native SDK will extract the OATH credential.

    • Release all resources held by the native OATH client.

      Returns Promise<void>

      A promise that resolves when the client has been closed.

      After this call, any method invocation on this client will throw an OathError with error: 'OATH_STATE_ERROR'.

      OathError when native cleanup fails.

    • Remove a credential from the native OATH store.

      Parameters

      • credentialId: string

        Unique identifier for the credential to delete.

      Returns Promise<boolean>

      A promise that resolves to true when deletion succeeded.

      OathError when the credential is not found or deletion fails.

    • Generate a one-time password for a credential.

      Parameters

      • credentialId: string

        Unique identifier for the credential.

      Returns Promise<string>

      A promise that resolves to the OTP string.

      OathError when the credential is locked or code generation fails.