SCA SDK - React-Native
Our guide is based on the provider documentation PowerAuth Mobile JS SDK documentation. This guide's purpose is to pinpoint the crucial features needed to set-up the provided SDK and create an app able to communicate with our API.
You can start by familiarizing yourself with the Mobile-first authentication flow. This gives a quick overview of the flow we've integrated. Device Registration
and Transaction Signing
.
Installation
In order to integrate the PowerAuth SDK for React Native you for need to install the corresponding library, you can follow the installation instruction for React Native => Link
npm i react-native-powerauth-mobile-sdk --save
and install the podscd ios
pod install
In order to communicate with our PowerAuth cloud, and to call any method on the newly created
const powerAuth = new PowerAuth(instanceId)
object, you need to configure it first. follow the Provider's instructionsUse the credentials provided by LinkCy, they should match the parameters required.
You can use the
Advanced configuration
:
for testing purposes we use thePowerAuthClientConfiguration
andPowerAuthBiometryConfiguration
in order to bypass biometry witch is not implemented on our behalf yet.Dont forget the basic configuration:
const configuration = new PowerAuthConfiguration("appKey", "appSecret", "masterServerPublicKey", "https://your-powerauth-endpoint.com/")
To bypass biometry:
const biometryConfiguration = { authenticateOnBiometricKeySetup: false };
To allow http calls (do not set to true in production):
const clientConfiguration = {enableUnsecureTraffic: configuration.baseEndpointUrl.startsWith('http://')};
Finally start configuration:
powerAuth.configure(configuration, clientConfiguration, biometryConfiguration)
Like indicated in the documentation, it is important to note that unconfigured instance will throw exceptions. Use
await powerAuth.isConfigured()
to check if configured.
Registration
The first flow you need to implement is the device registration flow, follow the Provider's instructions
To get the required activationCode
or activationQrCode
you first need to call our endpoint device registration
See SCA description
This will return on object win the corresponding info:
{
"activationQrCodeData": string
"activationCode": string
"activationCodeSignature": string
"registrationId": string
}
Follow the create activation
instructions:
First verify the activation Qr code:
powerAuth.verifyScannedActivationCode(activationQrCode);
Create the activation code:
const activation = PowerAuthActivation.createWithActivationCode(activationQrCode, device name)
Then
powerAuth.createActivation(activation);
The final interaction with the PowerCloud needed is to commit the created activation:
Use the method :const powerAuthPassword = powerAuth.createPassword()
to create aPowerAuthPassword
object.
Then add the inputed values using:password.addCharacter(*)
.
And commit it:await PowerAuthAuthentication.commitWithPassword(powerAuthPassword);
Finally, if the Promise return is successful you can call our endpoint commit registration
with the previously provided registrationId
to finalise the registration
Operation Data Signing
Last but not least we'll oversee the Data Signing
section, and more specifically the Symmetric Multi-Factor Signature
section of it.
Follow the provider's instructions.
The goal is to create a signature form the PowerAuthCloud using the powerAuth.requestSignature(auth, method, uriId, jsonBody)
method.
This should return a signature which value should put under headers Linkcy-SCA-Signature
when calling our SCA restricted endpoints.
Examples
To help your integration you can check the wultra demo app GitHub page => Link
The best example would be the PowerAuth_Example.ts. => /testapp/_tests/PowerAuth_Example.ts