update sdk calls
This commit is contained in:
parent
3a70a6b222
commit
e877375158
|
@ -31,8 +31,7 @@ function setupVerificationResponse(
|
||||||
userKeyEncryptedPrivateKey: "userKeyEncryptedPrivateKey",
|
userKeyEncryptedPrivateKey: "userKeyEncryptedPrivateKey",
|
||||||
};
|
};
|
||||||
|
|
||||||
sdkService.userClient$.mockReturnValue(
|
sdkService.client$ = of({
|
||||||
of({
|
|
||||||
crypto: () => ({
|
crypto: () => ({
|
||||||
verify_asymmetric_keys: jest.fn().mockReturnValue(mockVerificationResponse),
|
verify_asymmetric_keys: jest.fn().mockReturnValue(mockVerificationResponse),
|
||||||
make_key_pair: jest.fn().mockReturnValue(mockKeyPairResponse),
|
make_key_pair: jest.fn().mockReturnValue(mockKeyPairResponse),
|
||||||
|
@ -42,8 +41,7 @@ function setupVerificationResponse(
|
||||||
version: jest.fn(),
|
version: jest.fn(),
|
||||||
throw: jest.fn(),
|
throw: jest.fn(),
|
||||||
catch: jest.fn(),
|
catch: jest.fn(),
|
||||||
} as unknown as BitwardenClient),
|
} as unknown as BitwardenClient);
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function setupUserKeyValidation(
|
function setupUserKeyValidation(
|
||||||
|
|
|
@ -56,9 +56,10 @@ export class DefaultUserAsymmetricKeysRegenerationService
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const verificationResponse = await firstValueFrom(
|
const verificationResponse = await firstValueFrom(
|
||||||
this.sdkService.userClient$(userId).pipe(
|
this.sdkService.client$.pipe(
|
||||||
map((sdk) =>
|
map((sdk) =>
|
||||||
sdk.crypto().verify_asymmetric_keys({
|
sdk.crypto().verify_asymmetric_keys({
|
||||||
|
userKey: userKey.keyB64,
|
||||||
userPublicKey: publicKeyResponse.publicKey,
|
userPublicKey: publicKeyResponse.publicKey,
|
||||||
userKeyEncryptedPrivateKey: userKeyEncryptedPrivateKey,
|
userKeyEncryptedPrivateKey: userKeyEncryptedPrivateKey,
|
||||||
}),
|
}),
|
||||||
|
@ -89,8 +90,9 @@ export class DefaultUserAsymmetricKeysRegenerationService
|
||||||
}
|
}
|
||||||
|
|
||||||
private async regenerateUserAsymmetricKeys(userId: UserId): Promise<void> {
|
private async regenerateUserAsymmetricKeys(userId: UserId): Promise<void> {
|
||||||
|
const userKey = await firstValueFrom(this.keyService.userKey$(userId));
|
||||||
const makeKeyPairResponse = await firstValueFrom(
|
const makeKeyPairResponse = await firstValueFrom(
|
||||||
this.sdkService.userClient$(userId).pipe(map((sdk) => sdk.crypto().make_key_pair())),
|
this.sdkService.client$.pipe(map((sdk) => sdk.crypto().make_key_pair(userKey.keyB64))),
|
||||||
);
|
);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
Loading…
Reference in New Issue