@dxos/plugin-client 0.7.5-main.9d2a38b → 0.7.5-main.e94eead
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/dist/lib/browser/{app-graph-builder-6LOTDB4T.mjs → app-graph-builder-ON64R7SO.mjs} +2 -2
- package/dist/lib/browser/{chunk-E3OUNOEL.mjs → chunk-7DPLXOMO.mjs} +14 -2
- package/dist/lib/browser/chunk-7DPLXOMO.mjs.map +7 -0
- package/dist/lib/browser/chunk-EYBZZHSM.mjs +271 -0
- package/dist/lib/browser/chunk-EYBZZHSM.mjs.map +7 -0
- package/dist/lib/browser/{chunk-SVBQRT7I.mjs → chunk-GHEQL2E6.mjs} +1 -2
- package/dist/lib/browser/{chunk-SVBQRT7I.mjs.map → chunk-GHEQL2E6.mjs.map} +3 -3
- package/dist/lib/browser/{chunk-R4Q6H7RD.mjs → chunk-RGMLBYIF.mjs} +2 -2
- package/dist/lib/browser/{chunk-R4Q6H7RD.mjs.map → chunk-RGMLBYIF.mjs.map} +2 -2
- package/dist/lib/browser/{client-25GYH6TN.mjs → client-A7YSVURS.mjs} +4 -13
- package/dist/lib/browser/client-A7YSVURS.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +28 -15
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/intent-resolver-A6SKE7WJ.mjs +267 -0
- package/dist/lib/browser/intent-resolver-A6SKE7WJ.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{react-context-M3RT6SSG.mjs → react-context-R3SG55F5.mjs} +2 -2
- package/dist/lib/browser/{react-surface-XXONPG5T.mjs → react-surface-XGOUHVIH.mjs} +23 -7
- package/dist/lib/browser/react-surface-XGOUHVIH.mjs.map +7 -0
- package/dist/lib/browser/schema-J4MJIXRP.mjs +23 -0
- package/dist/lib/browser/schema-J4MJIXRP.mjs.map +7 -0
- package/dist/lib/browser/types.mjs +1 -1
- package/dist/lib/node/{app-graph-builder-JCND3P6G.cjs → app-graph-builder-RW7ESEX3.cjs} +6 -6
- package/dist/lib/node/chunk-7LVBFGKQ.cjs +299 -0
- package/dist/lib/node/chunk-7LVBFGKQ.cjs.map +7 -0
- package/dist/lib/node/{chunk-NVYWMDF3.cjs → chunk-TREVKZCJ.cjs} +17 -5
- package/dist/lib/node/chunk-TREVKZCJ.cjs.map +7 -0
- package/dist/lib/node/{chunk-3OB25QN2.cjs → chunk-UHIGZJQL.cjs} +4 -5
- package/dist/lib/node/{chunk-3OB25QN2.cjs.map → chunk-UHIGZJQL.cjs.map} +3 -3
- package/dist/lib/node/{chunk-IXVWJCYB.cjs → chunk-XPC4JOPP.cjs} +5 -5
- package/dist/lib/node/{chunk-IXVWJCYB.cjs.map → chunk-XPC4JOPP.cjs.map} +2 -2
- package/dist/lib/node/{client-52L4TUYU.cjs → client-2RQATBB6.cjs} +9 -18
- package/dist/lib/node/client-2RQATBB6.cjs.map +7 -0
- package/dist/lib/node/index.cjs +30 -17
- package/dist/lib/node/index.cjs.map +3 -3
- package/dist/lib/node/intent-resolver-DKQHARC2.cjs +275 -0
- package/dist/lib/node/intent-resolver-DKQHARC2.cjs.map +7 -0
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/{react-context-B2DNULH4.cjs → react-context-TD6VGBVA.cjs} +6 -6
- package/dist/lib/node/{react-surface-7USN5NOO.cjs → react-surface-IY7GXEGU.cjs} +28 -16
- package/dist/lib/node/react-surface-IY7GXEGU.cjs.map +7 -0
- package/dist/lib/node/schema-JXJS75HQ.cjs +39 -0
- package/dist/lib/node/schema-JXJS75HQ.cjs.map +7 -0
- package/dist/lib/node/types.cjs +2 -2
- package/dist/lib/node/types.cjs.map +1 -1
- package/dist/lib/node-esm/{app-graph-builder-ZLGKFBLY.mjs → app-graph-builder-TDYRWNI7.mjs} +2 -2
- package/dist/lib/node-esm/chunk-CRF22MJJ.mjs +272 -0
- package/dist/lib/node-esm/chunk-CRF22MJJ.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-74T33KTB.mjs → chunk-QJMF2MWP.mjs} +14 -2
- package/dist/lib/node-esm/chunk-QJMF2MWP.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-73M5MK5Q.mjs → chunk-QR72BXJK.mjs} +2 -2
- package/dist/lib/node-esm/{chunk-73M5MK5Q.mjs.map → chunk-QR72BXJK.mjs.map} +2 -2
- package/dist/lib/node-esm/{chunk-OBGRL3DF.mjs → chunk-T35SFKK3.mjs} +1 -2
- package/dist/lib/node-esm/{chunk-OBGRL3DF.mjs.map → chunk-T35SFKK3.mjs.map} +3 -3
- package/dist/lib/node-esm/{client-K52NWOUN.mjs → client-36DKBSB7.mjs} +4 -13
- package/dist/lib/node-esm/client-36DKBSB7.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +28 -15
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/intent-resolver-HFYRSXUG.mjs +268 -0
- package/dist/lib/node-esm/intent-resolver-HFYRSXUG.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/{react-context-IGEHJQK5.mjs → react-context-ZOGDOWJ2.mjs} +2 -2
- package/dist/lib/node-esm/{react-surface-CXLBCMPN.mjs → react-surface-F3PDFJMV.mjs} +23 -7
- package/dist/lib/node-esm/react-surface-F3PDFJMV.mjs.map +7 -0
- package/dist/lib/node-esm/schema-XM4HBLIX.mjs +24 -0
- package/dist/lib/node-esm/schema-XM4HBLIX.mjs.map +7 -0
- package/dist/lib/node-esm/types.mjs +1 -1
- package/dist/types/src/ClientPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/app-graph-builder.d.ts +110 -110
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
- package/dist/types/src/capabilities/capabilities.d.ts +0 -1
- package/dist/types/src/capabilities/capabilities.d.ts.map +1 -1
- package/dist/types/src/capabilities/client.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts +119 -117
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts +2 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- package/dist/types/src/capabilities/schema.d.ts +4 -0
- package/dist/types/src/capabilities/schema.d.ts.map +1 -0
- package/dist/types/src/components/IdentityDialog.d.ts +1 -2
- package/dist/types/src/components/IdentityDialog.d.ts.map +1 -1
- package/dist/types/src/components/JoinDialog.d.ts +1 -2
- package/dist/types/src/components/JoinDialog.d.ts.map +1 -1
- package/dist/types/src/components/ManageCredentialsDialog.d.ts +3 -0
- package/dist/types/src/components/ManageCredentialsDialog.d.ts.map +1 -0
- package/dist/types/src/components/ManageCredentialsDialog.stories.d.ts +8 -0
- package/dist/types/src/components/ManageCredentialsDialog.stories.d.ts.map +1 -0
- package/dist/types/src/components/RecoveryCodeDialog.d.ts +1 -2
- package/dist/types/src/components/RecoveryCodeDialog.d.ts.map +1 -1
- package/dist/types/src/components/RecoverySetupDialog.d.ts +3 -0
- package/dist/types/src/components/RecoverySetupDialog.d.ts.map +1 -0
- package/dist/types/src/components/RecoverySetupDialog.stories.d.ts +8 -0
- package/dist/types/src/components/RecoverySetupDialog.stories.d.ts.map +1 -0
- package/dist/types/src/components/index.d.ts +1 -0
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/events.d.ts +1 -1
- package/dist/types/src/translations.d.ts +7 -0
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types.d.ts +17 -1
- package/dist/types/src/types.d.ts.map +1 -1
- package/package.json +23 -17
- package/src/ClientPlugin.ts +11 -6
- package/src/capabilities/capabilities.ts +0 -1
- package/src/capabilities/client.ts +1 -9
- package/src/capabilities/index.ts +1 -0
- package/src/capabilities/intent-resolver.ts +171 -67
- package/src/capabilities/react-surface.tsx +21 -6
- package/src/capabilities/schema.ts +26 -0
- package/src/components/IdentityDialog.tsx +15 -3
- package/src/components/JoinDialog.tsx +1 -1
- package/src/components/ManageCredentialsDialog.stories.tsx +57 -0
- package/src/components/ManageCredentialsDialog.tsx +64 -0
- package/src/components/RecoveryCodeDialog.stories.tsx +5 -5
- package/src/components/RecoveryCodeDialog.tsx +2 -1
- package/src/components/RecoverySetupDialog.stories.tsx +77 -0
- package/src/components/RecoverySetupDialog.tsx +52 -0
- package/src/components/index.ts +1 -0
- package/src/events.ts +1 -1
- package/src/translations.ts +10 -1
- package/src/types.ts +11 -1
- package/dist/lib/browser/chunk-6IF6PREG.mjs +0 -158
- package/dist/lib/browser/chunk-6IF6PREG.mjs.map +0 -7
- package/dist/lib/browser/chunk-E3OUNOEL.mjs.map +0 -7
- package/dist/lib/browser/client-25GYH6TN.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-IWWLWOZD.mjs +0 -132
- package/dist/lib/browser/intent-resolver-IWWLWOZD.mjs.map +0 -7
- package/dist/lib/browser/react-surface-XXONPG5T.mjs.map +0 -7
- package/dist/lib/node/chunk-N3U7KVO3.cjs +0 -186
- package/dist/lib/node/chunk-N3U7KVO3.cjs.map +0 -7
- package/dist/lib/node/chunk-NVYWMDF3.cjs.map +0 -7
- package/dist/lib/node/client-52L4TUYU.cjs.map +0 -7
- package/dist/lib/node/intent-resolver-H3Y64MIP.cjs +0 -140
- package/dist/lib/node/intent-resolver-H3Y64MIP.cjs.map +0 -7
- package/dist/lib/node/react-surface-7USN5NOO.cjs.map +0 -7
- package/dist/lib/node-esm/chunk-74T33KTB.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-EHGD3UJH.mjs +0 -159
- package/dist/lib/node-esm/chunk-EHGD3UJH.mjs.map +0 -7
- package/dist/lib/node-esm/client-K52NWOUN.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-JCKD6R6L.mjs +0 -133
- package/dist/lib/node-esm/intent-resolver-JCKD6R6L.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-CXLBCMPN.mjs.map +0 -7
- /package/dist/lib/browser/{app-graph-builder-6LOTDB4T.mjs.map → app-graph-builder-ON64R7SO.mjs.map} +0 -0
- /package/dist/lib/browser/{react-context-M3RT6SSG.mjs.map → react-context-R3SG55F5.mjs.map} +0 -0
- /package/dist/lib/node/{app-graph-builder-JCND3P6G.cjs.map → app-graph-builder-RW7ESEX3.cjs.map} +0 -0
- /package/dist/lib/node/{react-context-B2DNULH4.cjs.map → react-context-TD6VGBVA.cjs.map} +0 -0
- /package/dist/lib/node-esm/{app-graph-builder-ZLGKFBLY.mjs.map → app-graph-builder-TDYRWNI7.mjs.map} +0 -0
- /package/dist/lib/node-esm/{react-context-IGEHJQK5.mjs.map → react-context-ZOGDOWJ2.mjs.map} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/capabilities/capabilities.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { defineCapability } from '@dxos/app-framework';\nimport { type TypedObject } from '@dxos/echo-schema';\nimport { type Client } from '@dxos/react-client';\n\nimport { CLIENT_PLUGIN } from '../meta';\n\nexport namespace ClientCapabilities {\n export const Client = defineCapability<Client>(`${CLIENT_PLUGIN}/capability/client`);\n export const Schema = defineCapability<TypedObject[]>(`${CLIENT_PLUGIN}/capability/schema`);\n
|
|
5
|
-
"mappings": ";;;;;;AAIA,SAASA,wBAAwB;;UAMhBC,qBAAAA;sBACFC,SAASC,iBAAyB,GAAGC,aAAAA,oBAAiC;sBACtEC,SAASF,iBAAgC,GAAGC,aAAAA,oBAAiC;
|
|
6
|
-
"names": ["defineCapability", "ClientCapabilities", "Client", "defineCapability", "CLIENT_PLUGIN", "Schema"
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { defineCapability } from '@dxos/app-framework';\nimport { type TypedObject } from '@dxos/echo-schema';\nimport { type Client } from '@dxos/react-client';\n\nimport { CLIENT_PLUGIN } from '../meta';\n\nexport namespace ClientCapabilities {\n export const Client = defineCapability<Client>(`${CLIENT_PLUGIN}/capability/client`);\n export const Schema = defineCapability<TypedObject[]>(`${CLIENT_PLUGIN}/capability/schema`);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;AAIA,SAASA,wBAAwB;;UAMhBC,qBAAAA;sBACFC,SAASC,iBAAyB,GAAGC,aAAAA,oBAAiC;sBACtEC,SAASF,iBAAgC,GAAGC,aAAAA,oBAAiC;AAC5F,GAHiBH,uBAAAA,qBAAAA,CAAAA,EAAAA;",
|
|
6
|
+
"names": ["defineCapability", "ClientCapabilities", "Client", "defineCapability", "CLIENT_PLUGIN", "Schema"]
|
|
7
7
|
}
|
|
@@ -1,28 +1,19 @@
|
|
|
1
1
|
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
ClientEvents
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-QR72BXJK.mjs";
|
|
5
5
|
import {
|
|
6
6
|
ClientCapabilities
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-T35SFKK3.mjs";
|
|
8
8
|
import "./chunk-HO7WDE7C.mjs";
|
|
9
9
|
|
|
10
10
|
// packages/plugins/plugin-client/src/capabilities/client.ts
|
|
11
11
|
import { contributes } from "@dxos/app-framework";
|
|
12
|
-
import { Config, Defaults, Envs, Local, Storage } from "@dxos/config";
|
|
13
12
|
import { Client } from "@dxos/react-client";
|
|
14
13
|
var client_default = async ({ context, onClientInitialized, ...options }) => {
|
|
15
|
-
const
|
|
16
|
-
const client = new Client({
|
|
17
|
-
config,
|
|
18
|
-
...options
|
|
19
|
-
});
|
|
14
|
+
const client = new Client(options);
|
|
20
15
|
await client.initialize();
|
|
21
16
|
await onClientInitialized?.(context, client);
|
|
22
|
-
const systemSchemas = Array.from(new Set(context.requestCapabilities(ClientCapabilities.SystemSchema).flat()));
|
|
23
|
-
const schemas = Array.from(new Set(context.requestCapabilities(ClientCapabilities.Schema).flat()));
|
|
24
|
-
client.addTypes(systemSchemas);
|
|
25
|
-
client.addTypes(schemas);
|
|
26
17
|
client.reloaded.on(() => {
|
|
27
18
|
client.halo.identity.subscribe(async (identity) => {
|
|
28
19
|
if (identity) {
|
|
@@ -43,4 +34,4 @@ var client_default = async ({ context, onClientInitialized, ...options }) => {
|
|
|
43
34
|
export {
|
|
44
35
|
client_default as default
|
|
45
36
|
};
|
|
46
|
-
//# sourceMappingURL=client-
|
|
37
|
+
//# sourceMappingURL=client-36DKBSB7.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/capabilities/client.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { contributes, type PluginsContext } from '@dxos/app-framework';\nimport { Client } from '@dxos/react-client';\n\nimport { ClientCapabilities } from './capabilities';\nimport { ClientEvents } from '../events';\nimport { type ClientPluginOptions } from '../types';\n\ntype ClientCapabilityOptions = Omit<ClientPluginOptions, 'appKey' | 'invitationUrl' | 'invitationParam' | 'onReset'> & {\n context: PluginsContext;\n};\n\nexport default async ({ context, onClientInitialized, ...options }: ClientCapabilityOptions) => {\n const client = new Client(options);\n await client.initialize();\n await onClientInitialized?.(context, client);\n\n // TODO(wittjosiah): Remove. This is a hack to get the app to boot with the new identity after a reset.\n client.reloaded.on(() => {\n client.halo.identity.subscribe(async (identity) => {\n if (identity) {\n window.location.href = window.location.origin;\n }\n });\n });\n\n const subscription = client.spaces.isReady.subscribe(async (ready) => {\n if (ready) {\n await context.activate(ClientEvents.SpacesReady);\n }\n });\n\n return contributes(ClientCapabilities.Client, client, async () => {\n subscription.unsubscribe();\n await client.destroy();\n });\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;AAIA,SAASA,mBAAwC;AACjD,SAASC,cAAc;AAUvB,IAAA,iBAAe,OAAO,EAAEC,SAASC,qBAAqB,GAAGC,QAAAA,MAAkC;AACzF,QAAMC,SAAS,IAAIC,OAAOF,OAAAA;AAC1B,QAAMC,OAAOE,WAAU;AACvB,QAAMJ,sBAAsBD,SAASG,MAAAA;AAGrCA,SAAOG,SAASC,GAAG,MAAA;AACjBJ,WAAOK,KAAKC,SAASC,UAAU,OAAOD,aAAAA;AACpC,UAAIA,UAAU;AACZE,eAAOC,SAASC,OAAOF,OAAOC,SAASE;MACzC;IACF,CAAA;EACF,CAAA;AAEA,QAAMC,eAAeZ,OAAOa,OAAOC,QAAQP,UAAU,OAAOQ,UAAAA;AAC1D,QAAIA,OAAO;AACT,YAAMlB,QAAQmB,SAASC,aAAaC,WAAW;IACjD;EACF,CAAA;AAEA,SAAOC,YAAYC,mBAAmBnB,QAAQD,QAAQ,YAAA;AACpDY,iBAAaS,YAAW;AACxB,UAAMrB,OAAOsB,QAAO;EACtB,CAAA;AACF;",
|
|
6
|
+
"names": ["contributes", "Client", "context", "onClientInitialized", "options", "client", "Client", "initialize", "reloaded", "on", "halo", "identity", "subscribe", "window", "location", "href", "origin", "subscription", "spaces", "isReady", "ready", "activate", "ClientEvents", "SpacesReady", "contributes", "ClientCapabilities", "unsubscribe", "destroy"]
|
|
7
|
+
}
|
|
@@ -1,25 +1,26 @@
|
|
|
1
1
|
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
ClientEvents
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-QR72BXJK.mjs";
|
|
5
5
|
import {
|
|
6
6
|
ClientCapabilities
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-T35SFKK3.mjs";
|
|
8
8
|
import {
|
|
9
9
|
CLIENT_PLUGIN,
|
|
10
10
|
meta
|
|
11
11
|
} from "./chunk-HO7WDE7C.mjs";
|
|
12
12
|
|
|
13
13
|
// packages/plugins/plugin-client/src/ClientPlugin.ts
|
|
14
|
-
import { Capabilities, contributes, defineModule, definePlugin, Events } from "@dxos/app-framework";
|
|
14
|
+
import { Capabilities, contributes, defineModule, definePlugin, Events, oneOf } from "@dxos/app-framework";
|
|
15
15
|
|
|
16
16
|
// packages/plugins/plugin-client/src/capabilities/index.ts
|
|
17
17
|
import { lazy } from "@dxos/app-framework";
|
|
18
|
-
var AppGraphBuilder = lazy(async () => import("./app-graph-builder-
|
|
19
|
-
var Client = lazy(async () => import("./client-
|
|
20
|
-
var IntentResolver = lazy(async () => import("./intent-resolver-
|
|
21
|
-
var ReactContext = lazy(async () => import("./react-context-
|
|
22
|
-
var ReactSurface = lazy(async () => import("./react-surface-
|
|
18
|
+
var AppGraphBuilder = lazy(async () => import("./app-graph-builder-TDYRWNI7.mjs"));
|
|
19
|
+
var Client = lazy(async () => import("./client-36DKBSB7.mjs"));
|
|
20
|
+
var IntentResolver = lazy(async () => import("./intent-resolver-HFYRSXUG.mjs"));
|
|
21
|
+
var ReactContext = lazy(async () => import("./react-context-ZOGDOWJ2.mjs"));
|
|
22
|
+
var ReactSurface = lazy(async () => import("./react-surface-F3PDFJMV.mjs"));
|
|
23
|
+
var Schema = lazy(async () => import("./schema-XM4HBLIX.mjs"));
|
|
23
24
|
|
|
24
25
|
// packages/plugins/plugin-client/src/translations.ts
|
|
25
26
|
var translations_default = [
|
|
@@ -27,7 +28,14 @@ var translations_default = [
|
|
|
27
28
|
"en-US": {
|
|
28
29
|
[CLIENT_PLUGIN]: {
|
|
29
30
|
"open shell label": "Open HALO",
|
|
30
|
-
"
|
|
31
|
+
"manage credentials dialog title": "Manage Account Recovery",
|
|
32
|
+
"recovery setup dialog title": "Account Recovery",
|
|
33
|
+
"recovery setup dialog description": "In order to recover your account you need to register a recovery credential. Passkeys are the recommended way to do this, they can be stored in your browser or in a password manager.",
|
|
34
|
+
"create passkey label": "Create Passkey",
|
|
35
|
+
"create passkey description": "A passkey is a secure and easy to use credential that can be used to recover your account.",
|
|
36
|
+
"create recovery code label": "Create Recovery Code",
|
|
37
|
+
"create recovery code description": "A recovery code is 12 word phrase representing a private key.",
|
|
38
|
+
"recovery code dialog title": "Recovery Code",
|
|
31
39
|
"recovery code dialog description": "This is your identity recovery code, store it in a safe place. You can use it to recover your identity if you ever lose access to your devices.",
|
|
32
40
|
"recovery code dialog warning 1": "NOTE: This code will not be displayed again.",
|
|
33
41
|
"recovery code dialog warning 2": "It is your private key for recovering DXOS data. Anyone with this key will be able to gain access to your account.",
|
|
@@ -48,10 +56,7 @@ var ClientPlugin = ({ invitationUrl = window.location.origin, invitationParam =
|
|
|
48
56
|
return definePlugin(meta, [
|
|
49
57
|
defineModule({
|
|
50
58
|
id: `${meta.id}/module/client`,
|
|
51
|
-
activatesOn: Events.Startup,
|
|
52
|
-
activatesBefore: [
|
|
53
|
-
ClientEvents.SetupClient
|
|
54
|
-
],
|
|
59
|
+
activatesOn: oneOf(Events.Startup, Events.SetupAppGraph),
|
|
55
60
|
activatesAfter: [
|
|
56
61
|
ClientEvents.ClientReady
|
|
57
62
|
],
|
|
@@ -60,6 +65,14 @@ var ClientPlugin = ({ invitationUrl = window.location.origin, invitationParam =
|
|
|
60
65
|
context
|
|
61
66
|
})
|
|
62
67
|
}),
|
|
68
|
+
defineModule({
|
|
69
|
+
id: `${meta.id}/module/schema`,
|
|
70
|
+
activatesOn: ClientEvents.ClientReady,
|
|
71
|
+
activatesBefore: [
|
|
72
|
+
ClientEvents.SetupSchema
|
|
73
|
+
],
|
|
74
|
+
activate: Schema
|
|
75
|
+
}),
|
|
63
76
|
defineModule({
|
|
64
77
|
id: `${meta.id}/module/react-context`,
|
|
65
78
|
activatesOn: Events.Startup,
|
|
@@ -67,7 +80,7 @@ var ClientPlugin = ({ invitationUrl = window.location.origin, invitationParam =
|
|
|
67
80
|
}),
|
|
68
81
|
defineModule({
|
|
69
82
|
id: `${meta.id}/module/react-surface`,
|
|
70
|
-
activatesOn: Events.
|
|
83
|
+
activatesOn: Events.SetupReactSurface,
|
|
71
84
|
activate: () => ReactSurface({
|
|
72
85
|
createInvitationUrl
|
|
73
86
|
})
|
|
@@ -79,7 +92,7 @@ var ClientPlugin = ({ invitationUrl = window.location.origin, invitationParam =
|
|
|
79
92
|
}),
|
|
80
93
|
defineModule({
|
|
81
94
|
id: `${meta.id}/module/intent-resolver`,
|
|
82
|
-
activatesOn: Events.
|
|
95
|
+
activatesOn: Events.SetupIntentResolver,
|
|
83
96
|
activate: (context) => IntentResolver({
|
|
84
97
|
context,
|
|
85
98
|
onReset
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/ClientPlugin.ts", "../../../src/capabilities/index.ts", "../../../src/translations.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { Capabilities, contributes, defineModule, definePlugin, Events } from '@dxos/app-framework';\n\nimport { Client, AppGraphBuilder, IntentResolver, ReactContext, ReactSurface } from './capabilities';\nimport { ClientEvents } from './events';\nimport { meta } from './meta';\nimport translations from './translations';\nimport { type ClientPluginOptions } from './types';\n\nexport const ClientPlugin = ({\n invitationUrl = window.location.origin,\n invitationParam = 'deviceInvitationCode',\n onReset,\n ...options\n}: ClientPluginOptions) => {\n const createInvitationUrl = (invitationCode: string) => {\n const baseUrl = new URL(invitationUrl);\n baseUrl.searchParams.set(invitationParam, invitationCode);\n return baseUrl.toString();\n };\n\n return definePlugin(meta, [\n defineModule({\n id: `${meta.id}/module/client`,\n activatesOn: Events.Startup
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;AAIA,SAASA,cAAcC,aAAaC,cAAcC,cAAcC,
|
|
6
|
-
"names": ["Capabilities", "contributes", "defineModule", "definePlugin", "Events", "lazy", "AppGraphBuilder", "lazy", "Client", "IntentResolver", "ReactContext", "ReactSurface", "CLIENT_PLUGIN", "ClientPlugin", "invitationUrl", "window", "location", "origin", "invitationParam", "onReset", "options", "createInvitationUrl", "invitationCode", "baseUrl", "URL", "searchParams", "set", "toString", "definePlugin", "meta", "defineModule", "id", "activatesOn", "
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { Capabilities, contributes, defineModule, definePlugin, Events, oneOf } from '@dxos/app-framework';\n\nimport { Client, AppGraphBuilder, IntentResolver, ReactContext, ReactSurface, Schema } from './capabilities';\nimport { ClientEvents } from './events';\nimport { meta } from './meta';\nimport translations from './translations';\nimport { type ClientPluginOptions } from './types';\n\nexport const ClientPlugin = ({\n invitationUrl = window.location.origin,\n invitationParam = 'deviceInvitationCode',\n onReset,\n ...options\n}: ClientPluginOptions) => {\n const createInvitationUrl = (invitationCode: string) => {\n const baseUrl = new URL(invitationUrl);\n baseUrl.searchParams.set(invitationParam, invitationCode);\n return baseUrl.toString();\n };\n\n return definePlugin(meta, [\n defineModule({\n id: `${meta.id}/module/client`,\n activatesOn: oneOf(Events.Startup, Events.SetupAppGraph),\n activatesAfter: [ClientEvents.ClientReady],\n activate: (context) => Client({ ...options, context }),\n }),\n defineModule({\n id: `${meta.id}/module/schema`,\n activatesOn: ClientEvents.ClientReady,\n activatesBefore: [ClientEvents.SetupSchema],\n activate: Schema,\n }),\n defineModule({\n id: `${meta.id}/module/react-context`,\n activatesOn: Events.Startup,\n activate: ReactContext,\n }),\n defineModule({\n id: `${meta.id}/module/react-surface`,\n activatesOn: Events.SetupReactSurface,\n activate: () => ReactSurface({ createInvitationUrl }),\n }),\n defineModule({\n id: `${meta.id}/module/app-graph-builder`,\n activatesOn: Events.SetupAppGraph,\n activate: AppGraphBuilder,\n }),\n defineModule({\n id: `${meta.id}/module/intent-resolver`,\n activatesOn: Events.SetupIntentResolver,\n activate: (context) => IntentResolver({ context, onReset }),\n }),\n defineModule({\n id: `${meta.id}/module/translations`,\n activatesOn: Events.SetupTranslations,\n activate: () => contributes(Capabilities.Translations, translations),\n }),\n ]);\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { lazy } from '@dxos/app-framework';\n\nexport const AppGraphBuilder = lazy(async () => import('./app-graph-builder'));\nexport const Client = lazy(async () => import('./client'));\nexport const IntentResolver = lazy(async () => import('./intent-resolver'));\nexport const ReactContext = lazy(async () => import('./react-context'));\nexport const ReactSurface = lazy(async () => import('./react-surface'));\nexport const Schema = lazy(async () => import('./schema'));\n\nexport * from './capabilities';\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { CLIENT_PLUGIN } from './meta';\n\nexport default [\n {\n 'en-US': {\n [CLIENT_PLUGIN]: {\n 'open shell label': 'Open HALO',\n 'manage credentials dialog title': 'Manage Account Recovery',\n 'recovery setup dialog title': 'Account Recovery',\n 'recovery setup dialog description':\n 'In order to recover your account you need to register a recovery credential. Passkeys are the recommended way to do this, they can be stored in your browser or in a password manager.',\n 'create passkey label': 'Create Passkey',\n 'create passkey description':\n 'A passkey is a secure and easy to use credential that can be used to recover your account.',\n 'create recovery code label': 'Create Recovery Code',\n 'create recovery code description': 'A recovery code is 12 word phrase representing a private key.',\n 'recovery code dialog title': 'Recovery Code',\n 'recovery code dialog description':\n 'This is your identity recovery code, store it in a safe place. You can use it to recover your identity if you ever lose access to your devices.',\n 'recovery code dialog warning 1': 'NOTE: This code will not be displayed again.',\n 'recovery code dialog warning 2':\n 'It is your private key for recovering DXOS data. Anyone with this key will be able to gain access to your account.',\n 'recovery code confirmation label': 'Please confirm you have saved the code.',\n 'continue label': 'Continue',\n },\n },\n },\n];\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;AAIA,SAASA,cAAcC,aAAaC,cAAcC,cAAcC,QAAQC,aAAa;;;ACArF,SAASC,YAAY;AAEd,IAAMC,kBAAkBC,KAAK,YAAY,OAAO,kCAAA,CAAA;AAChD,IAAMC,SAASD,KAAK,YAAY,OAAO,uBAAA,CAAA;AACvC,IAAME,iBAAiBF,KAAK,YAAY,OAAO,gCAAA,CAAA;AAC/C,IAAMG,eAAeH,KAAK,YAAY,OAAO,8BAAA,CAAA;AAC7C,IAAMI,eAAeJ,KAAK,YAAY,OAAO,8BAAA,CAAA;AAC7C,IAAMK,SAASL,KAAK,YAAY,OAAO,uBAAA,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AI,GAAGF,KAAKE,EAAE;MACdC,aAAaE,OAAOgB;MACpBV,UAAU,CAACC,YAAYU,eAAe;QAAEV;QAAStB;MAAQ,CAAA;IAC3D,CAAA;IACAW,aAAa;MACXC,IAAI,GAAGF,KAAKE,EAAE;MACdC,aAAaE,OAAOkB;MACpBZ,UAAU,MAAMa,YAAYC,aAAaC,cAAcC,oBAAAA;IACzD,CAAA;GACD;AACH;",
|
|
6
|
+
"names": ["Capabilities", "contributes", "defineModule", "definePlugin", "Events", "oneOf", "lazy", "AppGraphBuilder", "lazy", "Client", "IntentResolver", "ReactContext", "ReactSurface", "Schema", "CLIENT_PLUGIN", "ClientPlugin", "invitationUrl", "window", "location", "origin", "invitationParam", "onReset", "options", "createInvitationUrl", "invitationCode", "baseUrl", "URL", "searchParams", "set", "toString", "definePlugin", "meta", "defineModule", "id", "activatesOn", "oneOf", "Events", "Startup", "SetupAppGraph", "activatesAfter", "ClientEvents", "ClientReady", "activate", "context", "Client", "activatesBefore", "SetupSchema", "Schema", "ReactContext", "SetupReactSurface", "ReactSurface", "AppGraphBuilder", "SetupIntentResolver", "IntentResolver", "SetupTranslations", "contributes", "Capabilities", "Translations", "translations"]
|
|
7
7
|
}
|
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
ClientEvents
|
|
4
|
+
} from "./chunk-QR72BXJK.mjs";
|
|
5
|
+
import {
|
|
6
|
+
IDENTITY_DIALOG,
|
|
7
|
+
JOIN_DIALOG,
|
|
8
|
+
RECOVER_CODE_DIALOG
|
|
9
|
+
} from "./chunk-CRF22MJJ.mjs";
|
|
10
|
+
import {
|
|
11
|
+
ClientAction
|
|
12
|
+
} from "./chunk-QJMF2MWP.mjs";
|
|
13
|
+
import {
|
|
14
|
+
ClientCapabilities
|
|
15
|
+
} from "./chunk-T35SFKK3.mjs";
|
|
16
|
+
import "./chunk-HO7WDE7C.mjs";
|
|
17
|
+
|
|
18
|
+
// packages/plugins/plugin-client/src/capabilities/intent-resolver.ts
|
|
19
|
+
import { Capabilities, contributes, createIntent, createResolver, LayoutAction } from "@dxos/app-framework";
|
|
20
|
+
import { invariant } from "@dxos/invariant";
|
|
21
|
+
import { ObservabilityAction } from "@dxos/plugin-observability/types";
|
|
22
|
+
import { PublicKey } from "@dxos/react-client";
|
|
23
|
+
var __dxlog_file = "/home/runner/work/dxos/dxos/packages/plugins/plugin-client/src/capabilities/intent-resolver.ts";
|
|
24
|
+
var intent_resolver_default = ({ context, appName = "Composer", onReset }) => contributes(Capabilities.IntentResolver, [
|
|
25
|
+
createResolver({
|
|
26
|
+
intent: ClientAction.CreateIdentity,
|
|
27
|
+
resolve: async () => {
|
|
28
|
+
const manager = context.requestCapability(Capabilities.PluginManager);
|
|
29
|
+
const client = context.requestCapability(ClientCapabilities.Client);
|
|
30
|
+
const data = await client.halo.createIdentity();
|
|
31
|
+
await manager.activate(ClientEvents.IdentityCreated);
|
|
32
|
+
return {
|
|
33
|
+
data,
|
|
34
|
+
intents: [
|
|
35
|
+
createIntent(ObservabilityAction.SendEvent, {
|
|
36
|
+
name: "identity.create"
|
|
37
|
+
})
|
|
38
|
+
]
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
}),
|
|
42
|
+
createResolver({
|
|
43
|
+
intent: ClientAction.JoinIdentity,
|
|
44
|
+
resolve: async (data) => {
|
|
45
|
+
return {
|
|
46
|
+
intents: [
|
|
47
|
+
createIntent(LayoutAction.UpdateDialog, {
|
|
48
|
+
part: "dialog",
|
|
49
|
+
subject: JOIN_DIALOG,
|
|
50
|
+
options: {
|
|
51
|
+
blockAlign: "start",
|
|
52
|
+
props: {
|
|
53
|
+
initialInvitationCode: data.invitationCode,
|
|
54
|
+
initialDisposition: "accept-halo-invitation"
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
})
|
|
58
|
+
]
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
}),
|
|
62
|
+
createResolver({
|
|
63
|
+
intent: ClientAction.ShareIdentity,
|
|
64
|
+
resolve: async () => {
|
|
65
|
+
return {
|
|
66
|
+
intents: [
|
|
67
|
+
createIntent(LayoutAction.UpdateDialog, {
|
|
68
|
+
part: "dialog",
|
|
69
|
+
subject: IDENTITY_DIALOG,
|
|
70
|
+
options: {
|
|
71
|
+
blockAlign: "start"
|
|
72
|
+
}
|
|
73
|
+
}),
|
|
74
|
+
createIntent(ObservabilityAction.SendEvent, {
|
|
75
|
+
name: "identity.share"
|
|
76
|
+
})
|
|
77
|
+
]
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
}),
|
|
81
|
+
createResolver({
|
|
82
|
+
intent: ClientAction.RecoverIdentity,
|
|
83
|
+
resolve: async () => {
|
|
84
|
+
return {
|
|
85
|
+
intents: [
|
|
86
|
+
createIntent(LayoutAction.UpdateDialog, {
|
|
87
|
+
part: "dialog",
|
|
88
|
+
subject: JOIN_DIALOG,
|
|
89
|
+
options: {
|
|
90
|
+
blockAlign: "start",
|
|
91
|
+
props: {
|
|
92
|
+
initialDisposition: "recover-identity"
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
})
|
|
96
|
+
]
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
}),
|
|
100
|
+
createResolver({
|
|
101
|
+
intent: ClientAction.ResetStorage,
|
|
102
|
+
resolve: async (data) => {
|
|
103
|
+
await onReset?.({
|
|
104
|
+
target: data.target
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
}),
|
|
108
|
+
createResolver({
|
|
109
|
+
intent: ClientAction.CreateAgent,
|
|
110
|
+
resolve: async () => {
|
|
111
|
+
const client = context.requestCapability(ClientCapabilities.Client);
|
|
112
|
+
invariant(client.services.services.EdgeAgentService, "Missing EdgeAgentService", {
|
|
113
|
+
F: __dxlog_file,
|
|
114
|
+
L: 106,
|
|
115
|
+
S: void 0,
|
|
116
|
+
A: [
|
|
117
|
+
"client.services.services.EdgeAgentService",
|
|
118
|
+
"'Missing EdgeAgentService'"
|
|
119
|
+
]
|
|
120
|
+
});
|
|
121
|
+
await client.services.services.EdgeAgentService.createAgent(null, {
|
|
122
|
+
timeout: 1e4
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
}),
|
|
126
|
+
createResolver({
|
|
127
|
+
intent: ClientAction.CreateRecoveryCode,
|
|
128
|
+
resolve: async () => {
|
|
129
|
+
const client = context.requestCapability(ClientCapabilities.Client);
|
|
130
|
+
invariant(client.services.services.IdentityService, "IdentityService not available", {
|
|
131
|
+
F: __dxlog_file,
|
|
132
|
+
L: 114,
|
|
133
|
+
S: void 0,
|
|
134
|
+
A: [
|
|
135
|
+
"client.services.services.IdentityService",
|
|
136
|
+
"'IdentityService not available'"
|
|
137
|
+
]
|
|
138
|
+
});
|
|
139
|
+
const { recoveryCode } = await client.services.services.IdentityService.createRecoveryCredential({});
|
|
140
|
+
return {
|
|
141
|
+
intents: [
|
|
142
|
+
createIntent(LayoutAction.UpdateDialog, {
|
|
143
|
+
part: "dialog",
|
|
144
|
+
subject: RECOVER_CODE_DIALOG,
|
|
145
|
+
options: {
|
|
146
|
+
blockAlign: "start",
|
|
147
|
+
type: "alert",
|
|
148
|
+
props: {
|
|
149
|
+
code: recoveryCode
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
})
|
|
153
|
+
]
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
}),
|
|
157
|
+
createResolver({
|
|
158
|
+
intent: ClientAction.CreatePasskey,
|
|
159
|
+
resolve: async () => {
|
|
160
|
+
const client = context.requestCapability(ClientCapabilities.Client);
|
|
161
|
+
const identity = client.halo.identity.get();
|
|
162
|
+
invariant(identity, "Identity not available", {
|
|
163
|
+
F: __dxlog_file,
|
|
164
|
+
L: 137,
|
|
165
|
+
S: void 0,
|
|
166
|
+
A: [
|
|
167
|
+
"identity",
|
|
168
|
+
"'Identity not available'"
|
|
169
|
+
]
|
|
170
|
+
});
|
|
171
|
+
const lookupKey = PublicKey.random();
|
|
172
|
+
const credential = await navigator.credentials.create({
|
|
173
|
+
publicKey: {
|
|
174
|
+
challenge: new Uint8Array(),
|
|
175
|
+
rp: {
|
|
176
|
+
id: location.hostname,
|
|
177
|
+
name: appName
|
|
178
|
+
},
|
|
179
|
+
user: {
|
|
180
|
+
id: lookupKey.asUint8Array(),
|
|
181
|
+
name: identity.did,
|
|
182
|
+
displayName: identity.profile?.displayName ?? ""
|
|
183
|
+
},
|
|
184
|
+
pubKeyCredParams: [
|
|
185
|
+
{
|
|
186
|
+
type: "public-key",
|
|
187
|
+
alg: -8
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
type: "public-key",
|
|
191
|
+
alg: -7
|
|
192
|
+
}
|
|
193
|
+
],
|
|
194
|
+
// https://web.dev/articles/webauthn-discoverable-credentials#resident-key
|
|
195
|
+
authenticatorSelection: {
|
|
196
|
+
residentKey: "required",
|
|
197
|
+
requireResidentKey: true
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
});
|
|
201
|
+
invariant(credential, "Credential not available", {
|
|
202
|
+
F: __dxlog_file,
|
|
203
|
+
L: 162,
|
|
204
|
+
S: void 0,
|
|
205
|
+
A: [
|
|
206
|
+
"credential",
|
|
207
|
+
"'Credential not available'"
|
|
208
|
+
]
|
|
209
|
+
});
|
|
210
|
+
const recoveryKey = PublicKey.from(new Uint8Array(credential.response.getPublicKey()));
|
|
211
|
+
const algorithm = credential.response.getPublicKeyAlgorithm() === -7 ? "ES256" : "ED25519";
|
|
212
|
+
invariant(client.services.services.IdentityService, "IdentityService not available", {
|
|
213
|
+
F: __dxlog_file,
|
|
214
|
+
L: 167,
|
|
215
|
+
S: void 0,
|
|
216
|
+
A: [
|
|
217
|
+
"client.services.services.IdentityService",
|
|
218
|
+
"'IdentityService not available'"
|
|
219
|
+
]
|
|
220
|
+
});
|
|
221
|
+
await client.services.services.IdentityService.createRecoveryCredential({
|
|
222
|
+
data: {
|
|
223
|
+
recoveryKey,
|
|
224
|
+
algorithm,
|
|
225
|
+
lookupKey
|
|
226
|
+
}
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
}),
|
|
230
|
+
createResolver({
|
|
231
|
+
intent: ClientAction.RedeemPasskey,
|
|
232
|
+
resolve: async () => {
|
|
233
|
+
const client = context.requestCapability(ClientCapabilities.Client);
|
|
234
|
+
invariant(client.services.services.IdentityService, "IdentityService not available", {
|
|
235
|
+
F: __dxlog_file,
|
|
236
|
+
L: 182,
|
|
237
|
+
S: void 0,
|
|
238
|
+
A: [
|
|
239
|
+
"client.services.services.IdentityService",
|
|
240
|
+
"'IdentityService not available'"
|
|
241
|
+
]
|
|
242
|
+
});
|
|
243
|
+
const { deviceKey, controlFeedKey, challenge } = await client.services.services.IdentityService.requestRecoveryChallenge();
|
|
244
|
+
const credential = await navigator.credentials.get({
|
|
245
|
+
publicKey: {
|
|
246
|
+
challenge: Buffer.from(challenge, "base64"),
|
|
247
|
+
rpId: location.hostname,
|
|
248
|
+
userVerification: "required"
|
|
249
|
+
}
|
|
250
|
+
});
|
|
251
|
+
const lookupKey = PublicKey.from(new Uint8Array(credential.response.userHandle));
|
|
252
|
+
await client.services.services.IdentityService.recoverIdentity({
|
|
253
|
+
external: {
|
|
254
|
+
lookupKey,
|
|
255
|
+
deviceKey,
|
|
256
|
+
controlFeedKey,
|
|
257
|
+
signature: Buffer.from(credential.response.signature),
|
|
258
|
+
clientDataJson: Buffer.from(credential.response.clientDataJSON),
|
|
259
|
+
authenticatorData: Buffer.from(credential.response.authenticatorData)
|
|
260
|
+
}
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
})
|
|
264
|
+
]);
|
|
265
|
+
export {
|
|
266
|
+
intent_resolver_default as default
|
|
267
|
+
};
|
|
268
|
+
//# sourceMappingURL=intent-resolver-HFYRSXUG.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/capabilities/intent-resolver.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport {\n Capabilities,\n contributes,\n createIntent,\n createResolver,\n LayoutAction,\n type PluginsContext,\n} from '@dxos/app-framework';\nimport { invariant } from '@dxos/invariant';\nimport { ObservabilityAction } from '@dxos/plugin-observability/types';\nimport { PublicKey } from '@dxos/react-client';\nimport { type JoinPanelProps } from '@dxos/shell/react';\n\nimport { ClientCapabilities } from './capabilities';\nimport { IDENTITY_DIALOG, JOIN_DIALOG, RECOVER_CODE_DIALOG } from '../components';\nimport { ClientEvents } from '../events';\nimport { ClientAction, type ClientPluginOptions } from '../types';\n\ntype IntentResolverOptions = Pick<ClientPluginOptions, 'onReset'> & {\n context: PluginsContext;\n appName?: string;\n};\n\nexport default ({ context, appName = 'Composer', onReset }: IntentResolverOptions) =>\n contributes(Capabilities.IntentResolver, [\n createResolver({\n intent: ClientAction.CreateIdentity,\n resolve: async () => {\n const manager = context.requestCapability(Capabilities.PluginManager);\n const client = context.requestCapability(ClientCapabilities.Client);\n const data = await client.halo.createIdentity();\n await manager.activate(ClientEvents.IdentityCreated);\n return { data, intents: [createIntent(ObservabilityAction.SendEvent, { name: 'identity.create' })] };\n },\n }),\n createResolver({\n intent: ClientAction.JoinIdentity,\n resolve: async (data) => {\n return {\n intents: [\n createIntent(LayoutAction.UpdateDialog, {\n part: 'dialog',\n subject: JOIN_DIALOG,\n options: {\n blockAlign: 'start',\n props: {\n initialInvitationCode: data.invitationCode,\n initialDisposition: 'accept-halo-invitation',\n },\n },\n }),\n ],\n };\n },\n }),\n createResolver({\n intent: ClientAction.ShareIdentity,\n resolve: async () => {\n return {\n intents: [\n createIntent(LayoutAction.UpdateDialog, {\n part: 'dialog',\n subject: IDENTITY_DIALOG,\n options: {\n blockAlign: 'start',\n },\n }),\n createIntent(ObservabilityAction.SendEvent, { name: 'identity.share' }),\n ],\n };\n },\n }),\n createResolver({\n intent: ClientAction.RecoverIdentity,\n resolve: async () => {\n return {\n intents: [\n createIntent(LayoutAction.UpdateDialog, {\n part: 'dialog',\n subject: JOIN_DIALOG,\n options: {\n blockAlign: 'start',\n props: {\n initialDisposition: 'recover-identity',\n } satisfies Partial<JoinPanelProps>,\n },\n }),\n ],\n };\n },\n }),\n createResolver({\n intent: ClientAction.ResetStorage,\n resolve: async (data) => {\n await onReset?.({ target: data.target });\n },\n }),\n createResolver({\n intent: ClientAction.CreateAgent,\n resolve: async () => {\n const client = context.requestCapability(ClientCapabilities.Client);\n invariant(client.services.services.EdgeAgentService, 'Missing EdgeAgentService');\n await client.services.services.EdgeAgentService.createAgent(null as any, { timeout: 10_000 });\n },\n }),\n createResolver({\n intent: ClientAction.CreateRecoveryCode,\n resolve: async () => {\n const client = context.requestCapability(ClientCapabilities.Client);\n invariant(client.services.services.IdentityService, 'IdentityService not available');\n // TODO(wittjosiah): This needs a proper api.\n const { recoveryCode } = await client.services.services.IdentityService.createRecoveryCredential({});\n return {\n intents: [\n createIntent(LayoutAction.UpdateDialog, {\n part: 'dialog',\n subject: RECOVER_CODE_DIALOG,\n options: {\n blockAlign: 'start',\n type: 'alert',\n props: { code: recoveryCode },\n },\n }),\n ],\n };\n },\n }),\n createResolver({\n intent: ClientAction.CreatePasskey,\n resolve: async () => {\n const client = context.requestCapability(ClientCapabilities.Client);\n const identity = client.halo.identity.get();\n invariant(identity, 'Identity not available');\n\n // TODO(wittjosiah): Consider factoring out passkey creation to the halo api.\n const lookupKey = PublicKey.random();\n const credential = await navigator.credentials.create({\n publicKey: {\n challenge: new Uint8Array(),\n rp: { id: location.hostname, name: appName },\n user: {\n id: lookupKey.asUint8Array(),\n name: identity.did,\n displayName: identity.profile?.displayName ?? '',\n },\n pubKeyCredParams: [\n { type: 'public-key', alg: -8 }, // Ed25519 (not yet supported across all browsers)\n { type: 'public-key', alg: -7 }, // ES256\n ],\n // https://web.dev/articles/webauthn-discoverable-credentials#resident-key\n authenticatorSelection: {\n residentKey: 'required',\n requireResidentKey: true,\n },\n },\n });\n\n invariant(credential, 'Credential not available');\n const recoveryKey = PublicKey.from(new Uint8Array((credential as any).response.getPublicKey()));\n const algorithm = (credential as any).response.getPublicKeyAlgorithm() === -7 ? 'ES256' : 'ED25519';\n\n // TODO(wittjosiah): This needs a proper api.\n invariant(client.services.services.IdentityService, 'IdentityService not available');\n await client.services.services.IdentityService.createRecoveryCredential({\n data: {\n recoveryKey,\n algorithm,\n lookupKey,\n },\n });\n },\n }),\n createResolver({\n intent: ClientAction.RedeemPasskey,\n resolve: async () => {\n const client = context.requestCapability(ClientCapabilities.Client);\n // TODO(wittjosiah): This needs a proper api.\n invariant(client.services.services.IdentityService, 'IdentityService not available');\n const { deviceKey, controlFeedKey, challenge } =\n await client.services.services.IdentityService.requestRecoveryChallenge();\n const credential = await navigator.credentials.get({\n publicKey: {\n challenge: Buffer.from(challenge, 'base64'),\n rpId: location.hostname,\n userVerification: 'required',\n },\n });\n const lookupKey = PublicKey.from(new Uint8Array((credential as any).response.userHandle));\n await client.services.services.IdentityService.recoverIdentity({\n external: {\n lookupKey,\n deviceKey,\n controlFeedKey,\n signature: Buffer.from((credential as any).response.signature),\n clientDataJson: Buffer.from((credential as any).response.clientDataJSON),\n authenticatorData: Buffer.from((credential as any).response.authenticatorData),\n },\n });\n },\n }),\n ]);\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAIA,SACEA,cACAC,aACAC,cACAC,gBACAC,oBAEK;AACP,SAASC,iBAAiB;AAC1B,SAASC,2BAA2B;AACpC,SAASC,iBAAiB;;AAa1B,IAAA,0BAAe,CAAC,EAAEC,SAASC,UAAU,YAAYC,QAAO,MACtDC,YAAYC,aAAaC,gBAAgB;EACvCC,eAAe;IACbC,QAAQC,aAAaC;IACrBC,SAAS,YAAA;AACP,YAAMC,UAAUX,QAAQY,kBAAkBR,aAAaS,aAAa;AACpE,YAAMC,SAASd,QAAQY,kBAAkBG,mBAAmBC,MAAM;AAClE,YAAMC,OAAO,MAAMH,OA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B,cAAcvB,UAAUwB,KAAK,IAAIhB,WAAYN,WAAmBuB,SAASC,aAAY,CAAA,CAAA;AAC3F,YAAMC,YAAazB,WAAmBuB,SAASG,sBAAqB,MAAO,KAAK,UAAU;AAG1F5C,gBAAUhC,OAAOiC,SAASA,SAASK,iBAAiB,iCAAA;;;;;;;;;AACpD,YAAMtC,OAAOiC,SAASA,SAASK,gBAAgBE,yBAAyB;QACtErC,MAAM;UACJoE;UACAI;UACA5B;QACF;MACF,CAAA;IACF;EACF,CAAA;EACAvD,eAAe;IACbC,QAAQC,aAAamF;IACrBjF,SAAS,YAAA;AACP,YAAMI,SAASd,QAAQY,kBAAkBG,mBAAmBC,MAAM;AAElE8B,gBAAUhC,OAAOiC,SAASA,SAASK,iBAAiB,iCAAA;;;;;;;;;AACpD,YAAM,EAAEwC,WAAWC,gBAAgBxB,UAAS,IAC1C,MAAMvD,OAAOiC,SAASA,SAASK,gBAAgB0C,yBAAwB;AACzE,YAAM9B,aAAa,MAAMC,UAAUC,YAAYN,IAAI;QACjDQ,WAAW;UACTC,WAAW0B,OAAOT,KAAKjB,WAAW,QAAA;UAClC2B,MAAMvB,SAASC;UACfuB,kBAAkB;QACpB;MACF,CAAA;AACA,YAAMpC,YAAYC,UAAUwB,KAAK,IAAIhB,WAAYN,WAAmBuB,SAASW,UAAU,CAAA;AACvF,YAAMpF,OAAOiC,SAASA,SAASK,gBAAgB+C,gBAAgB;QAC7DC,UAAU;UACRvC;UACA+B;UACAC;UACAQ,WAAWN,OAAOT,KAAMtB,WAAmBuB,SAASc,SAAS;UAC7DC,gBAAgBP,OAAOT,KAAMtB,WAAmBuB,SAASgB,cAAc;UACvEC,mBAAmBT,OAAOT,KAAMtB,WAAmBuB,SAASiB,iBAAiB;QAC/E;MACF,CAAA;IACF;EACF,CAAA;CACD;",
|
|
6
|
+
"names": ["Capabilities", "contributes", "createIntent", "createResolver", "LayoutAction", "invariant", "ObservabilityAction", "PublicKey", "context", "appName", "onReset", "contributes", "Capabilities", "IntentResolver", "createResolver", "intent", "ClientAction", "CreateIdentity", "resolve", "manager", "requestCapability", "PluginManager", "client", "ClientCapabilities", "Client", "data", "halo", "createIdentity", "activate", "ClientEvents", "IdentityCreated", "intents", "createIntent", "ObservabilityAction", "SendEvent", "name", "JoinIdentity", "LayoutAction", "UpdateDialog", "part", "subject", "JOIN_DIALOG", "options", "blockAlign", "props", "initialInvitationCode", "invitationCode", "initialDisposition", "ShareIdentity", "IDENTITY_DIALOG", "RecoverIdentity", "ResetStorage", "target", "CreateAgent", "invariant", "services", "EdgeAgentService", "createAgent", "timeout", "CreateRecoveryCode", "IdentityService", "recoveryCode", "createRecoveryCredential", "RECOVER_CODE_DIALOG", "type", "code", "CreatePasskey", "identity", "get", "lookupKey", "PublicKey", "random", "credential", "navigator", "credentials", "create", "publicKey", "challenge", "Uint8Array", "rp", "id", "location", "hostname", "user", "asUint8Array", "did", "displayName", "profile", "pubKeyCredParams", "alg", "authenticatorSelection", "residentKey", "requireResidentKey", "recoveryKey", "from", "response", "getPublicKey", "algorithm", "getPublicKeyAlgorithm", "RedeemPasskey", "deviceKey", "controlFeedKey", "requestRecoveryChallenge", "Buffer", "rpId", "userVerification", "userHandle", "recoverIdentity", "external", "signature", "clientDataJson", "clientDataJSON", "authenticatorData"]
|
|
7
|
+
}
|