@dxos/client 2.33.7-dev.c2ba88fb → 2.33.8-dev.8609bc45

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.
Files changed (44) hide show
  1. package/README.md +1 -1
  2. package/dist/src/api/client.d.ts +1 -1
  3. package/dist/src/api/client.test.js +3 -3
  4. package/dist/src/api/client.test.js.map +1 -1
  5. package/dist/src/api/proxies/echo-proxy.d.ts.map +1 -1
  6. package/dist/src/api/proxies/echo-proxy.js.map +1 -1
  7. package/dist/src/api/proxies/halo-proxy.d.ts +17 -12
  8. package/dist/src/api/proxies/halo-proxy.d.ts.map +1 -1
  9. package/dist/src/api/proxies/halo-proxy.js +26 -10
  10. package/dist/src/api/proxies/halo-proxy.js.map +1 -1
  11. package/dist/src/api/proxies/party-proxy.d.ts +1 -1
  12. package/dist/src/api/proxies/party-proxy.d.ts.map +1 -1
  13. package/dist/src/api/proxies/party-proxy.js.map +1 -1
  14. package/dist/src/devtools/feeds.js.map +1 -1
  15. package/dist/src/devtools/network.js +2 -2
  16. package/dist/src/devtools/network.js.map +1 -1
  17. package/dist/src/index.d.ts +1 -0
  18. package/dist/src/index.d.ts.map +1 -1
  19. package/dist/src/index.js +3 -1
  20. package/dist/src/index.js.map +1 -1
  21. package/dist/src/proto/gen/dxos/halo/keys.d.ts +9 -9
  22. package/dist/src/proto/gen/google/protobuf.d.ts +4 -4
  23. package/dist/src/proto/gen/google/protobuf.d.ts.map +1 -1
  24. package/dist/src/proto/gen/index.d.ts.map +1 -1
  25. package/dist/src/proto/gen/index.js +1 -1
  26. package/dist/src/proto/gen/index.js.map +1 -1
  27. package/dist/src/proto/substitutions.d.ts +2 -2
  28. package/dist/src/proto/substitutions.d.ts.map +1 -1
  29. package/dist/src/proto/substitutions.js +2 -2
  30. package/dist/src/proto/substitutions.js.map +1 -1
  31. package/dist/src/services/impl/party.d.ts +2 -2
  32. package/dist/tsconfig.tsbuildinfo +1 -1
  33. package/package.json +19 -19
  34. package/src/api/client.test.ts +1 -1
  35. package/src/api/proxies/echo-proxy.ts +1 -1
  36. package/src/api/proxies/halo-proxy.ts +42 -17
  37. package/src/api/proxies/party-proxy.ts +1 -1
  38. package/src/devtools/feeds.ts +1 -1
  39. package/src/devtools/network.ts +1 -1
  40. package/src/index.ts +2 -0
  41. package/src/proto/gen/dxos/halo/keys.ts +9 -9
  42. package/src/proto/gen/google/protobuf.ts +4 -4
  43. package/src/proto/gen/index.ts +1 -1
  44. package/src/proto/substitutions.ts +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dxos/client",
3
- "version": "2.33.7-dev.c2ba88fb",
3
+ "version": "2.33.8-dev.8609bc45",
4
4
  "license": "MIT",
5
5
  "author": "DXOS.org",
6
6
  "main": "dist/src/index.js",
@@ -10,21 +10,21 @@
10
10
  "src"
11
11
  ],
