@holochain/hc-spin 0.300.2-dev.3 → 0.300.2-dev.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@holochain/hc-spin",
3
- "version": "0.300.2-dev.3",
3
+ "version": "0.300.2-dev.4",
4
4
  "holochainVersion": "0.3.0-beta-dev.44",
5
5
  "description": "CLI to run Holochain aps during development.",
6
6
  "author": "matthme",
@@ -35,9 +35,10 @@
35
35
  "dependencies": {
36
36
  "@electron-toolkit/preload": "^3.0.0",
37
37
  "@electron-toolkit/utils": "^3.0.0",
38
- "@holochain/client": "^0.17.0-dev.9",
38
+ "@holochain/client": "0.17.0-dev.11",
39
39
  "@holochain/hc-spin-rust-utils": "^0.300.1",
40
40
  "@msgpack/msgpack": "^2.8.0",
41
+ "bufferutil": "4.0.8",
41
42
  "commander": "11.1.0",
42
43
  "electron": "^28.1.1",
43
44
  "electron-context-menu": "3.6.1",
@@ -50,7 +51,6 @@
50
51
  "@electron-toolkit/eslint-config-ts": "^1.0.1",
51
52
  "@electron-toolkit/tsconfig": "^1.0.1",
52
53
  "@types/node": "^18.19.5",
53
- "bufferutil": "4.0.8",
54
54
  "electron-builder": "^24.9.1",
55
55
  "electron-vite": "https://github.com/matthme/electron-vite.git#forward-cli-args-dist",
56
56
  "eslint": "^8.56.0",
package/src/main/index.ts CHANGED
@@ -10,6 +10,7 @@ import { ZomeCallNapi, ZomeCallSigner, ZomeCallUnsignedNapi } from '@holochain/h
10
10
  import { createHappWindow } from './windows';
11
11
  import getPort from 'get-port';
12
12
  import {
13
+ AdminWebsocket,
13
14
  AgentPubKey,
14
15
  AppWebsocket,
15
16
  CallZomeRequest,
@@ -329,14 +330,28 @@ app.whenReady().then(async () => {
329
330
  for (var i = 0; i < CLI_OPTS.numAgents; i++) {
330
331
  const zomeCallSigner = await rustUtils.ZomeCallSigner.connect(lairUrls[i], 'pass');
331
332
 
333
+ const adminPort = portsInfo[i].admin_port;
334
+ const adminWs = await AdminWebsocket.connect({
335
+ url: new URL(`ws://localhost:${adminPort}`),
336
+ wsClientOptions: {
337
+ origin: 'hc-spin',
338
+ },
339
+ });
340
+
341
+ const appAuthTokenResponse = await adminWs.issueAppAuthenticationToken({
342
+ installed_app_id: CLI_OPTS.appId,
343
+ single_use: false,
344
+ });
345
+
332
346
  const appPort = portsInfo[i].app_ports[0];
333
347
  const appWs = await AppWebsocket.connect({
334
348
  url: new URL(`ws://localhost:${appPort}`),
335
349
  wsClientOptions: {
336
350
  origin: 'hc-spin',
337
351
  },
352
+ token: appAuthTokenResponse.token,
338
353
  });
339
- const appInfo = await appWs.appInfo({ installed_app_id: CLI_OPTS.appId });
354
+ const appInfo = await appWs.appInfo();
340
355
  if (!appInfo) throw new Error('AppInfo is null.');
341
356
  const happWindow = await createHappWindow(
342
357
  CLI_OPTS.uiSource,
@@ -344,6 +359,7 @@ app.whenReady().then(async () => {
344
359
  CLI_OPTS.appId,
345
360
  i + 1,
346
361
  appPort,
362
+ appAuthTokenResponse.token,
347
363
  DATA_ROOT_DIR,
348
364
  CLI_OPTS.openDevtools,
349
365
  );
@@ -1,7 +1,7 @@
1
1
  import path from 'path';
2
2
  import fs from 'fs';
3
3
  import url from 'url';
4
- import { InstalledAppId } from '@holochain/client';
4
+ import { AppAuthenticationToken, InstalledAppId } from '@holochain/client';
5
5
  import { BrowserWindow, NativeImage, nativeImage, net, session, shell } from 'electron';
6
6
  import { is } from '@electron-toolkit/utils';
7
7
  import { HappOrWebhappPath } from './validateArgs';
@@ -22,6 +22,7 @@ export const createHappWindow = async (
22
22
  appId: InstalledAppId,
23
23
  agentNum: number,
24
24
  appPort: number,
25
+ appAuthToken: AppAuthenticationToken,
25
26
  appDataRootDir: string,
26
27
  openDevtools: boolean,
27
28
  ): Promise<BrowserWindow> => {
@@ -47,7 +48,7 @@ export const createHappWindow = async (
47
48
  electron.contextBridge.exposeInMainWorld("__HC_LAUNCHER_ENV__", {
48
49
  APP_INTERFACE_PORT: ${appPort},
49
50
  INSTALLED_APP_ID: "${appId}",
50
- FRAMEWORK: "electron"
51
+ APP_INTERFACE_TOKEN: [${appAuthToken}],
51
52
  });
52
53
  `;
53
54