How to use the react-native-keychain.setGenericPassword function in react-native-keychain

To help you get started, we’ve selected a few react-native-keychain examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github oblador / react-native-keychain / test_index.js View on Github external
}
});

// $FlowExpectedError - First argument is required
resetInternetCredentials();
resetInternetCredentials('server', simpleOptions).then(result => {
  (result: void);
});

// $FlowExpectedError - First two arguments are required
setGenericPassword();
setGenericPassword('username', 'password').then(result => {
  (result: boolean);
});
setGenericPassword('username', 'password', 'service');
setGenericPassword('username', 'password', simpleOptions);

getGenericPassword().then(result => {
  (result: boolean | SharedWebCredentials);
});
getGenericPassword('service');
getGenericPassword(simpleOptions);

resetGenericPassword().then(result => {
  (result: boolean);
});
resetGenericPassword('service');
resetGenericPassword(simpleOptions);

requestSharedWebCredentials().then(result => {
  if (result) {
    (result.server: string);
github oblador / react-native-keychain / test_index.js View on Github external
getInternetCredentials('server', simpleOptions).then(credentials => {
  if (credentials) {
    (credentials.username: string);
    (credentials.password: string);
  }
});

// $FlowExpectedError - First argument is required
resetInternetCredentials();
resetInternetCredentials('server', simpleOptions).then(result => {
  (result: void);
});

// $FlowExpectedError - First two arguments are required
setGenericPassword();
setGenericPassword('username', 'password').then(result => {
  (result: boolean);
});
setGenericPassword('username', 'password', 'service');
setGenericPassword('username', 'password', simpleOptions);

getGenericPassword().then(result => {
  (result: boolean | SharedWebCredentials);
});
getGenericPassword('service');
getGenericPassword(simpleOptions);

resetGenericPassword().then(result => {
  (result: boolean);
});
resetGenericPassword('service');
resetGenericPassword(simpleOptions);
github oblador / react-native-keychain / test_index.js View on Github external
(credentials.password: string);
  }
});

// $FlowExpectedError - First argument is required
resetInternetCredentials();
resetInternetCredentials('server', simpleOptions).then(result => {
  (result: void);
});

// $FlowExpectedError - First two arguments are required
setGenericPassword();
setGenericPassword('username', 'password').then(result => {
  (result: boolean);
});
setGenericPassword('username', 'password', 'service');
setGenericPassword('username', 'password', simpleOptions);

getGenericPassword().then(result => {
  (result: boolean | SharedWebCredentials);
});
getGenericPassword('service');
getGenericPassword(simpleOptions);

resetGenericPassword().then(result => {
  (result: boolean);
});
resetGenericPassword('service');
resetGenericPassword(simpleOptions);

requestSharedWebCredentials().then(result => {
  if (result) {
github coreyphillips / moonshine / src / utils / helpers.js View on Github external
return new Promise(async (resolve) => {
		try {
			// Set the credentials (username, password, service)
			const result = await Keychain.setGenericPassword(key, value, key);
			resolve({ error: false, data: result });
		} catch (e) {
			resolve({ error: true, data: e });
			console.log(e);
		}
	});
};
github goldennetwork / golden-wallet-react-native / app / AppStores / DataSource / SecureDS.js View on Github external
_deriveNew = (iv) => {
    const password = this.randomKey()

    const randomStrEncrypted = encryptString(password, this.pincode, iv, 'aes-256-cbc')
    // AsyncStorage.setItem(dataKey, randomStrEncrypted)
    Keychain.setGenericPassword(dataKey, randomStrEncrypted)
    return password
  }
github StoDevX / AAO-React-Native / views / settings / index.ios.js View on Github external
saveCredentials() {
     // Check if we have a username set already. We cannot check for password here
     // as it would not be set by the time we check for it
    if (this.state.username !== '') {
        // Save the username and password from the saved state variables
      Keychain.setGenericPassword(this.state.username, this.state.password)

      // Tests to show it works
      this.retrieveCredientials()
      //this.resetCredentials()
    }
  }
github oblador / react-native-keychain / KeychainExample / App.js View on Github external
async save(accessControl) {
    try {
      await Keychain.setGenericPassword(
        this.state.username,
        this.state.password,
        { accessControl: this.state.accessControl }
      );
      this.setState({ username: '', password: '', status: 'Credentials saved!' });
    } catch (err) {
      this.setState({ status: 'Could not save credentials, ' + err });
    }
  }
github guardian / editions / projects / Mallard / src / helpers / storage.ts View on Github external
set: async ({ username, token }: { username: string; token: string }) => {
        await Keychain.setGenericPassword(username, token, { service })
    },
    reset: async (): Promise => {
github lesspass / lesspass / mobile / src / settings / SettingsScreen.js View on Github external
.then(() =>
                      setGenericPassword("masterPassword", masterPassword)
                    )
github mobius-network / wallet / src / components / Auth / PinSetup / PinPad / Choose / Choose.js View on Github external
handleConfirmComplete = async (pin) => {
    const { onComplete } = this.props;

    await Keychain.setGenericPassword('account', pin, { service: 'pin' });

    onComplete(pin);
  };