react-native-keychain: Provides its own types (#39517)

This commit is contained in:
Alexander T
2019-11-06 08:07:44 -08:00
committed by Nathan Shively-Sanders
parent bdb0d39904
commit bd1fd915ad
5 changed files with 6 additions and 150 deletions
+6
View File
@@ -3684,6 +3684,12 @@
"sourceRepoURL": "https://github.com/idehub/react-native-google-analytics-bridge",
"asOfVersion": "5.3.3"
},
{
"libraryName": "react-native-keychain",
"typingsPackageName": "react-native-keychain",
"sourceRepoURL": "https://github.com/oblador/react-native-keychain",
"asOfVersion": "3.1.0"
},
{
"libraryName": "react-native-linear-gradient",
"typingsPackageName": "react-native-linear-gradient",
-87
View File
@@ -1,87 +0,0 @@
// Type definitions for react-native-keychain 3.0
// Project: https://github.com/oblador/react-native-keychain
// Definitions by: David Evans Farinha <https://github.com/DavidFarinha>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.1
export interface UserCredentials {
username: string;
password: string;
}
export interface SharedWebCredentials {
server: string;
username: string;
password: string;
}
export interface Options {
accessControl?: SecAccessControl;
accessGroup?: string;
accessible?: SecAccessible;
authenticationPrompt?: string;
authenticationType?: LAPolicy;
service?: string;
}
export type SecAccessible =
'AccessibleWhenUnlocked'
| 'AccessibleAfterFirstUnlock'
| 'AccessibleAlways'
| 'AccessibleWhenPasscodeSetThisDeviceOnly'
| 'AccessibleWhenUnlockedThisDeviceOnly'
| 'AccessibleAfterFirstUnlockThisDeviceOnly'
| 'AccessibleAlwaysThisDeviceOnly';
export type SecAccessControl =
'UserPresence'
| 'BiometryAny'
| 'BiometryCurrentSet'
| 'DevicePasscode'
| 'ApplicationPassword'
| 'BiometryAnyOrDevicePasscode'
| 'BiometryCurrentSetOrDevicePasscode';
export type LAPolicy = 'Authentication' | 'AuthenticationWithBiometrics';
export function canImplyAuthentication(options?: Options): Promise<boolean>;
export function getSupportedBiometryType(): Promise<string | null>;
export function setInternetCredentials(
server: string,
username: string,
password: string,
options?: Options
): Promise<boolean>;
export function getInternetCredentials(
server: string
): Promise<UserCredentials>;
export function resetInternetCredentials(
server: string
): Promise<boolean>;
export function setGenericPassword(
username: string,
password: string,
serviceOrOptions?: string | Options
): Promise<boolean>;
export function getGenericPassword(
serviceOrOptions?: string | Options
): Promise<boolean | {service: string, username: string, password: string}>;
export function resetGenericPassword(
serviceOrOptions?: string | Options
): Promise<boolean>;
export function requestSharedWebCredentials(
): Promise<SharedWebCredentials>;
export function setSharedWebCredentials(
server: string,
username: string,
password: string
): Promise<boolean>;
@@ -1,39 +0,0 @@
import * as Keychain from 'react-native-keychain';
async () => {
const username = 'username';
const password = 'password';
const service: string | undefined = "test.service";
const server = "test.server";
const serviceOrOptions: string | Keychain.Options | undefined = {};
const options: Keychain.Options = {};
const keychainServicePassword: boolean | {
service: string;
username: string;
password: string;
} = await Keychain.getGenericPassword(service);
const keychainPassword: boolean | {
service: string;
username: string;
password: string;
} = await Keychain.getGenericPassword();
const keychainServerPassword: Keychain.UserCredentials = await Keychain.getInternetCredentials(server);
const keychainSharedWebPassword: Keychain.SharedWebCredentials = await Keychain.requestSharedWebCredentials();
const keychainResetGenericPassword: boolean = await Keychain.resetGenericPassword(serviceOrOptions);
const keychainSetGenericPassword: boolean = await Keychain.setGenericPassword(username, password, options);
const keychainSetServerPassword: boolean = await Keychain.setInternetCredentials(server, username, password, serviceOrOptions);
const keychainSetSharedWebPassword: boolean = await Keychain.setSharedWebCredentials(server, username, password);
const canImplyAuthentication: boolean = await Keychain.canImplyAuthentication(serviceOrOptions);
const supportedBiometryType: string | null = await Keychain.getSupportedBiometryType();
};
-23
View File
@@ -1,23 +0,0 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true,
"strictFunctionTypes": true
},
"files": [
"index.d.ts",
"react-native-keychain-tests.ts"
]
}
-1
View File
@@ -1 +0,0 @@
{ "extends": "dtslint/dt.json" }