12
12
  "dependencies": {
13
- "@dxos/async": "2.33.7-dev.c2ba88fb",
14
- "@dxos/codec-protobuf": "2.33.7-dev.c2ba88fb",
15
- "@dxos/config": "2.33.7-dev.c2ba88fb",
16
- "@dxos/credentials": "2.33.7-dev.c2ba88fb",
17
- "@dxos/crypto": "2.33.7-dev.c2ba88fb",
18
- "@dxos/debug": "2.33.7-dev.c2ba88fb",
19
- "@dxos/echo-db": "2.33.7-dev.c2ba88fb",
20
- "@dxos/echo-protocol": "2.33.7-dev.c2ba88fb",
21
- "@dxos/feed-store": "2.33.7-dev.c2ba88fb",
22
- "@dxos/model-factory": "2.33.7-dev.c2ba88fb",
23
- "@dxos/network-manager": "2.33.7-dev.c2ba88fb",
24
- "@dxos/object-model": "2.33.7-dev.c2ba88fb",
25
- "@dxos/protocols": "2.33.7-dev.c2ba88fb",
26
- "@dxos/rpc": "2.33.7-dev.c2ba88fb",
27
- "@dxos/util": "2.33.7-dev.c2ba88fb",
13
+ "@dxos/async": "2.33.8-dev.8609bc45",
14
+ "@dxos/codec-protobuf": "2.33.8-dev.8609bc45",
15
+ "@dxos/config": "2.33.8-dev.8609bc45",
16
+ "@dxos/credentials": "2.33.8-dev.8609bc45",
17
+ "@dxos/crypto": "2.33.8-dev.8609bc45",
18
+ "@dxos/debug": "2.33.8-dev.8609bc45",
19
+ "@dxos/echo-db": "2.33.8-dev.8609bc45",
20
+ "@dxos/echo-protocol": "2.33.8-dev.8609bc45",
21
+ "@dxos/feed-store": "2.33.8-dev.8609bc45",
22
+ "@dxos/model-factory": "2.33.8-dev.8609bc45",
23
+ "@dxos/network-manager": "2.33.8-dev.8609bc45",
24
+ "@dxos/object-model": "2.33.8-dev.8609bc45",
25
+ "@dxos/protocols": "2.33.8-dev.8609bc45",
26
+ "@dxos/rpc": "2.33.8-dev.8609bc45",
27
+ "@dxos/util": "2.33.8-dev.8609bc45",
28
28
  "abstract-leveldown": "~7.0.0",
29
29
  "assert": "^2.0.0",
30
30
  "debug": "^4.3.3",
@@ -38,9 +38,9 @@
38
38
  },
