Telefonica / webview-bridge

Novum JavaScript Bridge
MIT License
27 stars 7 forks source link

Add new method to request Pin/Biometric authentication from bridge #129

Closed dpastor closed 6 months ago

dpastor commented 7 months ago

Due this spec, we need to provide the following bridge method:

Trigger Pin/Biometric Authentication

This method allows triggering Pin/Biometric authentication if necessary, taking into account 3 possible scenarios:

  1. User has Pin/Biometric already configured in the app
    • Last previous authentication (or last pin/biometric setup) is still valid.
      • Nothing will be presented to user and bridge method will success.
    • Last previous authentication (or last pin/biometric setup) is not valid.
      • Authentication will be required, blocking the user until it is performed.
  2. In any other case:
    • User will be taken directly to the screen where he can introduce a new PIN and enable any other authentication methods.
      • In case user leaves the screen without providing an authentication method, bridge method will fail with 401 code.

Js method

triggerPinOrBiometricAuthentication: ({
    maxSecondsSinceLastValidation: number;
}) => Promise<{
    result: 'USER_AUTHENTICATED' | 'USER_ENABLED_AUTHENTICATION' | 'LAST_AUTHENTICATION_STILL_VALID';
}>

Message type

TRIGGER_PIN_OR_BIOMETRIC_AUTHENTICATION

Request Payload

Success Response Payload

result: 'USER_AUTHENTICATED' | 'USER_ENABLED_AUTHENTICATION' | 'LAST_AUTHENTICATION_STILL_VALID'

Error response codes

401 → Unauthorized

atabel commented 7 months ago

@dpastor, should we have a default value for maxSecondsSinceLastValidation?

dpastor commented 6 months ago

@dpastor, should we have a default value for maxSecondsSinceLastValidation?

No, Vivo will just always set time they want.

atabel commented 6 months ago

Ok, LGTM. Jira ticket: https://jira.tid.es/browse/WEB-1844

marcoskolodny commented 6 months ago

Small question @dpastor: what is the minimum required App version that supports this method?