mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-23 11:56:00 +01:00
dont set keys if not there on sso (#152)
* dont set keys if not there on sso * a comment
This commit is contained in:
parent
8fe78916e2
commit
9957125d3a
@ -308,21 +308,25 @@ export class AuthService implements AuthServiceAbstraction {
|
|||||||
if (hashedPassword != null) {
|
if (hashedPassword != null) {
|
||||||
await this.cryptoService.setKeyHash(hashedPassword);
|
await this.cryptoService.setKeyHash(hashedPassword);
|
||||||
}
|
}
|
||||||
await this.cryptoService.setEncKey(tokenResponse.key);
|
|
||||||
|
|
||||||
// User doesn't have a key pair yet (old account), let's generate one for them
|
// Skip this step during SSO new user flow. No key is returned from server.
|
||||||
if (tokenResponse.privateKey == null) {
|
if (code == null || tokenResponse.key != null) {
|
||||||
try {
|
await this.cryptoService.setEncKey(tokenResponse.key);
|
||||||
const keyPair = await this.cryptoService.makeKeyPair();
|
|
||||||
await this.apiService.postAccountKeys(new KeysRequest(keyPair[0], keyPair[1].encryptedString));
|
// User doesn't have a key pair yet (old account), let's generate one for them
|
||||||
tokenResponse.privateKey = keyPair[1].encryptedString;
|
if (tokenResponse.privateKey == null) {
|
||||||
} catch (e) {
|
try {
|
||||||
// tslint:disable-next-line
|
const keyPair = await this.cryptoService.makeKeyPair();
|
||||||
console.error(e);
|
await this.apiService.postAccountKeys(new KeysRequest(keyPair[0], keyPair[1].encryptedString));
|
||||||
|
tokenResponse.privateKey = keyPair[1].encryptedString;
|
||||||
|
} catch (e) {
|
||||||
|
// tslint:disable-next-line
|
||||||
|
console.error(e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
await this.cryptoService.setEncPrivateKey(tokenResponse.privateKey);
|
await this.cryptoService.setEncPrivateKey(tokenResponse.privateKey);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.vaultTimeoutService != null) {
|
if (this.vaultTimeoutService != null) {
|
||||||
|
Loading…
Reference in New Issue
Block a user