39
39
  "devDependencies": {
40
40
  "@dxos/eslint-plugin": "~1.0.34",
41
- "@dxos/protocols-toolchain": "2.33.6",
42
- "@dxos/random-access-multi-storage": "2.33.7-dev.c2ba88fb",
43
- "@dxos/testutils": "2.33.6",
41
+ "@dxos/protocols-toolchain": "2.33.7",
42
+ "@dxos/random-access-multi-storage": "2.33.8-dev.8609bc45",
43
+ "@dxos/testutils": "2.33.7",
44
44
  "@types/debug": "^4.1.7",
45
45
  "@types/jest": "^26.0.7",
46
46
  "@types/level-js": "~4.0.1",
@@ -9,7 +9,7 @@ import waitForExpect from 'wait-for-expect';
9
9
 
10
10
  import { sleep, waitForCondition } from '@dxos/async';
11
11
  import { ConfigObject } from '@dxos/config';
12
- import { generateSeedPhrase, keyPairFromSeedPhrase } from '@dxos/crypto';
12
+ import { generateSeedPhrase, keyPairFromSeedPhrase } from '@dxos/credentials';
13
13
  import { throwUnhandledRejection } from '@dxos/debug';
14
14
  import { InvitationDescriptor } from '@dxos/echo-db';
15
15
  import { Timeframe } from '@dxos/echo-protocol';
@@ -5,12 +5,12 @@
5
5
  import assert from 'assert';
6
6
 
7
7
  import { Event, latch } from '@dxos/async';
8
- import { PublicKey } from '@dxos/crypto';
9
8
  import { failUndefined } from '@dxos/debug';
10
9
  import { InvitationDescriptor, PARTY_ITEM_TYPE, ResultSet } from '@dxos/echo-db';
11
10
  import { PartyKey, PartySnapshot } from '@dxos/echo-protocol';
12
11
  import { ModelConstructor, ModelFactory } from '@dxos/model-factory';
13
12
  import { ObjectModel } from '@dxos/object-model';
13
+ import { PublicKey } from '@dxos/protocols';
14
14
  import { ComplexMap, SubscriptionGroup } from '@dxos/util';
15
15
 
16
16
  import { ClientServiceHost, ClientServiceProvider } from '../../services';
@@ -3,9 +3,9 @@
3
3
  //
4
4
 
5
5
  import { Event } from '@dxos/async';
6
- import { KeyRecord } from '@dxos/credentials';
7
- import { PublicKey } from '@dxos/crypto';
6
+ import { DeviceInfo, keyPairFromSeedPhrase, KeyRecord } from '@dxos/credentials';
8
7
  import { Contact, CreateProfileOptions, InvitationDescriptor, PartyMember, ResultSet } from '@dxos/echo-db';
8
+ import { PublicKey } from '@dxos/protocols';
9
9
  import { SubscriptionGroup } from '@dxos/util';
10
10
 
11
11
  import { Profile, SignRequest, SignResponse } from '../../proto/gen/dxos/client';
@@ -23,6 +23,9 @@ export interface Halo {
23
23
  createProfile (options?: CreateProfileOptions): Promise<Profile>
24
24
  recoverProfile (seedPhrase: string): Promise<Profile>
25
25
 
26
+ sign (request: SignRequest): Promise<SignResponse>
27
+ addKeyRecord (keyRecord: KeyRecord): Promise<void>
28
+
26
29
  /**
27
30
  * @deprecated
28
31
  */
@@ -32,13 +35,12 @@ export interface Halo {
32
35
  createInvitation (): Promise<InvitationRequest>
33
36
  acceptInvitation (invitationDescriptor: InvitationDescriptor): Invitation
34
37
 
35
- addKeyRecord (keyRecord: KeyRecord): Promise<void>
36
- sign (request: SignRequest): Promise<SignResponse>
38
+ queryDevices (): Promise<DeviceInfo[]>
39
+ setDevicePreference (key: string, value: string): Promise<void>
40
+ getDevicePreference (key: string): Promise<string | undefined>
37
41
 
38
42
  setGlobalPreference (key: string, value: string): Promise<void>
39
43
  getGlobalPreference (key: string): Promise<string | undefined>
40
- setDevicePreference (key: string, value: string): Promise<void>
41
- getDevicePreference (key: string): Promise<string | undefined>
42
44
  }
43
45
 
44
46
  /**
@@ -88,11 +90,29 @@ export class HaloProxy implements Halo {
88
90
  }
89
91
 
90
92
  /**
91
- * Create Profile. Add Identity key if public and secret key are provided. Then initializes profile with given username.
92
- * If not public and secret key are provided it relies on keyring to contain an identity key.
93
+ * Create Profile.
94
+ * Add Identity key if public and secret key are provided.
95
+ * Then initializes profile with given username.
96
+ * If no public and secret key or seedphrase are provided it relies on keyring to contain an identity key.
97
+ * Seedphrase must not be specified with existing keys.
93
98
  * @returns User profile info.
94
99
  */
95
- async createProfile ({ publicKey, secretKey, username }: CreateProfileOptions = {}): Promise<Profile> {
100
+ async createProfile ({
101
+ publicKey,
102
+ secretKey,
103
+ username,
104
+ seedphrase
105
+ }: CreateProfileOptions = {}): Promise<Profile> {
106
+ if (seedphrase && (publicKey || secretKey)) {
107
+ throw new Error('Seedphrase must not be specified with existing keys');
108
+ }
109
+
110
+ if (seedphrase) {
111
+ const keyPair = keyPairFromSeedPhrase(seedphrase);
112
+ publicKey = keyPair.publicKey;
113
+ secretKey = keyPair.secretKey;
114
+ }
115
+
96
116
  this._profile = await this._serviceProvider.services.ProfileService.createProfile({ publicKey, secretKey, username });
97
117
  return this._profile;
98
118
  }
@@ -155,20 +175,17 @@ export class HaloProxy implements Halo {
155
175
  );
156
176
  }
157
177
 
158
- async addKeyRecord (keyRecord: KeyRecord) {
159
- await this._serviceProvider.services.HaloService.addKeyRecord({ keyRecord });
160
- }
161
-
162
178
  async sign (request: SignRequest) {
163
179
  return await this._serviceProvider.services.HaloService.sign(request);
164
180
  }
165
181
 
166
- async setGlobalPreference (key: string, value: string): Promise<void> {
167
- await this._serviceProvider.services.HaloService.setGlobalPreference({ key, value });
182
+ async addKeyRecord (keyRecord: KeyRecord) {
183
+ await this._serviceProvider.services.HaloService.addKeyRecord({ keyRecord });
168
184
  }
169
185
 
170
- async getGlobalPreference (key: string): Promise<string | undefined> {
171
- return (await this._serviceProvider.services.HaloService.getGlobalPreference({ key })).value;
186
+ // TODO(burdon): Implement.
187
+ async queryDevices (): Promise<DeviceInfo[]> {
188
+ return [];
172
189
  }
173
190
 
174
191
  async setDevicePreference (key: string, value: string): Promise<void> {
@@ -179,6 +196,14 @@ export class HaloProxy implements Halo {
179
196
  return (await this._serviceProvider.services.HaloService.getDevicePreference({ key })).value;
180
197
  }
181
198
 
199
+ async setGlobalPreference (key: string, value: string): Promise<void> {
200
+ await this._serviceProvider.services.HaloService.setGlobalPreference({ key, value });
201
+ }
202
+
203
+ async getGlobalPreference (key: string): Promise<string | undefined> {
204
+ return (await this._serviceProvider.services.HaloService.getGlobalPreference({ key })).value;
205
+ }
206
+
182
207
  /**
183
208
  * Allocate resources and set-up internal subscriptions.
184
209
  *
@@ -2,7 +2,6 @@
2
2
  // Copyright 2021 DXOS.org
3
3
  //
4
4
 
5
- import { PublicKey } from '@dxos/crypto';
6
5
  import { failUndefined } from '@dxos/debug';
7
6
  import {
8
7
  PARTY_ITEM_TYPE,
@@ -17,6 +16,7 @@ import {
17
16
  import { PartyKey, PartySnapshot } from '@dxos/echo-protocol';
18
17
  import { ModelFactory } from '@dxos/model-factory';
19
18
  import { ObjectModel, ObjectProperties } from '@dxos/object-model';
19
+ import { PublicKey } from '@dxos/protocols';
20
20
 
21
21
  import { Party as PartyProto, PartyDetails } from '../../proto/gen/dxos/client';
22
22
  import { ClientServiceHost, ClientServiceProvider, ClientServiceProxy } from '../../services';
@@ -5,8 +5,8 @@
5
5
  import { Readable } from 'readable-stream';
6
6
 
7
7
  import { Stream } from '@dxos/codec-protobuf';
8
- import { PublicKey } from '@dxos/crypto';
9
8
  import { createBatchStream } from '@dxos/feed-store';
9
+ import { PublicKey } from '@dxos/protocols';
10
10
 
11
11
  import {
12
12
  SubscribeToFeedsRequest,
@@ -3,8 +3,8 @@
3
3
  //
4
4
 
5
5
  import { Stream } from '@dxos/codec-protobuf';
6
- import { PublicKey } from '@dxos/crypto';
7
6
  import { SignalApi } from '@dxos/network-manager';
7
+ import { PublicKey } from '@dxos/protocols';
8
8
 
9
9
  import {
10
10
  GetNetworkPeersRequest,
package/src/index.ts CHANGED
@@ -2,6 +2,8 @@
2
2
  // Copyright 2020 DXOS.org
3
3
  //
4
4
 
5
+ export { generateSeedPhrase } from '@dxos/credentials';
6
+
5
7
  export {
6
8
  PARTY_ITEM_TYPE, // TODO(burdon): Remove?
7
9
  Entity,
@@ -27,36 +27,36 @@ export interface PrivKey {
27
27
  }
28
28
  export interface KeyRecord {
29
29
  /**
30
- * - The `KeyType` type of the key. This is often unknown for keys from other sources.
30
+ * The `KeyType` type of the key. This is often unknown for keys from other sources.
31
31
  */
32
32
  type: KeyType;
33
33
  /**
34
- * - The public key as a Buffer (required).
34
+ * The public key as a Buffer (required).
35
35
  */
36
36
  publicKey: ReturnType<(typeof substitutions)["dxos.halo.keys.PubKey"]["decode"]>;
37
37
  /**
38
- * - The secret key as a Buffer (this will never be visible outside the Keyring).
38
+ * The secret key as a Buffer (this will never be visible outside the Keyring).
39
39
  */
40
40
  secretKey?: ReturnType<(typeof substitutions)["dxos.halo.keys.PrivKey"]["decode"]>;
41
41
  /**
42
- * - Is this key from a Greeting "hint"?
42
+ * Is this key from a Greeting "hint"?
43
43
  */
44
44
  hint?: boolean;
45
45
  /**
46
- * - Is this our key? Usually true if `secretKey` is present,
47
- * may be false for "inception keys" such as the Party key.
46
+ * Determines if this is our key?
47
+ * Usually true if `secretKey` is present; may be false for "inception keys" such as the Party key.
48
48
  */
49
49
  own?: boolean;
50
50
  /**
51
- * - Is this key to be trusted?
51
+ * Is this key to be trusted?
52
52
  */
53
53
  trusted?: boolean;
54
54
  /**
55
- * - An RFC-3339 date/time string for when the key was added to the Keyring.
55
+ * An RFC-3339 date/time string for when the key was added to the Keyring.
56
56
  */
57
57
  added?: string;
58
58
  /**
59
- * - An RFC-3339 date/time string for when the key was created.
59
+ * An RFC-3339 date/time string for when the key was created.
60
60
  */
61
61
  created?: string;
62
62
  }
@@ -13,14 +13,14 @@ import * as dxos_halo_keys from "../dxos/halo/keys";
13
13
  import * as dxos_rpc from "../dxos/rpc";
14
14
  export interface Empty {
15
15
  }
16
- export interface Any {
17
- type_url?: string;
18
- value?: Uint8Array;
19
- }
20
16
  export interface Timestamp {
21
17
  seconds?: string;
22
18
  nanos?: number;
23
19
  }
20
+ export interface Any {
21
+ type_url?: string;
22
+ value?: Uint8Array;
23
+ }
24
24
  export interface FileDescriptorSet {
25
25
  file?: FileDescriptorProto[];
26
26
  }