@dxos/client-services 0.8.3 → 0.8.4-main.84f28bd
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/{chunk-LBG3C332.mjs → chunk-OCFDRCSN.mjs} +103 -103
- package/dist/lib/browser/chunk-OCFDRCSN.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +6 -6
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/testing/index.mjs +6 -6
- package/dist/lib/node-esm/{chunk-SKGQLRKS.mjs → chunk-D7F3FYZS.mjs} +102 -102
- package/dist/lib/node-esm/chunk-D7F3FYZS.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +6 -6
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/testing/index.mjs +6 -6
- package/dist/types/src/version.d.ts +1 -1
- package/dist/types/src/version.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +39 -39
- package/src/packlets/services/service-host.ts +4 -4
- package/src/version.ts +1 -5
- package/README.yml +0 -5
- package/dist/lib/browser/chunk-LBG3C332.mjs.map +0 -7
- package/dist/lib/node/chunk-LMGLGOUU.cjs +0 -9311
- package/dist/lib/node/chunk-LMGLGOUU.cjs.map +0 -7
- package/dist/lib/node/index.cjs +0 -437
- package/dist/lib/node/index.cjs.map +0 -7
- package/dist/lib/node/meta.json +0 -1
- package/dist/lib/node/testing/index.cjs +0 -452
- package/dist/lib/node/testing/index.cjs.map +0 -7
- package/dist/lib/node-esm/chunk-SKGQLRKS.mjs.map +0 -7
|
@@ -1,452 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var testing_exports = {};
|
|
20
|
-
__export(testing_exports, {
|
|
21
|
-
TestBuilder: () => TestBuilder,
|
|
22
|
-
TestPeer: () => TestPeer,
|
|
23
|
-
acceptInvitation: () => acceptInvitation,
|
|
24
|
-
createIdentity: () => createIdentity,
|
|
25
|
-
createInvitation: () => createInvitation,
|
|
26
|
-
createMockCredential: () => createMockCredential,
|
|
27
|
-
createPeers: () => createPeers,
|
|
28
|
-
createServiceContext: () => createServiceContext,
|
|
29
|
-
createServiceHost: () => createServiceHost,
|
|
30
|
-
createSigningContext: () => createSigningContext,
|
|
31
|
-
performInvitation: () => performInvitation,
|
|
32
|
-
sanitizeInvitation: () => sanitizeInvitation
|
|
33
|
-
});
|
|
34
|
-
module.exports = __toCommonJS(testing_exports);
|
|
35
|
-
var import_chunk_LMGLGOUU = require("../chunk-LMGLGOUU.cjs");
|
|
36
|
-
var import_credentials = require("@dxos/credentials");
|
|
37
|
-
var import_keys = require("@dxos/keys");
|
|
38
|
-
var import_async = require("@dxos/async");
|
|
39
|
-
var import_client_protocol = require("@dxos/client-protocol");
|
|
40
|
-
var import_invariant = require("@dxos/invariant");
|
|
41
|
-
var import_services = require("@dxos/protocols/proto/dxos/client/services");
|
|
42
|
-
var import_context = require("@dxos/context");
|
|
43
|
-
var import_credentials2 = require("@dxos/credentials");
|
|
44
|
-
var import_debug = require("@dxos/debug");
|
|
45
|
-
var import_echo_pipeline = require("@dxos/echo-pipeline");
|
|
46
|
-
var import_feed_store = require("@dxos/feed-store");
|
|
47
|
-
var import_keyring = require("@dxos/keyring");
|
|
48
|
-
var import_testing = require("@dxos/kv-store/testing");
|
|
49
|
-
var import_messaging = require("@dxos/messaging");
|
|
50
|
-
var import_network_manager = require("@dxos/network-manager");
|
|
51
|
-
var import_services2 = require("@dxos/protocols/proto/dxos/client/services");
|
|
52
|
-
var import_random_access_storage = require("@dxos/random-access-storage");
|
|
53
|
-
var import_teleport_extension_object_sync = require("@dxos/teleport-extension-object-sync");
|
|
54
|
-
var createMockCredential = async ({ signer, issuer }) => (0, import_credentials.createCredential)({
|
|
55
|
-
signer,
|
|
56
|
-
issuer,
|
|
57
|
-
subject: new import_keys.PublicKey(Buffer.from("test")),
|
|
58
|
-
assertion: {
|
|
59
|
-
"@type": "example.testing.rpc.MessageWithAny",
|
|
60
|
-
payload: {
|
|
61
|
-
"@type": "google.protobuf.Any",
|
|
62
|
-
value: Buffer.from("test")
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
});
|
|
66
|
-
var __dxlog_file = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/testing/invitation-utils.ts";
|
|
67
|
-
var sanitizeInvitation = (invitation) => {
|
|
68
|
-
return import_client_protocol.InvitationEncoder.decode(import_client_protocol.InvitationEncoder.encode(invitation));
|
|
69
|
-
};
|
|
70
|
-
var performInvitation = ({ host, guest, options, hooks, guestDeviceProfile, codeInputDelay }) => {
|
|
71
|
-
let guestError = false;
|
|
72
|
-
let guestConnected = false;
|
|
73
|
-
let wereConnected = false;
|
|
74
|
-
const hostComplete = new import_async.Trigger();
|
|
75
|
-
const guestComplete = new import_async.Trigger();
|
|
76
|
-
const authCode = new import_async.Trigger();
|
|
77
|
-
void createInvitation(host, options).then((hostObservable) => {
|
|
78
|
-
hostObservable.subscribe(async (hostInvitation) => {
|
|
79
|
-
switch (hostInvitation.state) {
|
|
80
|
-
case import_services.Invitation.State.CONNECTING: {
|
|
81
|
-
if (guestConnected) {
|
|
82
|
-
if (wereConnected) {
|
|
83
|
-
hostComplete.wake({
|
|
84
|
-
invitation: hostInvitation
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
break;
|
|
88
|
-
}
|
|
89
|
-
guestConnected = true;
|
|
90
|
-
if (hooks?.host?.onConnecting?.(hostObservable)) {
|
|
91
|
-
break;
|
|
92
|
-
}
|
|
93
|
-
const guestObservable = acceptInvitation(guest, hostInvitation, guestDeviceProfile);
|
|
94
|
-
guestObservable.subscribe(async (guestInvitation) => {
|
|
95
|
-
switch (guestInvitation.state) {
|
|
96
|
-
case import_services.Invitation.State.CONNECTING: {
|
|
97
|
-
if (hooks?.guest?.onConnecting?.(guestObservable)) {
|
|
98
|
-
break;
|
|
99
|
-
}
|
|
100
|
-
(0, import_invariant.invariant)(hostInvitation.swarmKey.equals(guestInvitation.swarmKey), void 0, {
|
|
101
|
-
F: __dxlog_file,
|
|
102
|
-
L: 95,
|
|
103
|
-
S: void 0,
|
|
104
|
-
A: [
|
|
105
|
-
"hostInvitation.swarmKey!.equals(guestInvitation.swarmKey!)",
|
|
106
|
-
""
|
|
107
|
-
]
|
|
108
|
-
});
|
|
109
|
-
break;
|
|
110
|
-
}
|
|
111
|
-
case import_services.Invitation.State.CONNECTED: {
|
|
112
|
-
hooks?.guest?.onConnected?.(guestObservable);
|
|
113
|
-
break;
|
|
114
|
-
}
|
|
115
|
-
case import_services.Invitation.State.READY_FOR_AUTHENTICATION: {
|
|
116
|
-
if (hooks?.guest?.onReady?.(guestObservable)) {
|
|
117
|
-
break;
|
|
118
|
-
}
|
|
119
|
-
const code = await authCode.wait();
|
|
120
|
-
if (codeInputDelay == null) {
|
|
121
|
-
await guestObservable.authenticate(code);
|
|
122
|
-
} else {
|
|
123
|
-
setTimeout(async () => {
|
|
124
|
-
if (!guestError) {
|
|
125
|
-
await guestObservable.authenticate(code);
|
|
126
|
-
}
|
|
127
|
-
}, codeInputDelay);
|
|
128
|
-
}
|
|
129
|
-
break;
|
|
130
|
-
}
|
|
131
|
-
case import_services.Invitation.State.AUTHENTICATING: {
|
|
132
|
-
hooks?.guest?.onAuthenticating?.(guestObservable);
|
|
133
|
-
break;
|
|
134
|
-
}
|
|
135
|
-
case import_services.Invitation.State.SUCCESS: {
|
|
136
|
-
if (hooks?.guest?.onSuccess?.(guestObservable)) {
|
|
137
|
-
break;
|
|
138
|
-
}
|
|
139
|
-
guestComplete.wake({
|
|
140
|
-
invitation: guestInvitation
|
|
141
|
-
});
|
|
142
|
-
break;
|
|
143
|
-
}
|
|
144
|
-
case import_services.Invitation.State.CANCELLED: {
|
|
145
|
-
if (hooks?.guest?.onCancelled?.(guestObservable)) {
|
|
146
|
-
break;
|
|
147
|
-
}
|
|
148
|
-
guestComplete.wake({
|
|
149
|
-
invitation: guestInvitation
|
|
150
|
-
});
|
|
151
|
-
break;
|
|
152
|
-
}
|
|
153
|
-
case import_services.Invitation.State.TIMEOUT: {
|
|
154
|
-
if (hooks?.guest?.onTimeout?.(guestObservable)) {
|
|
155
|
-
return;
|
|
156
|
-
}
|
|
157
|
-
guestComplete.wake({
|
|
158
|
-
invitation: guestInvitation
|
|
159
|
-
});
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
}, (error) => {
|
|
163
|
-
guestError = true;
|
|
164
|
-
if (hooks?.guest?.onError?.(guestObservable)) {
|
|
165
|
-
return;
|
|
166
|
-
}
|
|
167
|
-
guestComplete.wake({
|
|
168
|
-
error
|
|
169
|
-
});
|
|
170
|
-
});
|
|
171
|
-
break;
|
|
172
|
-
}
|
|
173
|
-
case import_services.Invitation.State.CONNECTED: {
|
|
174
|
-
wereConnected = true;
|
|
175
|
-
hooks?.host?.onConnected?.(hostObservable);
|
|
176
|
-
break;
|
|
177
|
-
}
|
|
178
|
-
case import_services.Invitation.State.READY_FOR_AUTHENTICATION: {
|
|
179
|
-
if (hooks?.host?.onReady?.(hostObservable)) {
|
|
180
|
-
break;
|
|
181
|
-
}
|
|
182
|
-
if (hostInvitation.authCode) {
|
|
183
|
-
authCode.wake(hostInvitation.authCode);
|
|
184
|
-
}
|
|
185
|
-
break;
|
|
186
|
-
}
|
|
187
|
-
case import_services.Invitation.State.AUTHENTICATING: {
|
|
188
|
-
hooks?.host?.onAuthenticating?.(hostObservable);
|
|
189
|
-
break;
|
|
190
|
-
}
|
|
191
|
-
case import_services.Invitation.State.SUCCESS: {
|
|
192
|
-
if (hooks?.host?.onSuccess?.(hostObservable)) {
|
|
193
|
-
break;
|
|
194
|
-
}
|
|
195
|
-
hostComplete.wake({
|
|
196
|
-
invitation: hostInvitation
|
|
197
|
-
});
|
|
198
|
-
break;
|
|
199
|
-
}
|
|
200
|
-
case import_services.Invitation.State.CANCELLED: {
|
|
201
|
-
if (hooks?.host?.onCancelled?.(hostObservable)) {
|
|
202
|
-
break;
|
|
203
|
-
}
|
|
204
|
-
hostComplete.wake({
|
|
205
|
-
invitation: hostInvitation
|
|
206
|
-
});
|
|
207
|
-
break;
|
|
208
|
-
}
|
|
209
|
-
case import_services.Invitation.State.TIMEOUT: {
|
|
210
|
-
if (hooks?.host?.onTimeout?.(hostObservable)) {
|
|
211
|
-
break;
|
|
212
|
-
}
|
|
213
|
-
hostComplete.wake({
|
|
214
|
-
invitation: hostInvitation
|
|
215
|
-
});
|
|
216
|
-
break;
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
}, (error) => {
|
|
220
|
-
if (hooks?.host?.onError?.(hostObservable)) {
|
|
221
|
-
return;
|
|
222
|
-
}
|
|
223
|
-
hostComplete.wake({
|
|
224
|
-
error
|
|
225
|
-
});
|
|
226
|
-
});
|
|
227
|
-
});
|
|
228
|
-
return [
|
|
229
|
-
hostComplete.wait(),
|
|
230
|
-
guestComplete.wait()
|
|
231
|
-
];
|
|
232
|
-
};
|
|
233
|
-
var createInvitation = async (host, options) => {
|
|
234
|
-
options ??= {
|
|
235
|
-
authMethod: import_services.Invitation.AuthMethod.NONE,
|
|
236
|
-
...options ?? {}
|
|
237
|
-
};
|
|
238
|
-
if (host instanceof import_chunk_LMGLGOUU.ServiceContext) {
|
|
239
|
-
return host.invitationsManager.createInvitation({
|
|
240
|
-
kind: import_services.Invitation.Kind.SPACE,
|
|
241
|
-
...options
|
|
242
|
-
});
|
|
243
|
-
}
|
|
244
|
-
return host.share(options);
|
|
245
|
-
};
|
|
246
|
-
var acceptInvitation = (guest, invitation, guestDeviceProfile) => {
|
|
247
|
-
invitation = sanitizeInvitation(invitation);
|
|
248
|
-
if (guest instanceof import_chunk_LMGLGOUU.ServiceContext) {
|
|
249
|
-
return guest.invitationsManager.acceptInvitation({
|
|
250
|
-
invitation,
|
|
251
|
-
deviceProfile: guestDeviceProfile
|
|
252
|
-
});
|
|
253
|
-
}
|
|
254
|
-
return guest.join(invitation, guestDeviceProfile);
|
|
255
|
-
};
|
|
256
|
-
var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/testing/test-builder.ts";
|
|
257
|
-
var createServiceHost = (config, signalManagerContext) => {
|
|
258
|
-
return new import_chunk_LMGLGOUU.ClientServicesHost({
|
|
259
|
-
config,
|
|
260
|
-
signalManager: new import_messaging.MemorySignalManager(signalManagerContext),
|
|
261
|
-
transportFactory: import_network_manager.MemoryTransportFactory
|
|
262
|
-
});
|
|
263
|
-
};
|
|
264
|
-
var createServiceContext = async ({ signalManagerFactory = async () => {
|
|
265
|
-
const signalContext = new import_messaging.MemorySignalManagerContext();
|
|
266
|
-
return new import_messaging.MemorySignalManager(signalContext);
|
|
267
|
-
}, storage = (0, import_random_access_storage.createStorage)({
|
|
268
|
-
type: import_random_access_storage.StorageType.RAM
|
|
269
|
-
}), runtimeParams } = {}) => {
|
|
270
|
-
const signalManager = await signalManagerFactory();
|
|
271
|
-
const networkManager = new import_network_manager.SwarmNetworkManager({
|
|
272
|
-
signalManager,
|
|
273
|
-
transportFactory: import_network_manager.MemoryTransportFactory
|
|
274
|
-
});
|
|
275
|
-
const level = (0, import_testing.createTestLevel)();
|
|
276
|
-
await level.open();
|
|
277
|
-
return new import_chunk_LMGLGOUU.ServiceContext(storage, level, networkManager, signalManager, void 0, void 0, {
|
|
278
|
-
invitationConnectionDefaultParams: {
|
|
279
|
-
teleport: {
|
|
280
|
-
controlHeartbeatInterval: 200
|
|
281
|
-
}
|
|
282
|
-
},
|
|
283
|
-
...runtimeParams
|
|
284
|
-
});
|
|
285
|
-
};
|
|
286
|
-
var createPeers = async (numPeers, signalManagerFactory) => {
|
|
287
|
-
if (!signalManagerFactory) {
|
|
288
|
-
const signalContext = new import_messaging.MemorySignalManagerContext();
|
|
289
|
-
signalManagerFactory = async () => new import_messaging.MemorySignalManager(signalContext);
|
|
290
|
-
}
|
|
291
|
-
return await Promise.all(Array.from(Array(numPeers)).map(async () => {
|
|
292
|
-
const peer = await createServiceContext({
|
|
293
|
-
signalManagerFactory
|
|
294
|
-
});
|
|
295
|
-
await peer.open(new import_context.Context(void 0, {
|
|
296
|
-
F: __dxlog_file2,
|
|
297
|
-
L: 70
|
|
298
|
-
}));
|
|
299
|
-
return peer;
|
|
300
|
-
}));
|
|
301
|
-
};
|
|
302
|
-
var createIdentity = async (peer) => {
|
|
303
|
-
await peer.createIdentity();
|
|
304
|
-
return peer;
|
|
305
|
-
};
|
|
306
|
-
var TestBuilder = class {
|
|
307
|
-
constructor() {
|
|
308
|
-
this.signalContext = new import_messaging.MemorySignalManagerContext();
|
|
309
|
-
this._ctx = new import_context.Context(void 0, {
|
|
310
|
-
F: __dxlog_file2,
|
|
311
|
-
L: 83
|
|
312
|
-
});
|
|
313
|
-
}
|
|
314
|
-
createPeer(peerOptions) {
|
|
315
|
-
const peer = new TestPeer(this.signalContext, peerOptions);
|
|
316
|
-
this._ctx.onDispose(async () => peer.destroy());
|
|
317
|
-
return peer;
|
|
318
|
-
}
|
|
319
|
-
async destroy() {
|
|
320
|
-
await this._ctx.dispose();
|
|
321
|
-
}
|
|
322
|
-
};
|
|
323
|
-
var TestPeer = class {
|
|
324
|
-
constructor(_signalContext, _opts = {
|
|
325
|
-
dataStore: import_random_access_storage.StorageType.RAM
|
|
326
|
-
}) {
|
|
327
|
-
this._signalContext = _signalContext;
|
|
328
|
-
this._opts = _opts;
|
|
329
|
-
this._props = {};
|
|
330
|
-
}
|
|
331
|
-
get props() {
|
|
332
|
-
return this._props;
|
|
333
|
-
}
|
|
334
|
-
get storage() {
|
|
335
|
-
return this._props.storage ??= (0, import_random_access_storage.createStorage)({
|
|
336
|
-
type: this._opts.dataStore
|
|
337
|
-
});
|
|
338
|
-
}
|
|
339
|
-
get keyring() {
|
|
340
|
-
return this._props.keyring ??= new import_keyring.Keyring(this.storage.createDirectory("keyring"));
|
|
341
|
-
}
|
|
342
|
-
get level() {
|
|
343
|
-
return this._props.level ??= (0, import_testing.createTestLevel)();
|
|
344
|
-
}
|
|
345
|
-
get feedStore() {
|
|
346
|
-
return this._props.feedStore ??= new import_feed_store.FeedStore({
|
|
347
|
-
factory: new import_feed_store.FeedFactory({
|
|
348
|
-
root: this.storage.createDirectory("feeds"),
|
|
349
|
-
signer: this.keyring,
|
|
350
|
-
hypercore: {
|
|
351
|
-
valueEncoding: import_echo_pipeline.valueEncoding
|
|
352
|
-
}
|
|
353
|
-
})
|
|
354
|
-
});
|
|
355
|
-
}
|
|
356
|
-
get metadataStore() {
|
|
357
|
-
return this._props.metadataStore ??= new import_echo_pipeline.MetadataStore(this.storage.createDirectory("metadata"));
|
|
358
|
-
}
|
|
359
|
-
get blobStore() {
|
|
360
|
-
return this._props.blobStore ??= new import_teleport_extension_object_sync.BlobStore(this.storage.createDirectory("blobs"));
|
|
361
|
-
}
|
|
362
|
-
get networkManager() {
|
|
363
|
-
return this._props.networkManager ??= new import_network_manager.SwarmNetworkManager({
|
|
364
|
-
signalManager: new import_messaging.MemorySignalManager(this._signalContext),
|
|
365
|
-
transportFactory: import_network_manager.MemoryTransportFactory
|
|
366
|
-
});
|
|
367
|
-
}
|
|
368
|
-
get spaceManager() {
|
|
369
|
-
return this._props.spaceManager ??= new import_echo_pipeline.SpaceManager({
|
|
370
|
-
feedStore: this.feedStore,
|
|
371
|
-
networkManager: this.networkManager,
|
|
372
|
-
metadataStore: this.metadataStore,
|
|
373
|
-
blobStore: this.blobStore
|
|
374
|
-
});
|
|
375
|
-
}
|
|
376
|
-
get identity() {
|
|
377
|
-
return this._props.signingContext ?? (0, import_debug.failUndefined)();
|
|
378
|
-
}
|
|
379
|
-
get echoHost() {
|
|
380
|
-
return this._props.echoHost ??= new import_echo_pipeline.EchoHost({
|
|
381
|
-
kv: this.level
|
|
382
|
-
});
|
|
383
|
-
}
|
|
384
|
-
get meshEchoReplicator() {
|
|
385
|
-
return this._props.meshEchoReplicator ??= new import_echo_pipeline.MeshEchoReplicator();
|
|
386
|
-
}
|
|
387
|
-
get dataSpaceManager() {
|
|
388
|
-
return this._props.dataSpaceManager ??= new import_chunk_LMGLGOUU.DataSpaceManager({
|
|
389
|
-
spaceManager: this.spaceManager,
|
|
390
|
-
metadataStore: this.metadataStore,
|
|
391
|
-
keyring: this.keyring,
|
|
392
|
-
signingContext: this.identity,
|
|
393
|
-
feedStore: this.feedStore,
|
|
394
|
-
echoHost: this.echoHost,
|
|
395
|
-
invitationsManager: this.invitationsManager,
|
|
396
|
-
edgeConnection: void 0,
|
|
397
|
-
meshReplicator: this.meshEchoReplicator,
|
|
398
|
-
echoEdgeReplicator: void 0,
|
|
399
|
-
runtimeParams: this._opts.dataSpaceParams
|
|
400
|
-
});
|
|
401
|
-
}
|
|
402
|
-
get invitationsManager() {
|
|
403
|
-
return this._props.invitationsManager ??= new import_chunk_LMGLGOUU.InvitationsManager(new import_chunk_LMGLGOUU.InvitationsHandler(this.networkManager), (invitation) => {
|
|
404
|
-
if (invitation.kind === import_services2.Invitation.Kind.SPACE) {
|
|
405
|
-
return new import_chunk_LMGLGOUU.SpaceInvitationProtocol(this.dataSpaceManager, this.identity, this.keyring, invitation.spaceKey);
|
|
406
|
-
} else {
|
|
407
|
-
throw new Error("not implemented");
|
|
408
|
-
}
|
|
409
|
-
}, this.metadataStore);
|
|
410
|
-
}
|
|
411
|
-
async createIdentity() {
|
|
412
|
-
this._props.signingContext ??= await createSigningContext(this.keyring);
|
|
413
|
-
this.networkManager.setPeerInfo({
|
|
414
|
-
identityKey: this._props.signingContext.identityKey.toHex(),
|
|
415
|
-
peerKey: this._props.signingContext.deviceKey.toHex()
|
|
416
|
-
});
|
|
417
|
-
}
|
|
418
|
-
async destroy() {
|
|
419
|
-
await this.level.close();
|
|
420
|
-
await this.storage.reset();
|
|
421
|
-
}
|
|
422
|
-
};
|
|
423
|
-
var createSigningContext = async (keyring) => {
|
|
424
|
-
const identityKey = await keyring.createKey();
|
|
425
|
-
const deviceKey = await keyring.createKey();
|
|
426
|
-
return {
|
|
427
|
-
identityKey,
|
|
428
|
-
deviceKey,
|
|
429
|
-
credentialSigner: (0, import_credentials2.createCredentialSignerWithChain)(keyring, {
|
|
430
|
-
credential: await new import_credentials2.CredentialGenerator(keyring, identityKey, deviceKey).createDeviceAuthorization(deviceKey)
|
|
431
|
-
}, deviceKey),
|
|
432
|
-
recordCredential: async () => {
|
|
433
|
-
},
|
|
434
|
-
getProfile: () => void 0
|
|
435
|
-
};
|
|
436
|
-
};
|
|
437
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
438
|
-
0 && (module.exports = {
|
|
439
|
-
TestBuilder,
|
|
440
|
-
TestPeer,
|
|
441
|
-
acceptInvitation,
|
|
442
|
-
createIdentity,
|
|
443
|
-
createInvitation,
|
|
444
|
-
createMockCredential,
|
|
445
|
-
createPeers,
|
|
446
|
-
createServiceContext,
|
|
447
|
-
createServiceHost,
|
|
448
|
-
createSigningContext,
|
|
449
|
-
performInvitation,
|
|
450
|
-
sanitizeInvitation
|
|
451
|
-
});
|
|
452
|
-
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../src/packlets/testing/credential-utils.ts", "../../../../src/packlets/testing/invitation-utils.ts", "../../../../src/packlets/testing/test-builder.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { createCredential } from '@dxos/credentials';\nimport { type Signer } from '@dxos/crypto';\nimport { PublicKey } from '@dxos/keys';\nimport { type Credential } from '@dxos/protocols/proto/dxos/halo/credentials';\n\nexport const createMockCredential = async ({\n signer,\n issuer,\n}: {\n signer: Signer;\n issuer: PublicKey;\n}): Promise<Credential> =>\n createCredential({\n signer,\n issuer,\n subject: new PublicKey(Buffer.from('test')),\n assertion: {\n '@type': 'example.testing.rpc.MessageWithAny',\n payload: {\n '@type': 'google.protobuf.Any',\n value: Buffer.from('test'),\n },\n },\n });\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { Trigger } from '@dxos/async';\nimport { InvitationEncoder, type AuthenticatingInvitation, type CancellableInvitation } from '@dxos/client-protocol';\nimport { invariant } from '@dxos/invariant';\nimport { Invitation } from '@dxos/protocols/proto/dxos/client/services';\nimport { type DeviceProfileDocument } from '@dxos/protocols/proto/dxos/halo/credentials';\n\nimport { ServiceContext } from '../services';\n\n/**\n * Strip secrets from invitation before giving it to the peer.\n */\nexport const sanitizeInvitation = (invitation: Invitation): Invitation => {\n return InvitationEncoder.decode(InvitationEncoder.encode(invitation));\n};\n\nexport type InvitationHost = {\n share(options?: Partial<Invitation>): CancellableInvitation;\n};\n\nexport type InvitationGuest = {\n join(invitation: Invitation | string, deviceProfile?: DeviceProfileDocument): AuthenticatingInvitation;\n};\n\nexport type PerformInvitationCallbacks<T> = {\n onConnecting?: (value: T) => boolean | void;\n onConnected?: (value: T) => boolean | void;\n onReady?: (value: T) => boolean | void;\n onAuthenticating?: (value: T) => boolean | void;\n onSuccess?: (value: T) => boolean | void;\n onCancelled?: (value: T) => boolean | void;\n onTimeout?: (value: T) => boolean | void;\n onError?: (value: T) => boolean | void;\n};\n\nexport type PerformInvitationParams = {\n host: ServiceContext | InvitationHost;\n guest: ServiceContext | InvitationGuest;\n options?: Partial<Invitation>;\n hooks?: {\n host?: PerformInvitationCallbacks<CancellableInvitation>;\n guest?: PerformInvitationCallbacks<AuthenticatingInvitation>;\n };\n guestDeviceProfile?: DeviceProfileDocument;\n codeInputDelay?: number;\n};\n\nexport type Result = { invitation?: Invitation; error?: Error };\n\n// TODO(burdon): Make async.\n// TODO(burdon): Rename startInvitation.\nexport const performInvitation = ({\n host,\n guest,\n options,\n hooks,\n guestDeviceProfile,\n codeInputDelay,\n}: PerformInvitationParams): [Promise<Result>, Promise<Result>] => {\n let guestError = false;\n let guestConnected = false;\n let wereConnected = false;\n const hostComplete = new Trigger<Result>();\n const guestComplete = new Trigger<Result>();\n const authCode = new Trigger<string>();\n\n void createInvitation(host, options).then((hostObservable) => {\n hostObservable.subscribe(\n async (hostInvitation: Invitation) => {\n switch (hostInvitation.state) {\n case Invitation.State.CONNECTING: {\n if (guestConnected) {\n if (wereConnected) {\n hostComplete.wake({ invitation: hostInvitation });\n }\n break;\n }\n\n guestConnected = true;\n if (hooks?.host?.onConnecting?.(hostObservable)) {\n break;\n }\n\n const guestObservable = acceptInvitation(guest, hostInvitation, guestDeviceProfile);\n guestObservable.subscribe(\n async (guestInvitation: Invitation) => {\n switch (guestInvitation.state) {\n case Invitation.State.CONNECTING: {\n if (hooks?.guest?.onConnecting?.(guestObservable)) {\n break;\n }\n invariant(hostInvitation.swarmKey!.equals(guestInvitation.swarmKey!));\n break;\n }\n\n case Invitation.State.CONNECTED: {\n hooks?.guest?.onConnected?.(guestObservable);\n break;\n }\n\n case Invitation.State.READY_FOR_AUTHENTICATION: {\n if (hooks?.guest?.onReady?.(guestObservable)) {\n break;\n }\n const code = await authCode.wait();\n if (codeInputDelay == null) {\n await guestObservable.authenticate(code);\n } else {\n setTimeout(async () => {\n if (!guestError) {\n await guestObservable.authenticate(code);\n }\n }, codeInputDelay);\n }\n break;\n }\n\n case Invitation.State.AUTHENTICATING: {\n hooks?.guest?.onAuthenticating?.(guestObservable);\n break;\n }\n\n case Invitation.State.SUCCESS: {\n if (hooks?.guest?.onSuccess?.(guestObservable)) {\n break;\n }\n guestComplete.wake({ invitation: guestInvitation });\n break;\n }\n\n case Invitation.State.CANCELLED: {\n if (hooks?.guest?.onCancelled?.(guestObservable)) {\n break;\n }\n guestComplete.wake({ invitation: guestInvitation });\n break;\n }\n\n case Invitation.State.TIMEOUT: {\n if (hooks?.guest?.onTimeout?.(guestObservable)) {\n return;\n }\n guestComplete.wake({ invitation: guestInvitation });\n }\n }\n },\n (error: Error) => {\n guestError = true;\n if (hooks?.guest?.onError?.(guestObservable)) {\n return;\n }\n guestComplete.wake({ error });\n },\n );\n break;\n }\n\n case Invitation.State.CONNECTED: {\n wereConnected = true;\n hooks?.host?.onConnected?.(hostObservable);\n break;\n }\n\n case Invitation.State.READY_FOR_AUTHENTICATION: {\n if (hooks?.host?.onReady?.(hostObservable)) {\n break;\n }\n if (hostInvitation.authCode) {\n authCode.wake(hostInvitation.authCode);\n }\n break;\n }\n\n case Invitation.State.AUTHENTICATING: {\n hooks?.host?.onAuthenticating?.(hostObservable);\n break;\n }\n\n case Invitation.State.SUCCESS: {\n if (hooks?.host?.onSuccess?.(hostObservable)) {\n break;\n }\n hostComplete.wake({ invitation: hostInvitation });\n break;\n }\n\n case Invitation.State.CANCELLED: {\n if (hooks?.host?.onCancelled?.(hostObservable)) {\n break;\n }\n hostComplete.wake({ invitation: hostInvitation });\n break;\n }\n\n case Invitation.State.TIMEOUT: {\n if (hooks?.host?.onTimeout?.(hostObservable)) {\n break;\n }\n hostComplete.wake({ invitation: hostInvitation });\n break;\n }\n }\n },\n (error: Error) => {\n if (hooks?.host?.onError?.(hostObservable)) {\n return;\n }\n hostComplete.wake({ error });\n },\n );\n });\n\n return [hostComplete.wait(), guestComplete.wait()];\n};\n\nexport const createInvitation = async (\n host: ServiceContext | InvitationHost,\n options?: Partial<Invitation>,\n): Promise<CancellableInvitation> => {\n options ??= {\n authMethod: Invitation.AuthMethod.NONE,\n ...(options ?? {}),\n };\n\n if (host instanceof ServiceContext) {\n return host.invitationsManager.createInvitation({\n kind: Invitation.Kind.SPACE,\n ...options,\n });\n }\n\n return host.share(options);\n};\n\nexport const acceptInvitation = (\n guest: ServiceContext | InvitationGuest,\n invitation: Invitation,\n guestDeviceProfile?: DeviceProfileDocument,\n): AuthenticatingInvitation => {\n invitation = sanitizeInvitation(invitation);\n\n if (guest instanceof ServiceContext) {\n return guest.invitationsManager.acceptInvitation({\n invitation,\n deviceProfile: guestDeviceProfile,\n });\n }\n\n return guest.join(invitation, guestDeviceProfile);\n};\n", "//\n// Copyright 2022 DXOS.org\n//\n\nimport { type Config } from '@dxos/config';\nimport { Context } from '@dxos/context';\nimport { createCredentialSignerWithChain, CredentialGenerator } from '@dxos/credentials';\nimport { failUndefined } from '@dxos/debug';\nimport { EchoHost, MetadataStore, SpaceManager, valueEncoding, MeshEchoReplicator } from '@dxos/echo-pipeline';\nimport { FeedFactory, FeedStore } from '@dxos/feed-store';\nimport { Keyring } from '@dxos/keyring';\nimport { type LevelDB } from '@dxos/kv-store';\nimport { createTestLevel } from '@dxos/kv-store/testing';\nimport { MemorySignalManager, MemorySignalManagerContext, type SignalManager } from '@dxos/messaging';\nimport { MemoryTransportFactory, SwarmNetworkManager } from '@dxos/network-manager';\nimport { Invitation } from '@dxos/protocols/proto/dxos/client/services';\nimport { createStorage, StorageType, type Storage } from '@dxos/random-access-storage';\nimport { BlobStore } from '@dxos/teleport-extension-object-sync';\n\nimport { InvitationsHandler, InvitationsManager, SpaceInvitationProtocol } from '../invitations';\nimport { ClientServicesHost, ServiceContext, type ServiceContextRuntimeParams } from '../services';\nimport { DataSpaceManager, type DataSpaceManagerRuntimeParams, type SigningContext } from '../spaces';\n\n//\n// TODO(burdon): Replace with test builder.\n//\n\nexport const createServiceHost = (config: Config, signalManagerContext: MemorySignalManagerContext) => {\n return new ClientServicesHost({\n config,\n signalManager: new MemorySignalManager(signalManagerContext),\n transportFactory: MemoryTransportFactory,\n });\n};\n\nexport const createServiceContext = async ({\n signalManagerFactory = async () => {\n const signalContext = new MemorySignalManagerContext();\n return new MemorySignalManager(signalContext);\n },\n storage = createStorage({ type: StorageType.RAM }),\n runtimeParams,\n}: {\n signalManagerFactory?: () => Promise<SignalManager>;\n storage?: Storage;\n runtimeParams?: ServiceContextRuntimeParams;\n} = {}) => {\n const signalManager = await signalManagerFactory();\n const networkManager = new SwarmNetworkManager({\n signalManager,\n transportFactory: MemoryTransportFactory,\n });\n const level = createTestLevel();\n await level.open();\n\n return new ServiceContext(storage, level, networkManager, signalManager, undefined, undefined, {\n invitationConnectionDefaultParams: { teleport: { controlHeartbeatInterval: 200 } },\n ...runtimeParams,\n });\n};\n\nexport const createPeers = async (numPeers: number, signalManagerFactory?: () => Promise<SignalManager>) => {\n if (!signalManagerFactory) {\n const signalContext = new MemorySignalManagerContext();\n signalManagerFactory = async () => new MemorySignalManager(signalContext);\n }\n return await Promise.all(\n Array.from(Array(numPeers)).map(async () => {\n const peer = await createServiceContext({ signalManagerFactory });\n await peer.open(new Context());\n return peer;\n }),\n );\n};\n\nexport const createIdentity = async (peer: ServiceContext) => {\n await peer.createIdentity();\n return peer;\n};\n\nexport class TestBuilder {\n public readonly signalContext = new MemorySignalManagerContext();\n private readonly _ctx = new Context();\n\n createPeer(peerOptions?: TestPeerOpts): TestPeer {\n const peer = new TestPeer(this.signalContext, peerOptions);\n this._ctx.onDispose(async () => peer.destroy());\n return peer;\n }\n\n async destroy(): Promise<void> {\n await this._ctx.dispose();\n }\n}\n\nexport type TestPeerOpts = {\n dataStore?: StorageType;\n dataSpaceParams?: DataSpaceManagerRuntimeParams;\n};\n\nexport type TestPeerProps = {\n storage?: Storage;\n level?: LevelDB;\n feedStore?: FeedStore<any>;\n metadataStore?: MetadataStore;\n keyring?: Keyring;\n networkManager?: SwarmNetworkManager;\n spaceManager?: SpaceManager;\n dataSpaceManager?: DataSpaceManager;\n signingContext?: SigningContext;\n blobStore?: BlobStore;\n echoHost?: EchoHost;\n meshEchoReplicator?: MeshEchoReplicator;\n invitationsManager?: InvitationsManager;\n};\n\nexport class TestPeer {\n private _props: TestPeerProps = {};\n\n constructor(\n private readonly _signalContext: MemorySignalManagerContext,\n private readonly _opts: TestPeerOpts = { dataStore: StorageType.RAM },\n ) {}\n\n get props() {\n return this._props;\n }\n\n get storage() {\n return (this._props.storage ??= createStorage({ type: this._opts.dataStore }));\n }\n\n get keyring() {\n return (this._props.keyring ??= new Keyring(this.storage.createDirectory('keyring')));\n }\n\n get level() {\n return (this._props.level ??= createTestLevel());\n }\n\n get feedStore() {\n return (this._props.feedStore ??= new FeedStore({\n factory: new FeedFactory({\n root: this.storage.createDirectory('feeds'),\n signer: this.keyring,\n hypercore: {\n valueEncoding,\n },\n }),\n }));\n }\n\n get metadataStore() {\n return (this._props.metadataStore ??= new MetadataStore(this.storage.createDirectory('metadata')));\n }\n\n get blobStore() {\n return (this._props.blobStore ??= new BlobStore(this.storage.createDirectory('blobs')));\n }\n\n get networkManager() {\n return (this._props.networkManager ??= new SwarmNetworkManager({\n signalManager: new MemorySignalManager(this._signalContext),\n transportFactory: MemoryTransportFactory,\n }));\n }\n\n get spaceManager() {\n return (this._props.spaceManager ??= new SpaceManager({\n feedStore: this.feedStore,\n networkManager: this.networkManager,\n metadataStore: this.metadataStore,\n blobStore: this.blobStore,\n }));\n }\n\n get identity() {\n return this._props.signingContext ?? failUndefined();\n }\n\n get echoHost() {\n return (this._props.echoHost ??= new EchoHost({ kv: this.level }));\n }\n\n get meshEchoReplicator() {\n return (this._props.meshEchoReplicator ??= new MeshEchoReplicator());\n }\n\n get dataSpaceManager(): DataSpaceManager {\n return (this._props.dataSpaceManager ??= new DataSpaceManager({\n spaceManager: this.spaceManager,\n metadataStore: this.metadataStore,\n keyring: this.keyring,\n signingContext: this.identity,\n feedStore: this.feedStore,\n echoHost: this.echoHost,\n invitationsManager: this.invitationsManager,\n edgeConnection: undefined,\n meshReplicator: this.meshEchoReplicator,\n echoEdgeReplicator: undefined,\n runtimeParams: this._opts.dataSpaceParams,\n }));\n }\n\n get invitationsManager() {\n return (this._props.invitationsManager ??= new InvitationsManager(\n new InvitationsHandler(this.networkManager),\n (invitation) => {\n if (invitation.kind === Invitation.Kind.SPACE) {\n return new SpaceInvitationProtocol(this.dataSpaceManager, this.identity!, this.keyring, invitation.spaceKey!);\n } else {\n throw new Error('not implemented');\n }\n },\n this.metadataStore,\n ));\n }\n\n async createIdentity(): Promise<void> {\n this._props.signingContext ??= await createSigningContext(this.keyring);\n this.networkManager.setPeerInfo({\n identityKey: this._props.signingContext.identityKey.toHex(),\n peerKey: this._props.signingContext.deviceKey.toHex(),\n });\n }\n\n async destroy(): Promise<void> {\n await this.level.close();\n await this.storage.reset();\n }\n}\n\nexport const createSigningContext = async (keyring: Keyring): Promise<SigningContext> => {\n const identityKey = await keyring.createKey();\n const deviceKey = await keyring.createKey();\n\n return {\n identityKey,\n deviceKey,\n credentialSigner: createCredentialSignerWithChain(\n keyring,\n {\n credential: await new CredentialGenerator(keyring, identityKey, deviceKey).createDeviceAuthorization(deviceKey),\n },\n deviceKey,\n ),\n recordCredential: async () => {}, // No-op.\n getProfile: () => undefined,\n };\n};\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,yBAAiC;AAEjC,kBAA0B;ACF1B,mBAAwB;AACxB,6BAA6F;AAC7F,uBAA0B;AAC1B,sBAA2B;ACF3B,qBAAwB;AACxB,IAAAA,sBAAqE;AACrE,mBAA8B;AAC9B,2BAAyF;AACzF,wBAAuC;AACvC,qBAAwB;AAExB,qBAAgC;AAChC,uBAAoF;AACpF,6BAA4D;AAC5D,IAAAC,mBAA2B;AAC3B,mCAAyD;AACzD,4CAA0B;AFRnB,IAAMC,uBAAuB,OAAO,EACzCC,QACAC,OAAM,UAKNC,qCAAiB;EACfF;E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eAAe,KAAK4B,MAAMiC;IAC5B,CAAA;EACF;EAEA,IAAIrF,qBAAqB;AACvB,WAAQ,KAAKsD,OAAOtD,uBAAuB,IAAIsF,yCAC7C,IAAIC,yCAAmB,KAAK9D,cAAc,GAC1C,CAAClF,eAAAA;AACC,UAAIA,WAAW0D,SAASlC,iBAAAA,WAAWmC,KAAKC,OAAO;AAC7C,eAAO,IAAIqF,8CAAwB,KAAKR,kBAAkB,KAAKR,UAAW,KAAKhB,SAASjH,WAAWkJ,QAAQ;MAC7G,OAAO;AACL,cAAM,IAAIC,MAAM,iBAAA;MAClB;IACF,GACA,KAAKxB,aAAa;EAEtB;EAEA,MAAMxB,iBAAgC;AACpC,SAAKY,OAAOmB,mBAAmB,MAAMkB,qBAAqB,KAAKnC,OAAO;AACtE,SAAK/B,eAAemE,YAAY;MAC9BC,aAAa,KAAKvC,OAAOmB,eAAeoB,YAAYC,MAAK;MACzDC,SAAS,KAAKzC,OAAOmB,eAAeuB,UAAUF,MAAK;IACrD,CAAA;EACF;EAEA,MAAM7C,UAAyB;AAC7B,UAAM,KAAKtB,MAAMsE,MAAK;AACtB,UAAM,KAAK9E,QAAQ+E,MAAK;EAC1B;AACF;AAEO,IAAMP,uBAAuB,OAAOnC,YAAAA;AACzC,QAAMqC,cAAc,MAAMrC,QAAQ2C,UAAS;AAC3C,QAAMH,YAAY,MAAMxC,QAAQ2C,UAAS;AAEzC,SAAO;IACLN;IACAG;IACAI,sBAAkBC,qDAChB7C,SACA;MACE8C,YAAY,MAAM,IAAIC,wCAAoB/C,SAASqC,aAAaG,SAAAA,EAAWQ,0BAA0BR,SAAAA;IACvG,GACAA,SAAAA;IAEFS,kBAAkB,YAAA;IAAa;IAC/BC,YAAY,MAAM5E;EACpB;AACF;",
|
|
6
|
-
"names": ["import_credentials", "import_services", "createMockCredential", "signer", "issuer", "createCredential", "subject", "PublicKey", "Buffer", "from", "assertion", "payload", "value", "sanitizeInvitation", "invitation", "InvitationEncoder", "decode", "encode", "performInvitation", "host", "guest", "options", "hooks", "guestDeviceProfile", "codeInputDelay", "guestError", "guestConnected", "wereConnected", "hostComplete", "Trigger", "guestComplete", "authCode", "createInvitation", "then", "hostObservable", "subscribe", "hostInvitation", "state", "Invitation", "State", "CONNECTING", "wake", "onConnecting", "guestObservable", "acceptInvitation", "guestInvitation", "invariant", "swarmKey", "equals", "CONNECTED", "onConnected", "READY_FOR_AUTHENTICATION", "onReady", "code", "wait", "authenticate", "setTimeout", "AUTHENTICATING", "onAuthenticating", "SUCCESS", "onSuccess", "CANCELLED", "onCancelled", "TIMEOUT", "onTimeout", "error", "onError", "authMethod", "AuthMethod", "NONE", "ServiceContext", "invitationsManager", "kind", "Kind", "SPACE", "share", "deviceProfile", "join", "createServiceHost", "config", "signalManagerContext", "ClientServicesHost", "signalManager", "MemorySignalManager", "transportFactory", "MemoryTransportFactory", "createServiceContext", "signalManagerFactory", "signalContext", "MemorySignalManagerContext", "storage", "createStorage", "type", "StorageType", "RAM", "runtimeParams", "networkManager", "SwarmNetworkManager", "level", "createTestLevel", "open", "undefined", "invitationConnectionDefaultParams", "teleport", "controlHeartbeatInterval", "createPeers", "numPeers", "Promise", "all", "Array", "map", "peer", "Context", "createIdentity", "TestBuilder", "_ctx", "createPeer", "peerOptions", "TestPeer", "onDispose", "destroy", "dispose", "_signalContext", "_opts", "dataStore", "_props", "props", "keyring", "Keyring", "createDirectory", "feedStore", "FeedStore", "factory", "FeedFactory", "root", "hypercore", "valueEncoding", "metadataStore", "MetadataStore", "blobStore", "BlobStore", "spaceManager", "SpaceManager", "identity", "signingContext", "failUndefined", "echoHost", "EchoHost", "kv", "meshEchoReplicator", "MeshEchoReplicator", "dataSpaceManager", "DataSpaceManager", "edgeConnection", "meshReplicator", "echoEdgeReplicator", "dataSpaceParams", "InvitationsManager", "InvitationsHandler", "SpaceInvitationProtocol", "spaceKey", "Error", "createSigningContext", "setPeerInfo", "identityKey", "toHex", "peerKey", "deviceKey", "close", "reset", "createKey", "credentialSigner", "createCredentialSignerWithChain", "credential", "CredentialGenerator", "createDeviceAuthorization", "recordCredential", "getProfile"]
|
|
7
|
-
}
|