1.0.0 • Published 2 years ago

io.cordova.cordovaantelop v1.0.0

Weekly downloads
-
License
Apache-2.0
Repository
-
Last release
2 years ago

Cordova Antelop Plugin

Entrust Cordova plugin integration is done by introducing a new plugin where a custom configuration must be set as detailed below

Before starting

Unzip folder. You will have 2 part: "BridgeAntelop" and demo app.

Declare configuration identifiers

<source-file src="AntelopRelease.plist" />
  • For Android : Declare the following manifest meta-data : "fr.antelop.application_id" and "fr.antelop.issuerId" in the plugin.xml file, as shown below
<config-file target="AndroidManifest.xml" parent="/manifest/application">
  <meta-data android:name="fr.antelop.application_id" android:value="\3291680308056510485" />
  <meta-data android:name="fr.antelop.issuerId" android:value="demo" />
</config-file>

Forward Sytem events :

For iOS : The configuration plugin should contain an AppDelegate native iOS file that forwards system events to iOS Entrust SDK as documented here: https://doc.antelop-solutions.com/latest/wallet/sdk/ios_integration.html#_integrate_framework_basic

For Android : For hms push notification support please refer to : https://doc.antelop-solutions.com/latest/wallet/sdk/android_integration.html#_huawei_mobile_services_integration If your appplication is using firebase cloud messaging service for its own purposes, please refer to https://doc.antelop-solutions.com/latest/wallet/sdk/android_integration.html#_firebase_messaging_services_integration

For iOS Configure Capabilities :

You need to enable "push notifications" and set "app groups" in "Signing & Capabilities" tab.

Cordova app declaring such configuration project is able to access Entrust cordova bridge entry points and to run it properly.

Launch Demo App

When plugin is configured, you need to add your "BridgeAntelop" like this:

cordova plugin add BridgeAntelop

and install both platforms like this:

cordova platforms add ios
cordova platforms add android

Example Usage

To instanciate wallet, create "connect method" which use bridge...

class WalletManager {

  ...

  async connect(
    currentCredentials?: CustomerAuthenticationCredentials,
    newCredentials?: CustomerAuthenticationCredentials
  ): Promise<void> {
    return cordova.antelopwalletmanagermodule.connect(
      this.instanceKey,
      currentCredentials?.getInstanceKey(),
      newCredentials?.getInstanceKey()
    );
  }

  ...

}

Connect the wallet...

const protocole: WalletManagerProtocole = {
    onProvisioningRequired: () => {
      navigate(ROUTE_PATHS.provisioning);
    },
    onCredentialsRequired: (reason) => {
      navigate(ROUTE_PATHS.credentials, {
        state: {
          reason: reason,
        }
      });
    },
    onConnectionSuccess: async (wallet) => {
      await setWallet(wallet);
      navigate(ROUTE_PATHS.home)
    },
    onConnectionError: (error) => {
      navigate(ROUTE_PATHS.error, {
        title: 'WalletManager - Connection Error',
        error: error,
      });
    },
    onAsyncRequestSuccess: (asyncRequestCode) => {
      // do stuff
    },

    onAsyncRequestError: (asyncRequestCode, error) => {
      navigate(ROUTE_PATHS.error, {
        title: `WalletManager - AsyncRequest Error`,
        error: error,
      });
    },
  };

const walletManager = await WalletManager(protocole);
walletManager.connect();