Balance Platform SCA Web library
npm install @adyen/bpscawebThis library offers an easy way to perform operations with Strong Customer Authorization. This library is based on WebAuthn to guarantee the security of the operations.
You can use this library direclty on your browser or you can add as a dependency on your JS project.
With npm do
``bash`
npm install @adyen/bpscaweb
With browsers do
`html`
In your TS project do
`js`
import ScaWebauthn from '@adyen/bpscaweb';
Once you have installed the component, you can configure it when you create a new _handler_.
`js`
const handler = ScaWebauthn.create(options);
These are the options you can pass to the component
| Option | Required | Type | Description |
| :---------------: | :--------------------------: | :--------------------------: | :---------------------------------------------- |
| relyingPartyName | Yes | string | A string representing the name of the relying party. This is the name the user will be presented with when creating or validating a WebAuthn operation. |
Example: Create a handler
`javascript`
const scaWebauthn = ScaWebauthn.create({
relyingPartyName: 'adyen_bpsca',
});
Check if SCA is available on the device.
`javascript``
const sdkOutput = await scaWebauthn.checkAvailability();
Exchange the sdkInput return by the backend in the initiate register call
`javascript``
const sdkOutput = await scaWebauthn.register(sdkInput); // the new output that will be shared with the server to complete the registration
Exchange the sdkInput return by the backend in the first call
`javascript```
const sdkOutput = await scaWebauthn.authenticate(sdkInput); // the new output that will be shared with the server to authenticate the call