akiles-cordova
    Preparing search index...

    Interface Akiles

    Cordova global akiles object.

    interface Akiles {
        action(
            sessionID: string,
            gadgetID: string,
            actionID: string,
            options: ActionOptions,
            callback: ActionCallback,
        ): () => void;
        addSession(token: string): Promise<string>;
        getGadgets(sessionID: string): Promise<Gadget[]>;
        getHardwares(sessionID: string): Promise<Hardware[]>;
        getSessionIDs(): Promise<string[]>;
        getVersion(): Promise<string>;
        isBluetoothSupported(): Promise<boolean>;
        isCardEmulationSupported(): Promise<boolean>;
        isSecureNFCSupported(): Promise<boolean>;
        refreshAllSessions(): Promise<void>;
        refreshSession(id: string): Promise<void>;
        removeAllSessions(): Promise<void>;
        removeSession(id: string): Promise<void>;
        scan(callback: ScanCallback): () => void;
        scanCard(callback: ScanCardCallback): () => void;
        startCardEmulation(): Promise<void>;
        sync(
            sessionID: string,
            hardwareID: string,
            callback: SyncCallback,
        ): () => void;
    }
    Index

    Methods

    • Do an action on a gadget.

      This method tries to perform the action with both internet and Bluetooth communication methods, possibly in parallel.

      The callback provides global success/error status, plus detailed status information for each method. In particular, the sequence of callbacks is guaranteed to be:

      • For global status: exactly one of onSuccess or onError.
      • For internet status: zero or more onInternetStatus, then exactly one of onInternetSuccess or onInternetError.
      • For Bluetooth status: zero or more onBluetoothStatus or onBluetoothStatusProgress, then exactly one of onBluetoothSuccess or onBluetoothError.

      For Bluetooth, the SDK does some high-priority syncing before the action and some low-priority syncing after, so after the global onSuccess or onError is called you may still receive Bluetooth status updates. In this case, we recommend you show the success/failure to the user immediately to not make them wait, but still show a Bluetooth icon with a spinning indicator to convey there's still Bluetooth activity.

      Parameters

      • sessionID: string

        ID for the session to use.

      • gadgetID: string

        Gadget ID, in the format "gad_3vms1xqucnus4ppfnl9h".

      • actionID: string

        Action ID.

      • options: ActionOptions

        Options customizing the action.

      • callback: ActionCallback

        The callback that will be called on success or error.

      Returns () => void

      A function that cancels the ongoing action operation.

    • Add a session to the session store.

      If the session store already contains the session, this is a noop. This does a network call to the server to check the session token, and to cache the session data into local storage.

      Parameters

      • token: string

        The session token.

      Returns Promise<string>

      A promise that resolves to the session ID.

    • Get a list of hardware accessible by this session.

      Parameters

      • sessionID: string

        The session ID.

      Returns Promise<Hardware[]>

      A promise that resolves to an array with all the hardware in the session.

    • Get the IDs for all sessions in the session store.

      Returns Promise<string[]>

      A promise that resolves to an array with the IDs of all sessions.

    • Returns whether Bluetooth is supported on this phone.

      This checks for the presence of Bluetooth LE hardware and requires Android 10 (API 29) or newer.

      Returns Promise<boolean>

      true if Bluetooth is supported, false otherwise.

    • Returns whether card emulation is supported on this phone.

      This checks for the presence of NFC Host Card Emulation hardware.

      Returns Promise<boolean>

      true if card emulation is supported, false otherwise.

    • Returns whether secure NFC is supported on this phone.

      Returns Promise<boolean>

      true if card secure NFC is supported, false otherwise.

    • Remove a session from the session store.

      If there's no session in the store with the given ID, this is a noop.

      Parameters

      • id: string

        The session ID to remove.

      Returns Promise<void>

    • Scan using Bluetooth for nearby Akiles devices.

      The sequence of callbacks is guaranteed to be zero or more onDiscover, then exactly one of onSuccess or onError.

      Parameters

      • callback: ScanCallback

        The callback that will be called on success or error.

      Returns () => void

      A function that cancels the ongoing scan operation.

    • Scan a card using NFC.

      The result will be notified via events:

      • scan_card_success: { card: { uid, isAkilesCard } }
      • scan_card_error: { error: { code, description } }

      Parameters

      • callback: ScanCardCallback

        The callback that will be called on success or error.

      Returns () => void

      A function that cancels the ongoing scanCard operation.

    • iOS ONLY - Start a card emulation session.

      Do not call this on Android. Card emulation on Android works system-wide out of the box, the only requirements is your app is installed and the session has been added. The user doesn't even have to open the app.

      Returns Promise<void>

    • Synchronize state of hardware.

      The sequence of callbacks is guaranteed to be zero or more onStatus or onStatusProgress, then exactly one of onSuccess or onError.

      Parameters

      • sessionID: string

        ID for the session to use.

      • hardwareID: string

        Hardware ID, in the format "hw_3vms1xqucnus4ppfnl9h".

      • callback: SyncCallback

        The callback that will be called on success or error.

      Returns () => void

      A function that cancels the ongoing sync operation.