feat(api): add keyshare initiation for workspaces

This commit is contained in:
Karol Sójko
2022-10-12 14:05:11 +02:00
parent 3fbbacfc25
commit fabce1f7ac
15 changed files with 179 additions and 0 deletions

View File

@@ -22,4 +22,9 @@ export interface WorkspaceClientInterface {
}): Promise<{ success: boolean }>
listWorkspaces(): Promise<{ ownedWorkspaces: Array<Workspace>; joinedWorkspaces: Array<Workspace> }>
listWorkspaceUsers(dto: { workspaceUuid: Uuid }): Promise<{ users: Array<WorkspaceUser> }>
initiateKeyshare(dto: {
workspaceUuid: Uuid
userUuid: Uuid
encryptedWorkspaceKey: string
}): Promise<{ success: boolean }>
}

View File

@@ -14,6 +14,24 @@ export class WorkspaceManager extends AbstractService implements WorkspaceClient
super(internalEventBus)
}
async initiateKeyshare(dto: {
workspaceUuid: string
userUuid: string
encryptedWorkspaceKey: string
}): Promise<{ success: boolean }> {
try {
const result = await this.workspaceApiService.initiateKeyshare(dto)
if (result.data.error !== undefined) {
return { success: false }
}
return result.data
} catch (error) {
return { success: false }
}
}
async listWorkspaceUsers(dto: { workspaceUuid: string }): Promise<{ users: WorkspaceUser[] }> {
try {
const result = await this.workspaceApiService.listWorkspaceUsers(dto)