Telefonica/webview-bridge

Add new method to request Pin/Biometric authentication from bridge

dpastor opened this issue · 4 comments

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

  • maxSecondsSinceLastValidation: number
    • If time elapsed since last authentication is less than the number of seconds specified here, authentication will succeed without requesting it again

Success Response Payload

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

Error response codes

401 → Unauthorized

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

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

No, Vivo will just always set time they want.

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