mirror of
https://github.com/bitwarden/browser
synced 2025-12-15 07:43:35 +00:00
[PM-18042] Build request response structure (#15163)
* feat: add support for discover command * feat: make client public to allow RPC * feat: update SDK
This commit is contained in:
@@ -1,17 +1,20 @@
|
||||
import { inject } from "@angular/core";
|
||||
|
||||
import { LogService } from "@bitwarden/common/platform/abstractions/log.service";
|
||||
import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
|
||||
import { SdkLoadService } from "@bitwarden/common/platform/abstractions/sdk/sdk-load.service";
|
||||
import { IpcMessage, IpcService, isIpcMessage } from "@bitwarden/common/platform/ipc";
|
||||
import {
|
||||
IncomingMessage,
|
||||
IpcClient,
|
||||
IpcCommunicationBackend,
|
||||
ipcRegisterDiscoverHandler,
|
||||
OutgoingMessage,
|
||||
} from "@bitwarden/sdk-internal";
|
||||
|
||||
export class WebIpcService extends IpcService {
|
||||
private logService = inject(LogService);
|
||||
private platformUtilsService = inject(PlatformUtilsService);
|
||||
private communicationBackend?: IpcCommunicationBackend;
|
||||
|
||||
override async init() {
|
||||
@@ -68,6 +71,12 @@ export class WebIpcService extends IpcService {
|
||||
});
|
||||
|
||||
await super.initWithClient(new IpcClient(this.communicationBackend));
|
||||
|
||||
if (this.platformUtilsService.isDev()) {
|
||||
await ipcRegisterDiscoverHandler(this.client, {
|
||||
version: await this.platformUtilsService.getApplicationVersion(),
|
||||
});
|
||||
}
|
||||
} catch (e) {
|
||||
this.logService.error("[IPC] Initialization failed", e);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user