Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// $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);
(result.username: string);
(result.password: string);
}
});
setSharedWebCredentials('server', 'username', 'password').then(result => {
(result: void);
});
(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);
(result.username: string);
(result.password: string);
}
});
setSharedWebCredentials('server', 'username', 'password').then(result => {
(result: void);
});
return keychainWrapper.clear().then(() => {
expect(keychain.resetGenericPassword).toHaveBeenCalled();
});
});
afterEach(() => {
keychain.resetGenericPassword.mockClear();
});
@action enraseData() {
Keychain.resetGenericPassword()
AppDS.enraseData()
.then(async (res) => {
this.resetDisable()
MainStore.appState.resetAppState()
await AppDS.readAppData()
this.setup()
NavStore.pushToScreen('EnraseNotifScreen')
})
.catch(e => console.log(e))
}
async submit() {
const { confirmPassword } = this.state;
if (!confirmPassword) return;
const { disablePrivacy, navigation } = this.props;
try {
const credentials = await Keychain.getGenericPassword();
if (credentials) {
if (credentials.password !== confirmPassword) {
Vibration.vibrate(VIBRATION_PATTERN_ERROR);
throw new PasswordsDontMatchError();
}
await Keychain.resetGenericPassword();
}
disablePrivacy();
const n = navigation.dangerouslyGetParent();
if (n) n.goBack();
} catch (error) {
this.setState({ error, confirmPassword: "" });
}
}
return new Promise((resolve, reject) => {
browser.runtime.sendMessage({
action: DISCONNECTED
});
dispatch({ type: DISCONNECTED });
Keychain.resetGenericPassword().then(resolve, reject);
});
};
resetGenericPassword() {
const options = { service: defaultOptions.service };
return Keychain.resetGenericPassword(options);
},
async reset() {
try {
await Keychain.resetGenericPassword();
this.setState({
status: 'Credentials Reset!',
username: '',
password: '',
});
} catch (err) {
this.setState({ status: 'Could not reset credentials, ' + err });
}
}