UNPKG

@nevis-security/nevis-mobile-authentication-sdk-react

Version:

React Native plugin for Nevis Mobile Authentication SDK. Supports only mobile.

75 lines (73 loc) 3.44 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.FidoUafAttestationInformationGetterImpl = exports.FidoUafAttestationInformationGetter = void 0; var _reactNativeUuid = _interopRequireDefault(require("react-native-uuid")); var _FidoUafAttestationInformationErrorConverter = require("../error/attestationInformation/FidoUafAttestationInformationErrorConverter"); var _MobileAuthenticationSdk = _interopRequireDefault(require("../MobileAuthenticationSdk")); var _OnSuccessMessage = require("../model/messages/in/OnSuccessMessage"); var _FidoUafAttestationInformationMessage = require("../model/messages/out/FidoUafAttestationInformationMessage"); var _Operation = require("../operations/Operation"); function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; } /** * Copyright © 2025 Nevis Security AG. All rights reserved. */ /** * The object that can be used to obtain the information regarding the support of * {@link https://docs.nevis.net/configurationguide/mobile-auth-concept-and-integration-guide/use-cases-and-best-practices/uaf-surrogate-full-basic-comparison | Full Basic Attestation} * in this device. * * **IMPORTANT** \ * This operation is Android specific. On iOS the {@link onSuccess} will be invoked with `undefined` * FIDO UAF attestation information. * * If full basic attestation is required by the backend during registration, and this device does not * support it, registration will fail. This information can be used to preemptively inform the user * that the device is not supported. * * Usage example: * ```ts * async function getAttestationInformation( * client: MobileAuthenticationClient, * ): Promise<void> { * await client.deviceCapabilities * .androidDeviceCapabilities * .fidoUafAttestationInformationGetter * .onSuccess((FidoUafAttestationInformation? info) { * // handle success * }) * .onError((error) { * // handle error * }) * .execute(); * } * ``` * * @see {@link AndroidDeviceCapabilities.fidoUafAttestationInformationGetter} */ class FidoUafAttestationInformationGetter extends _Operation.Operation {} exports.FidoUafAttestationInformationGetter = FidoUafAttestationInformationGetter; class FidoUafAttestationInformationGetterImpl extends FidoUafAttestationInformationGetter { onSuccess(onSuccess) { this._onSuccess = onSuccess; return this; } onError(onError) { this._onError = onError; return this; } async execute() { const operationId = _reactNativeUuid.default.v4(); const message = new _FidoUafAttestationInformationMessage.FidoUafAttestationInformationMessage(operationId, this._onSuccess !== undefined, this._onError !== undefined); return _MobileAuthenticationSdk.default.fidoUafAttestationInformation(message).then(result => { const successMessage = _OnSuccessMessage.OnSuccessMessage.fromJson(result); this._onSuccess?.(successMessage.fidoUafAttestationInformation); }).catch(error => { const attestationError = new _FidoUafAttestationInformationErrorConverter.FidoUafAttestationInformationErrorConverter(error).convert(); this._onError?.(attestationError); }); } } exports.FidoUafAttestationInformationGetterImpl = FidoUafAttestationInformationGetterImpl; //# sourceMappingURL=FidoUafAttestationInformationGetter.js.map