mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
* Creating type definitions for "react-native-keychain" * Updating index.d.ts to include Promise<string> on getGenericPassword() * Fixing all tslint and dts-lint errors and issues. * Removing duplicate "Definitions by" * Updating index.d.ts, improving tests. -Updating index.d.ts to include type definitions for canImplyAuthentication and getSupportedBiometryType. -Updating index.d.ts to fix type definitions for setInternetCredentials and resetGenericPassword. -Adding full type test coverage to all exposed methods on react-native-keychain. * Updating type definitions for setGenericPassword, getGenericPassword. -Updating index.d.ts to update type definitions for setGenericPassword, getGenericPassword. -Updating type definition tests to reflect new type definition updates. * Updating type definitions for setGenericPassword -Updating index.d.ts to include correct setGenericPassword parameter types.
40 lines
1.5 KiB
TypeScript
40 lines
1.5 KiB
TypeScript
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();
|
|
};
|