mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-11 12:30:18 +00:00
[expo] Add types for SecureStore keychain item accessibility constants (#31840)
* [expo] Add types for SecureStore constants * add use of keychainService; improve options types for getItemAsync and deleteItemAsync; test all SecureStore constants
This commit is contained in:
committed by
Sheetal Nandi
parent
f1762ec1a7
commit
3ad75fac4d
@@ -47,6 +47,7 @@ import {
|
||||
Region,
|
||||
registerRootComponent,
|
||||
ScreenOrientation,
|
||||
SecureStore,
|
||||
Svg,
|
||||
Updates
|
||||
} from 'expo';
|
||||
@@ -484,6 +485,30 @@ async () => {
|
||||
isString(queryParams2['y'] || '');
|
||||
};
|
||||
|
||||
// #region securestore
|
||||
async () => {
|
||||
await SecureStore.setItemAsync('some-key', 'some-val', {
|
||||
keychainService: "some-service",
|
||||
keychainAccessible: SecureStore.WHEN_PASSCODE_SET_THIS_DEVICE_ONLY,
|
||||
});
|
||||
const result = await SecureStore.getItemAsync('some-key', { keychainService: "some-service" });
|
||||
if (result != null) {
|
||||
result.slice() === 'some-val';
|
||||
}
|
||||
await SecureStore.deleteItemAsync('some-key', { keychainService: "some-service" });
|
||||
};
|
||||
|
||||
const allSecureStoreKeychainAccessibleValues: number[] = [
|
||||
SecureStore.WHEN_UNLOCKED,
|
||||
SecureStore.AFTER_FIRST_UNLOCK,
|
||||
SecureStore.ALWAYS,
|
||||
SecureStore.WHEN_UNLOCKED_THIS_DEVICE_ONLY,
|
||||
SecureStore.WHEN_PASSCODE_SET_THIS_DEVICE_ONLY,
|
||||
SecureStore.AFTER_FIRST_UNLOCK_THIS_DEVICE_ONLY,
|
||||
SecureStore.ALWAYS_THIS_DEVICE_ONLY,
|
||||
];
|
||||
// #endregion
|
||||
|
||||
() => (
|
||||
<Svg width={100} height={50}>
|
||||
<Svg.Rect
|
||||
|
||||
Vendored
+13
-1
@@ -14,6 +14,7 @@
|
||||
// Levan Basharuli <https://github.com/levansuper>
|
||||
// Pavel Ihm <https://github.com/ihmpavel>
|
||||
// Bartosz Dotryw <https://github.com/burtek>
|
||||
// Jason Killian <https://github.com/jkillian>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.8
|
||||
|
||||
@@ -2301,12 +2302,23 @@ export namespace ScreenOrientation {
|
||||
export namespace SecureStore {
|
||||
interface SecureStoreOptions {
|
||||
keychainService?: string;
|
||||
}
|
||||
|
||||
interface SecureStoreSetOptions extends SecureStoreOptions {
|
||||
keychainAccessible?: number;
|
||||
}
|
||||
|
||||
function setItemAsync(key: string, value: string, options?: SecureStoreOptions): Promise<void>;
|
||||
function setItemAsync(key: string, value: string, options?: SecureStoreSetOptions): Promise<void>;
|
||||
function getItemAsync(key: string, options?: SecureStoreOptions): Promise<string | null>;
|
||||
function deleteItemAsync(key: string, options?: SecureStoreOptions): Promise<void>;
|
||||
|
||||
const WHEN_UNLOCKED: number;
|
||||
const AFTER_FIRST_UNLOCK: number;
|
||||
const ALWAYS: number;
|
||||
const WHEN_UNLOCKED_THIS_DEVICE_ONLY: number;
|
||||
const WHEN_PASSCODE_SET_THIS_DEVICE_ONLY: number;
|
||||
const AFTER_FIRST_UNLOCK_THIS_DEVICE_ONLY: number;
|
||||
const ALWAYS_THIS_DEVICE_ONLY: number;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user