mirror of
https://github.com/bitwarden/browser
synced 2026-02-19 10:54:00 +00:00
Add get other user's keys endpoint
This commit is contained in:
@@ -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