Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
hasInternetCredentials('server').then(result => {
(result: boolean);
});
// $FlowExpectedError - First argument is required
getInternetCredentials();
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);
},
{
key: requestToken,
secret: requestTokenSecret
}
)
)
})
const {
oauth_token: accessToken,
oauth_token_secret: accessTokenSecret
} = querystring.parse(await accessTokenResponse.text())
// update credentials
await Keychain.resetInternetCredentials(Config.API_URL)
await Keychain.setInternetCredentials(
Config.API_URL,
accessToken,
accessTokenSecret
)
}
async resetCredentials(username: string) {
await Keychain.resetInternetCredentials(username)
console.log('Credentials successfully deleted')
}
export async function keychainDelete(key: string) {
try {
await resetInternetCredentials(key);
console.log(`Keychain: removed value for key: ${key}`);
} catch (err) {
console.log(
`Keychain: failed to remove value for key: ${key} error: ${err}`
);
}
}
export async function remove(key) {
try {
await resetInternetCredentials(key);
console.log(`Keychain: removed value for key: ${key}`);
} catch (err) {
console.log(`Keychain: failed to remove value for key: ${key} error: ${err}`);
}
}
export async function clearCredentials () {
if (Config.PREAUTH_URL != null) {
await Keychain.resetInternetCredentials(Config.PREAUTH_URL)
await CookieManager.clearAll()
}
await Keychain.resetInternetCredentials(Config.API_URL)
}
export async function reset(server?: string) {
if (server) {
await ReactNativeKeychain.resetInternetCredentials(server)
return true
} else {
const result = await ReactNativeKeychain.resetGenericPassword()
return result
}
}
export function clearLoginCredentials() {
return Keychain.resetInternetCredentials(SIS_LOGIN_CREDENTIAL_KEY)
}
purge: (type: string) => {
Keychain.resetInternetCredentials(type);
},
};
destroyPublicAccessToken() {
return Keychain
.resetInternetCredentials(publicTokenSiteName)
.then(() => (true))
},
/**