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