UNPKG

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

Version:

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

127 lines (121 loc) 5.33 kB
"use strict"; /** * Copyright © 2025 Nevis Security AG. All rights reserved. */ var FidoUafAttestationInformationType = /*#__PURE__*/function (FidoUafAttestationInformationType) { FidoUafAttestationInformationType[FidoUafAttestationInformationType["OnlySurrogateBasicSupported"] = 0] = "OnlySurrogateBasicSupported"; FidoUafAttestationInformationType[FidoUafAttestationInformationType["OnlyDefaultMode"] = 1] = "OnlyDefaultMode"; FidoUafAttestationInformationType[FidoUafAttestationInformationType["StrictMode"] = 2] = "StrictMode"; return FidoUafAttestationInformationType; }(FidoUafAttestationInformationType || {}); /** * The object that can be used to know whether the device supports {@link https://docs.nevis.net/configurationguide/mobile-auth-concept-and-integration-guide/use-cases-and-best-practices/uaf-surrogate-full-basic-comparison | Full Basic Attestations}. * * If full basic 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. * * Note that it is guaranteed that the only type of instances that the {@link AndroidDeviceCapabilities.fidoUafAttestationInformationGetter} * returns are either {@link OnlySurrogateBasicSupported}, {@link OnlyDefaultMode} or {@link StrictMode}. * * @see {@link MobileAuthenticationClient.deviceCapabilities}, {@link AndroidDeviceCapabilities.fidoUafAttestationInformationGetter}, {@link FidoUafAttestationInformationGetter} */ export class FidoUafAttestationInformation { /** * Alternate constructor that creates a {@link FidoUafAttestationInformation} from a json. * * @param json contains the source for instance creation. * @returns a {@link FidoUafAttestationInformation} instance. */ static fromJson(json) { const subtype = FidoUafAttestationInformationType[json.type]; switch (subtype) { case FidoUafAttestationInformationType.OnlySurrogateBasicSupported: return OnlySurrogateBasicSupported.fromJson(json.data); case FidoUafAttestationInformationType.OnlyDefaultMode: return OnlyDefaultMode.fromJson(json.data); case FidoUafAttestationInformationType.StrictMode: return StrictMode.create(); default: throw new Error(`Unknown FIDO UAF attestation information (${json.type}).`); } } } /** * Only the surrogate basic attestation is supported. So, neither the default nor the strict mode of * full basic attestation are supported (see the {@link https://docs.nevis.net/configurationguide/patterns-reference#basic-full-attestation | nevisFIDO documentation} * for details regarding the different modes). */ export class OnlySurrogateBasicSupported extends FidoUafAttestationInformation { /** * The error that occurred while checking if the full basic attestation is supported. * * Its message provides information about why the device does not support full basic attestation. */ /** * Alternate constructor that creates an {@link OnlySurrogateBasicSupported} from a json. * * @param json contains the source for instance creation. * @returns the created {@link OnlySurrogateBasicSupported} instance. */ static fromJson(json) { return OnlySurrogateBasicSupportedImpl.fromJson(json); } } export class OnlySurrogateBasicSupportedImpl extends OnlySurrogateBasicSupported { constructor(cause) { super(); this.cause = cause; } static fromJson(json) { return new OnlySurrogateBasicSupportedImpl(json.cause); } } /** * The device supports the default full basic attestation mode as described in the {@link https://docs.nevis.net/configurationguide/patterns-reference#basic-full-attestation | nevisFIDO documentation}. * However, it supports surrogate basic attestation, but it does not support the strict mode. */ export class OnlyDefaultMode extends FidoUafAttestationInformation { /** * The error that occurred while checking if the strict mode of the full basic attestation is * supported. * * Its message provides information about why the device does not support the full basic attestation * strict mode. */ /** * Alternate constructor that creates an {@link OnlyDefaultMode} from a json. * * @param json contains the source for instance creation. * @returns the created {@link OnlyDefaultMode} instance. */ static fromJson(json) { return OnlyDefaultModeImpl.fromJson(json); } } export class OnlyDefaultModeImpl extends OnlyDefaultMode { constructor(cause) { super(); this.cause = cause; } static fromJson(json) { return new OnlyDefaultModeImpl(json.cause); } } /** * The device supports both the strict and the default full basic attestation mode as described in * the {@link https://docs.nevis.net/configurationguide/patterns-reference#basic-full-attestation | nevisFIDO documentation}. * It also supports surrogate basic. */ export class StrictMode extends FidoUafAttestationInformation { /** * Default constructor for {@link StrictMode}. * * @returns the created {@link StrictMode} instance. */ static create() { return new StrictModeImpl(); } } export class StrictModeImpl extends StrictMode {} //# sourceMappingURL=FidoUafAttestationInformation.js.map