mirror of
https://github.com/bitwarden/browser
synced 2026-02-25 00:53:22 +00:00
Add get other user's keys endpoint
This commit is contained in:
@@ -155,6 +155,8 @@ import { DeviceTrustServiceAbstraction } from "@bitwarden/common/key-management/
|
||||
import { DeviceTrustService } from "@bitwarden/common/key-management/device-trust/services/device-trust.service.implementation";
|
||||
import { KeyConnectorService as KeyConnectorServiceAbstraction } from "@bitwarden/common/key-management/key-connector/abstractions/key-connector.service";
|
||||
import { KeyConnectorService } from "@bitwarden/common/key-management/key-connector/services/key-connector.service";
|
||||
import { KeyApiService } from "@bitwarden/common/key-management/keys/services/abstractions/key-api-service.abstraction";
|
||||
import { DefaultKeyApiService } from "@bitwarden/common/key-management/keys/services/default-key-api-service.service";
|
||||
import {
|
||||
InternalMasterPasswordServiceAbstraction,
|
||||
MasterPasswordServiceAbstraction,
|
||||
@@ -746,6 +748,11 @@ const safeProviders: SafeProvider[] = [
|
||||
useClass: SendApiService,
|
||||
deps: [ApiServiceAbstraction, FileUploadServiceAbstraction, InternalSendService],
|
||||
}),
|
||||
safeProvider({
|
||||
provide: KeyApiService,
|
||||
useClass: DefaultKeyApiService,
|
||||
deps: [ApiServiceAbstraction],
|
||||
}),
|
||||
safeProvider({
|
||||
provide: SyncService,
|
||||
useClass: DefaultSyncService,
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
import { VerifyingKey } from "@bitwarden/key-management";
|
||||
|
||||
import { SignedPublicKeyOwnershipClaim } from "../../types";
|
||||
|
||||
export class PublicAccountKeysResponseModel {
|
||||
readonly VerifyingKey: VerifyingKey;
|
||||
readonly PublicKey: string;
|
||||
readonly SignedPublicKeyOwnershipClaim: SignedPublicKeyOwnershipClaim;
|
||||
|
||||
constructor(response: any) {
|
||||
this.VerifyingKey = new VerifyingKey(response.verifyingKey, response.verifyingKeyAlgorithm);
|
||||
this.PublicKey = response.publicKey;
|
||||
this.SignedPublicKeyOwnershipClaim = response.signedPublicKeyOwnershipClaim;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
import { PublicAccountKeysResponseModel } from "../../response/public-account-keys.response";
|
||||
|
||||
export class KeyApiService {
|
||||
getUserPublicKeys: (id: string) => Promise<PublicAccountKeysResponseModel>;
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
import { ApiService } from "../../../abstractions/api.service";
|
||||
import { PublicAccountKeysResponseModel } from "../response/public-account-keys.response";
|
||||
|
||||
import { KeyApiService } from "./abstractions/key-api-service.abstraction";
|
||||
|
||||
export class DefaultKeyApiService implements KeyApiService {
|
||||
constructor(private apiService: ApiService) {}
|
||||
|
||||
async getUserPublicKeys(id: string): Promise<PublicAccountKeysResponseModel> {
|
||||
const r = await this.apiService.send("GET", "/users/" + id + "/keys", null, true, true);
|
||||
return new PublicAccountKeysResponseModel(r);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user