diff --git a/types/expo/expo-tests.tsx b/types/expo/expo-tests.tsx index 57e028e8bf..481c1b27c4 100644 --- a/types/expo/expo-tests.tsx +++ b/types/expo/expo-tests.tsx @@ -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 + () => ( // Pavel Ihm // Bartosz Dotryw +// Jason Killian // 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; + function setItemAsync(key: string, value: string, options?: SecureStoreSetOptions): Promise; function getItemAsync(key: string, options?: SecureStoreOptions): Promise; function deleteItemAsync(key: string, options?: SecureStoreOptions): Promise; + + 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; } /**