@nevis-security/nevis-mobile-authentication-sdk-react
Version:
React Native plugin for Nevis Mobile Authentication SDK. Supports only mobile.
78 lines (76 loc) • 3.42 kB
JavaScript
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.DeviceInformationCheckImpl = exports.DeviceInformationCheck = void 0;
var _reactNativeUuid = _interopRequireDefault(require("react-native-uuid"));
var _DeviceInformationCheckPlatformOperation = require("../../cache/operation/DeviceInformationCheckPlatformOperation");
var _PlatformOperationCache = require("../../cache/PlatformOperationCache");
var _MobileAuthenticationSdk = _interopRequireDefault(require("../../MobileAuthenticationSdk"));
var _DeviceInformationCheckResultMessage = require("../../model/messages/in/DeviceInformationCheckResultMessage");
var _DeviceInformationCheckMessage = require("../../model/messages/out/DeviceInformationCheckMessage");
var _HttpOperation = require("../HttpOperation");
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
/**
* Copyright © 2024 Nevis Security AG. All rights reserved.
*/
/**
* The operation retrieving the mismatches that exist between the configuration in the server and in
* the mobile device application.
*
* The configuration mismatches can be fixed by providing them to the {@link DeviceInformationSync}
* operation.
*
* This is supported only with FIDO UAF registrations made against a backend with nevisFIDO 7.2408.**
* or later. With registrations made with earlier versions of nevisFIDO, this operation can return
* {@link MissingAuthenticatorInServer} false positives, that is, it can report mismatches, when the
* credentials of backend and server are in sync.
*
* Usage example:
* ```ts
* [...]
* async retrieveDeviceInformationMismatches(
* operations: Operations
* ): Promise<void> {
* operations.deviceInformationCheck
* .onResult((result) => {
* // handle the retrieved mismatches. They can be fixed by
* // running a DeviceInformationSync operation.
* })
* .execute();
* }
* [...]
* ```
*
* @see
* - {@link DeviceInformationCheckResult}
* - {@link DeviceInformationSync}
* - {@link Operations.deviceInformationCheck}
*/
class DeviceInformationCheck extends _HttpOperation.HttpOperation {}
exports.DeviceInformationCheck = DeviceInformationCheck;
class DeviceInformationCheckImpl extends _HttpOperation.HttpOperationImpl {
constructor() {
super();
}
onResult(onResult) {
this._onResult = onResult;
return this;
}
async execute() {
const operationId = _reactNativeUuid.default.v4();
const operation = new _DeviceInformationCheckPlatformOperation.DeviceInformationCheckPlatformOperation(operationId, this._onResult);
_PlatformOperationCache.PlatformOperationCache.getInstance().put(operation);
const message = new _DeviceInformationCheckMessage.DeviceInformationCheckMessage(operationId, this.onResult !== undefined, this.httpRequestHeaders);
function finish() {
_PlatformOperationCache.PlatformOperationCache.getInstance().delete(operationId);
}
return _MobileAuthenticationSdk.default.deviceInformationCheck(message).then(result => {
const resultMessage = _DeviceInformationCheckResultMessage.DeviceInformationCheckResultMessage.fromJson(result);
operation.handleResult(resultMessage.result);
finish();
});
}
}
exports.DeviceInformationCheckImpl = DeviceInformationCheckImpl;
//# sourceMappingURL=DeviceInformationCheck.js.map
;