one
Version:
One is a React framework for web, iOS, and Android apps.
75 lines (72 loc) • 2.89 kB
JavaScript
;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all) __defProp(target, name, {
get: all[name],
enumerable: true
});
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
get: () => from[key],
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
});
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var validate_exports = {};
__export(validate_exports, {
SECURE_STORE_ACCESSIBILITIES: () => SECURE_STORE_ACCESSIBILITIES,
assertSecureStoreKey: () => assertSecureStoreKey,
assertSecureStoreOptions: () => assertSecureStoreOptions,
assertSecureStoreValue: () => assertSecureStoreValue
});
module.exports = __toCommonJS(validate_exports);
function assertSecureStoreKey(key, verb) {
if (typeof key !== "string" || key.length === 0) {
throw new Error(`${verb}: key must be a non-empty string`);
}
}
function assertSecureStoreValue(value, verb) {
if (typeof value !== "string") {
throw new Error(`${verb}: value must be a string`);
}
}
var SECURE_STORE_ACCESSIBILITIES = [
"afterFirstUnlock",
"afterFirstUnlockThisDeviceOnly",
"always",
"alwaysThisDeviceOnly",
"whenPasscodeSetThisDeviceOnly",
"whenUnlocked",
"whenUnlockedThisDeviceOnly"
];
function assertSecureStoreOptions(options, verb) {
if (options === void 0) return {};
if (typeof options !== "object" || options === null || Array.isArray(options)) {
throw new Error(`${verb}: options must be an object`);
}
var { keychainService, keychainAccessible, requireAuthentication, authenticationPrompt, accessGroup } = options;
if (keychainService !== void 0 && typeof keychainService !== "string") {
throw new Error(`${verb}: options.keychainService must be a string`);
}
if (keychainAccessible !== void 0 && !SECURE_STORE_ACCESSIBILITIES.includes(keychainAccessible)) {
throw new Error(`${verb}: options.keychainAccessible must be one of: ${SECURE_STORE_ACCESSIBILITIES.join(", ")}`);
}
if (requireAuthentication !== void 0 && typeof requireAuthentication !== "boolean") {
throw new Error(`${verb}: options.requireAuthentication must be a boolean`);
}
if (authenticationPrompt !== void 0 && typeof authenticationPrompt !== "string") {
throw new Error(`${verb}: options.authenticationPrompt must be a string`);
}
if (accessGroup !== void 0 && typeof accessGroup !== "string") {
throw new Error(`${verb}: options.accessGroup must be a string`);
}
return options;
}
//# sourceMappingURL=validate.native.js.map