@dxos/credentials 0.6.13 → 0.6.14-main.2b6a0f3

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.
@@ -50,10 +50,12 @@ __export(node_exports, {
50
50
  defaultSecretProvider: () => defaultSecretProvider,
51
51
  defaultSecretValidator: () => defaultSecretValidator,
52
52
  generatePasscode: () => generatePasscode,
53
+ generateSeedPhrase: () => generateSeedPhrase,
53
54
  getCredentialAssertion: () => getCredentialAssertion,
54
55
  getCredentialProofPayload: () => getCredentialProofPayload,
55
56
  getPresentationProofPayload: () => getPresentationProofPayload,
56
57
  isValidAuthorizedDeviceCredential: () => isValidAuthorizedDeviceCredential,
58
+ keyPairFromSeedPhrase: () => keyPairFromSeedPhrase,
57
59
  signPresentation: () => signPresentation,
58
60
  verifyChain: () => verifyChain,
59
61
  verifyCredential: () => verifyCredential,
@@ -63,45 +65,63 @@ __export(node_exports, {
63
65
  verifyPresentationSignature: () => verifyPresentationSignature
64
66
  });
65
67
  module.exports = __toCommonJS(node_exports);
68
+ var import_bip39 = require("bip39");
69
+ var import_crypto = require("@dxos/crypto");
70
+ var import_invariant = require("@dxos/invariant");
66
71
  var import_json_stable_stringify = __toESM(require("json-stable-stringify"));
67
72
  var import_keys = require("@dxos/keys");
68
73
  var import_timeframe = require("@dxos/timeframe");
69
74
  var import_util = require("@dxos/util");
70
- var import_crypto = require("@dxos/crypto");
71
- var import_invariant = require("@dxos/invariant");
72
- var import_keys2 = require("@dxos/keys");
73
75
  var import_crypto2 = require("@dxos/crypto");
76
+ var import_invariant2 = require("@dxos/invariant");
77
+ var import_keys2 = require("@dxos/keys");
78
+ var import_crypto3 = require("@dxos/crypto");
74
79
  var import_credentials = require("@dxos/protocols/proto/dxos/halo/credentials");
75
80
  var import_timeframe2 = require("@dxos/timeframe");
76
- var import_crypto3 = require("@dxos/crypto");
81
+ var import_crypto4 = require("@dxos/crypto");
77
82
  var import_async = require("@dxos/async");
78
83
  var import_context = require("@dxos/context");
79
84
  var import_keys3 = require("@dxos/keys");
80
85
  var import_log = require("@dxos/log");
81
86
  var import_credentials2 = require("@dxos/protocols/proto/dxos/halo/credentials");
82
87
  var import_util2 = require("@dxos/util");
83
- var import_invariant2 = require("@dxos/invariant");
88
+ var import_invariant3 = require("@dxos/invariant");
84
89
  var import_keys4 = require("@dxos/keys");
85
90
  var import_util3 = require("@dxos/util");
86
91
  var import_keys5 = require("@dxos/keys");
87
92
  var import_util4 = require("@dxos/util");
88
- var import_invariant3 = require("@dxos/invariant");
93
+ var import_invariant4 = require("@dxos/invariant");
89
94
  var import_keys6 = require("@dxos/keys");
90
95
  var import_log2 = require("@dxos/log");
91
96
  var import_credentials3 = require("@dxos/protocols/proto/dxos/halo/credentials");
92
97
  var import_util5 = require("@dxos/util");
93
- var import_invariant4 = require("@dxos/invariant");
98
+ var import_invariant5 = require("@dxos/invariant");
94
99
  var import_keys7 = require("@dxos/keys");
95
100
  var import_log3 = require("@dxos/log");
96
101
  var import_util6 = require("@dxos/util");
97
102
  var import_async2 = require("@dxos/async");
98
- var import_invariant5 = require("@dxos/invariant");
103
+ var import_invariant6 = require("@dxos/invariant");
99
104
  var import_keys8 = require("@dxos/keys");
100
105
  var import_log4 = require("@dxos/log");
101
106
  var import_util7 = require("@dxos/util");
102
107
  var import_log5 = require("@dxos/log");
103
108
  var defaultSecretProvider = async () => Buffer.from("0000");
104
109
  var defaultSecretValidator = async (invitation, secret) => true;
110
+ var __dxlog_file = "/home/runner/work/dxos/dxos/packages/core/halo/credentials/src/seedphrase.ts";
111
+ var generateSeedPhrase = () => (0, import_bip39.generateMnemonic)();
112
+ var keyPairFromSeedPhrase = (seedPhrase) => {
113
+ (0, import_invariant.invariant)(seedPhrase, void 0, {
114
+ F: __dxlog_file,
115
+ L: 20,
116
+ S: void 0,
117
+ A: [
118
+ "seedPhrase",
119
+ ""
120
+ ]
121
+ });
122
+ const seed = (0, import_bip39.mnemonicToSeedSync)(seedPhrase);
123
+ return (0, import_crypto.createKeyPair)(seed);
124
+ };
105
125
  var generatePasscode = (length = 4) => {
106
126
  let passcode = "";
107
127
  for (let i = 0; i < length; i++) {
@@ -237,7 +257,7 @@ var verifyCredentialSignature = async (credential) => {
237
257
  };
238
258
  }
239
259
  const signData = getCredentialProofPayload(credential);
240
- if (!await (0, import_crypto2.verifySignature)(credential.proof.signer, signData, credential.proof.value)) {
260
+ if (!await (0, import_crypto3.verifySignature)(credential.proof.signer, signData, credential.proof.value)) {
241
261
  return {
242
262
  kind: "fail",
243
263
  errors: [
@@ -266,10 +286,10 @@ var verifyChain = async (chain, authority, subject) => {
266
286
  kind: "pass"
267
287
  };
268
288
  };
269
- var __dxlog_file = "/home/runner/work/dxos/dxos/packages/core/halo/credentials/src/credentials/credential-factory.ts";
289
+ var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/core/halo/credentials/src/credentials/credential-factory.ts";
270
290
  var createCredential = async ({ signer, issuer, subject, assertion, signingKey, chain, nonce, parentCredentialIds }) => {
271
- (0, import_invariant.invariant)(assertion["@type"], "Invalid assertion.", {
272
- F: __dxlog_file,
291
+ (0, import_invariant2.invariant)(assertion["@type"], "Invalid assertion.", {
292
+ F: __dxlog_file2,
273
293
  L: 48,
274
294
  S: void 0,
275
295
  A: [
@@ -277,8 +297,8 @@ var createCredential = async ({ signer, issuer, subject, assertion, signingKey,
277
297
  "'Invalid assertion.'"
278
298
  ]
279
299
  });
280
- (0, import_invariant.invariant)(!!signingKey === !!chain, "Chain must be provided if and only if the signing key differs from the issuer.", {
281
- F: __dxlog_file,
300
+ (0, import_invariant2.invariant)(!!signingKey === !!chain, "Chain must be provided if and only if the signing key differs from the issuer.", {
301
+ F: __dxlog_file2,
282
302
  L: 49,
283
303
  S: void 0,
284
304
  A: [
@@ -288,8 +308,8 @@ var createCredential = async ({ signer, issuer, subject, assertion, signingKey,
288
308
  });
289
309
  if (chain) {
290
310
  const result = await verifyChain(chain, issuer, signingKey);
291
- (0, import_invariant.invariant)(result.kind === "pass", "Invalid chain.", {
292
- F: __dxlog_file,
311
+ (0, import_invariant2.invariant)(result.kind === "pass", "Invalid chain.", {
312
+ F: __dxlog_file2,
293
313
  L: 52,
294
314
  S: void 0,
295
315
  A: [
@@ -319,7 +339,7 @@ var createCredential = async ({ signer, issuer, subject, assertion, signingKey,
319
339
  if (chain) {
320
340
  credential.proof.chain = chain;
321
341
  }
322
- credential.id = import_keys2.PublicKey.from(await import_crypto.subtleCrypto.digest("SHA-256", signedPayload));
342
+ credential.id = import_keys2.PublicKey.from(await import_crypto2.subtleCrypto.digest("SHA-256", signedPayload));
323
343
  return credential;
324
344
  };
325
345
  var createCredentialMessage = (credential) => {
@@ -641,7 +661,7 @@ var verifyPresentationSignature = async (presentation, proof) => {
641
661
  };
642
662
  }
643
663
  const signData = getPresentationProofPayload(presentation.credentials ?? [], proof);
644
- if (!await (0, import_crypto3.verifySignature)(proof.signer, signData, proof.value)) {
664
+ if (!await (0, import_crypto4.verifySignature)(proof.signer, signData, proof.value)) {
645
665
  return {
646
666
  kind: "fail",
647
667
  errors: [
@@ -653,7 +673,7 @@ var verifyPresentationSignature = async (presentation, proof) => {
653
673
  kind: "pass"
654
674
  };
655
675
  };
656
- var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/core/halo/credentials/src/state-machine/feed-state-machine.ts";
676
+ var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/core/halo/credentials/src/state-machine/feed-state-machine.ts";
657
677
  var FeedStateMachine = class {
658
678
  constructor(_spaceKey) {
659
679
  this._spaceKey = _spaceKey;
@@ -671,8 +691,8 @@ var FeedStateMachine = class {
671
691
  */
672
692
  async process(credential, fromFeed) {
673
693
  const assertion = getCredentialAssertion(credential);
674
- (0, import_invariant2.invariant)(assertion["@type"] === "dxos.halo.credentials.AdmittedFeed", void 0, {
675
- F: __dxlog_file2,
694
+ (0, import_invariant3.invariant)(assertion["@type"] === "dxos.halo.credentials.AdmittedFeed", void 0, {
695
+ F: __dxlog_file3,
676
696
  L: 47,
677
697
  S: this,
678
698
  A: [
@@ -680,8 +700,8 @@ var FeedStateMachine = class {
680
700
  ""
681
701
  ]
682
702
  });
683
- (0, import_invariant2.invariant)(assertion.spaceKey.equals(this._spaceKey), void 0, {
684
- F: __dxlog_file2,
703
+ (0, import_invariant3.invariant)(assertion.spaceKey.equals(this._spaceKey), void 0, {
704
+ F: __dxlog_file3,
685
705
  L: 48,
686
706
  S: this,
687
707
  A: [
@@ -765,7 +785,7 @@ var InvitationStateMachine = class {
765
785
  }
766
786
  }
767
787
  };
768
- var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/core/halo/credentials/src/graph/credential-graph.ts";
788
+ var __dxlog_file4 = "/home/runner/work/dxos/dxos/packages/core/halo/credentials/src/graph/credential-graph.ts";
769
789
  var CredentialGraph = class {
770
790
  constructor(_stateHandler) {
771
791
  this._stateHandler = _stateHandler;
@@ -820,7 +840,7 @@ var CredentialGraph = class {
820
840
  credential,
821
841
  parentId
822
842
  }, {
823
- F: __dxlog_file3,
843
+ F: __dxlog_file4,
824
844
  L: 72,
825
845
  S: this,
826
846
  C: (f, a) => f(...a)
@@ -841,8 +861,8 @@ var CredentialGraph = class {
841
861
  if (sentinelIdx >= 0) {
842
862
  vertex.children.splice(sentinelIdx, 1);
843
863
  const vertexInSentinelIdx = this._sentinel.parents.indexOf(vertex);
844
- (0, import_invariant4.invariant)(vertexInSentinelIdx >= 0, void 0, {
845
- F: __dxlog_file3,
864
+ (0, import_invariant5.invariant)(vertexInSentinelIdx >= 0, void 0, {
865
+ F: __dxlog_file4,
846
866
  L: 90,
847
867
  S: this,
848
868
  A: [
@@ -855,8 +875,8 @@ var CredentialGraph = class {
855
875
  }
856
876
  async _onVertexInserted(newVertex) {
857
877
  const { credential, assertion } = newVertex;
858
- (0, import_invariant4.invariant)(credential, void 0, {
859
- F: __dxlog_file3,
878
+ (0, import_invariant5.invariant)(credential, void 0, {
879
+ F: __dxlog_file4,
860
880
  L: 97,
861
881
  S: this,
862
882
  A: [
@@ -901,7 +921,7 @@ var CredentialGraph = class {
901
921
  (0, import_log3.log)("visit vertex", {
902
922
  id: path.head.id
903
923
  }, {
904
- F: __dxlog_file3,
924
+ F: __dxlog_file4,
905
925
  L: 132,
906
926
  S: this,
907
927
  C: (f, a) => f(...a)
@@ -910,7 +930,7 @@ var CredentialGraph = class {
910
930
  const convergedPaths = this._handleMergePoint(paths, pendingPaths, path);
911
931
  if (convergedPaths == null) {
912
932
  (0, import_log3.log)("waiting for other paths", void 0, {
913
- F: __dxlog_file3,
933
+ F: __dxlog_file4,
914
934
  L: 136,
915
935
  S: this,
916
936
  C: (f, a) => f(...a)
@@ -939,7 +959,7 @@ var CredentialGraph = class {
939
959
  head: p.head.id
940
960
  }))
941
961
  }, {
942
- F: __dxlog_file3,
962
+ F: __dxlog_file4,
943
963
  L: 155,
944
964
  S: this,
945
965
  C: (f, a) => f(...a)
@@ -965,7 +985,7 @@ var CredentialGraph = class {
965
985
  overrides: path?.stateOverrides?.mapValues((v) => this._stateHandler.toLogString(v.assertion))
966
986
  }))
967
987
  }), {
968
- F: __dxlog_file3,
988
+ F: __dxlog_file4,
969
989
  L: 175,
970
990
  S: this,
971
991
  C: (f, a) => f(...a)
@@ -982,7 +1002,7 @@ var CredentialGraph = class {
982
1002
  }
983
1003
  if (path.head.id === this._sentinel.id && paths.length > 0) {
984
1004
  (0, import_log3.log)("waiting for all the active paths to converge on the sentinel", void 0, {
985
- F: __dxlog_file3,
1005
+ F: __dxlog_file4,
986
1006
  L: 199,
987
1007
  S: this,
988
1008
  C: (f, a) => f(...a)
@@ -1012,7 +1032,7 @@ var CredentialGraph = class {
1012
1032
  subject: updatedSubject,
1013
1033
  newState: this._stateHandler.toLogString(path.head.assertion)
1014
1034
  }), {
1015
- F: __dxlog_file3,
1035
+ F: __dxlog_file4,
1016
1036
  L: 223,
1017
1037
  S: this,
1018
1038
  C: (f, a) => f(...a)
@@ -1027,7 +1047,7 @@ var CredentialGraph = class {
1027
1047
  from: path.head.id,
1028
1048
  to: choice.id
1029
1049
  }, {
1030
- F: __dxlog_file3,
1050
+ F: __dxlog_file4,
1031
1051
  L: 234,
1032
1052
  S: this,
1033
1053
  C: (f, a) => f(...a)
@@ -1124,8 +1144,8 @@ var CredentialGraph = class {
1124
1144
  return path;
1125
1145
  }
1126
1146
  _mergePaths(convergedPaths) {
1127
- (0, import_invariant4.invariant)(convergedPaths.length >= 1, void 0, {
1128
- F: __dxlog_file3,
1147
+ (0, import_invariant5.invariant)(convergedPaths.length >= 1, void 0, {
1148
+ F: __dxlog_file4,
1129
1149
  L: 324,
1130
1150
  S: this,
1131
1151
  A: [
@@ -1145,14 +1165,14 @@ var CredentialGraph = class {
1145
1165
  pathCount: convergedPaths.length,
1146
1166
  forkPoints: convergedPaths.map((fp) => fp.forkPoint?.head.id)
1147
1167
  }), {
1148
- F: __dxlog_file3,
1168
+ F: __dxlog_file4,
1149
1169
  L: 329,
1150
1170
  S: this,
1151
1171
  C: (f, a) => f(...a)
1152
1172
  });
1153
1173
  const paths = convergedPaths.map((p) => this._moveUpToForkPoint(forkPoint, p));
1154
- (0, import_invariant4.invariant)(forkPoint, void 0, {
1155
- F: __dxlog_file3,
1174
+ (0, import_invariant5.invariant)(forkPoint, void 0, {
1175
+ F: __dxlog_file4,
1156
1176
  L: 335,
1157
1177
  S: this,
1158
1178
  A: [
@@ -1181,7 +1201,7 @@ var CredentialGraph = class {
1181
1201
  forkIssuers: path.forkIssuers,
1182
1202
  state: path.state.mapValues((v) => this._stateHandler.toLogString(v.assertion))
1183
1203
  }), {
1184
- F: __dxlog_file3,
1204
+ F: __dxlog_file4,
1185
1205
  L: 348,
1186
1206
  S: this,
1187
1207
  C: (f, a) => f(...a)
@@ -1206,7 +1226,7 @@ var CredentialGraph = class {
1206
1226
  subject,
1207
1227
  state: this._stateHandler.toLogString(vertex.assertion)
1208
1228
  }), {
1209
- F: __dxlog_file3,
1229
+ F: __dxlog_file4,
1210
1230
  L: 370,
1211
1231
  S: this,
1212
1232
  C: (f, a) => f(...a)
@@ -1250,7 +1270,7 @@ var CredentialGraph = class {
1250
1270
  (0, import_log3.log)("merge point chosen to break the tie", {
1251
1271
  mergePointId: existing.head.id
1252
1272
  }, {
1253
- F: __dxlog_file3,
1273
+ F: __dxlog_file4,
1254
1274
  L: 408,
1255
1275
  S: this,
1256
1276
  C: (f, a) => f(...a)
@@ -1264,7 +1284,7 @@ var CredentialGraph = class {
1264
1284
  current: currentVertex.id,
1265
1285
  candidate: candidateVertex.id
1266
1286
  }, {
1267
- F: __dxlog_file3,
1287
+ F: __dxlog_file4,
1268
1288
  L: 415,
1269
1289
  S: this,
1270
1290
  C: (f, a) => f(...a)
@@ -1282,7 +1302,7 @@ var CredentialGraph = class {
1282
1302
  candidate.forkIssuers.size
1283
1303
  ]
1284
1304
  }, {
1285
- F: __dxlog_file3,
1305
+ F: __dxlog_file4,
1286
1306
  L: 432,
1287
1307
  S: this,
1288
1308
  C: (f, a) => f(...a)
@@ -1290,7 +1310,7 @@ var CredentialGraph = class {
1290
1310
  return candidate.forkIssuers.size > existing.forkIssuers.size;
1291
1311
  }
1292
1312
  (0, import_log3.log)("issuance date used to break the tie", void 0, {
1293
- F: __dxlog_file3,
1313
+ F: __dxlog_file4,
1294
1314
  L: 437,
1295
1315
  S: this,
1296
1316
  C: (f, a) => f(...a)
@@ -1314,7 +1334,7 @@ var toChosenPath = (path) => {
1314
1334
  vs.map((v) => v.id)
1315
1335
  ]));
1316
1336
  };
1317
- var __dxlog_file4 = "/home/runner/work/dxos/dxos/packages/core/halo/credentials/src/state-machine/member-state-machine.ts";
1337
+ var __dxlog_file5 = "/home/runner/work/dxos/dxos/packages/core/halo/credentials/src/state-machine/member-state-machine.ts";
1318
1338
  var MemberStateMachine = class {
1319
1339
  constructor(_spaceKey) {
1320
1340
  this._spaceKey = _spaceKey;
@@ -1342,8 +1362,8 @@ var MemberStateMachine = class {
1342
1362
  const assertion = getCredentialAssertion(credential);
1343
1363
  switch (assertion["@type"]) {
1344
1364
  case "dxos.halo.credentials.SpaceMember": {
1345
- (0, import_invariant3.invariant)(assertion.spaceKey.equals(this._spaceKey), void 0, {
1346
- F: __dxlog_file4,
1365
+ (0, import_invariant4.invariant)(assertion.spaceKey.equals(this._spaceKey), void 0, {
1366
+ F: __dxlog_file5,
1347
1367
  L: 66,
1348
1368
  S: this,
1349
1369
  A: [
@@ -1368,7 +1388,7 @@ var MemberStateMachine = class {
1368
1388
  import_log2.log.warn("Member not found", {
1369
1389
  id: credential.subject.id
1370
1390
  }, {
1371
- F: __dxlog_file4,
1391
+ F: __dxlog_file5,
1372
1392
  L: 81,
1373
1393
  S: this,
1374
1394
  C: (f, a) => f(...a)
@@ -1418,7 +1438,7 @@ var MemberStateMachine = class {
1418
1438
  const path2IssuerRole = this._getRole(scope2, update2.issuer);
1419
1439
  if (path2IssuerRole === import_credentials3.SpaceMember.Role.OWNER !== (path1IssuerRole === import_credentials3.SpaceMember.Role.OWNER)) {
1420
1440
  (0, import_log2.log)("owner decision used to break the tie", void 0, {
1421
- F: __dxlog_file4,
1441
+ F: __dxlog_file5,
1422
1442
  L: 139,
1423
1443
  S: this,
1424
1444
  C: (f, a) => f(...a)
@@ -1447,7 +1467,7 @@ var MemberStateMachine = class {
1447
1467
  roleOverride: this.toLogString(override.assertion),
1448
1468
  realRole: this.toLogString(scope.state.get(memberId)?.assertion)
1449
1469
  }), {
1450
- F: __dxlog_file4,
1470
+ F: __dxlog_file5,
1451
1471
  L: 162,
1452
1472
  S: this,
1453
1473
  C: (f, a) => f(...a)
@@ -1458,7 +1478,7 @@ var MemberStateMachine = class {
1458
1478
  return realRole;
1459
1479
  }
1460
1480
  };
1461
- var __dxlog_file5 = "/home/runner/work/dxos/dxos/packages/core/halo/credentials/src/state-machine/space-state-machine.ts";
1481
+ var __dxlog_file6 = "/home/runner/work/dxos/dxos/packages/core/halo/credentials/src/state-machine/space-state-machine.ts";
1462
1482
  var SpaceStateMachine = class {
1463
1483
  constructor(_spaceKey) {
1464
1484
  this._spaceKey = _spaceKey;
@@ -1536,7 +1556,7 @@ var SpaceStateMachine = class {
1536
1556
  const result = await verifyCredential(credential);
1537
1557
  if (result.kind !== "pass") {
1538
1558
  import_log.log.warn(`Invalid credential: ${result.errors.join(", ")}`, void 0, {
1539
- F: __dxlog_file5,
1559
+ F: __dxlog_file6,
1540
1560
  L: 155,
1541
1561
  S: this,
1542
1562
  C: (f, a) => f(...a)
@@ -1549,7 +1569,7 @@ var SpaceStateMachine = class {
1549
1569
  case "dxos.halo.credentials.SpaceGenesis": {
1550
1570
  if (this._genesisCredential) {
1551
1571
  import_log.log.warn("Space already has a genesis credential.", void 0, {
1552
- F: __dxlog_file5,
1572
+ F: __dxlog_file6,
1553
1573
  L: 164,
1554
1574
  S: this,
1555
1575
  C: (f, a) => f(...a)
@@ -1558,7 +1578,7 @@ var SpaceStateMachine = class {
1558
1578
  }
1559
1579
  if (!credential.issuer.equals(this._spaceKey)) {
1560
1580
  import_log.log.warn("Space genesis credential must be issued by space.", void 0, {
1561
- F: __dxlog_file5,
1581
+ F: __dxlog_file6,
1562
1582
  L: 168,
1563
1583
  S: this,
1564
1584
  C: (f, a) => f(...a)
@@ -1567,7 +1587,7 @@ var SpaceStateMachine = class {
1567
1587
  }
1568
1588
  if (!credential.subject.id.equals(this._spaceKey)) {
1569
1589
  import_log.log.warn("Space genesis credential must be issued to space.", void 0, {
1570
- F: __dxlog_file5,
1590
+ F: __dxlog_file6,
1571
1591
  L: 172,
1572
1592
  S: this,
1573
1593
  C: (f, a) => f(...a)
@@ -1583,7 +1603,7 @@ var SpaceStateMachine = class {
1583
1603
  }
1584
1604
  if (!this._genesisCredential) {
1585
1605
  import_log.log.warn("Space must have a genesis credential before adding members.", void 0, {
1586
- F: __dxlog_file5,
1606
+ F: __dxlog_file6,
1587
1607
  L: 185,
1588
1608
  S: this,
1589
1609
  C: (f, a) => f(...a)
@@ -1592,7 +1612,7 @@ var SpaceStateMachine = class {
1592
1612
  }
1593
1613
  if (!this._canInviteNewMembers(credential.issuer)) {
1594
1614
  import_log.log.warn(`Space member is not authorized to invite new members: ${credential.issuer}`, void 0, {
1595
- F: __dxlog_file5,
1615
+ F: __dxlog_file6,
1596
1616
  L: 189,
1597
1617
  S: this,
1598
1618
  C: (f, a) => f(...a)
@@ -1606,7 +1626,7 @@ var SpaceStateMachine = class {
1606
1626
  case "dxos.halo.credentials.MemberProfile": {
1607
1627
  if (!this._genesisCredential) {
1608
1628
  import_log.log.warn("Space must have a genesis credential before adding members.", void 0, {
1609
- F: __dxlog_file5,
1629
+ F: __dxlog_file6,
1610
1630
  L: 200,
1611
1631
  S: this,
1612
1632
  C: (f, a) => f(...a)
@@ -1619,7 +1639,7 @@ var SpaceStateMachine = class {
1619
1639
  case "dxos.halo.credentials.AdmittedFeed": {
1620
1640
  if (!this._genesisCredential) {
1621
1641
  import_log.log.warn("Space must have a genesis credential before admitting feeds.", void 0, {
1622
- F: __dxlog_file5,
1642
+ F: __dxlog_file6,
1623
1643
  L: 210,
1624
1644
  S: this,
1625
1645
  C: (f, a) => f(...a)
@@ -1628,7 +1648,7 @@ var SpaceStateMachine = class {
1628
1648
  }
1629
1649
  if (!this._canAdmitFeeds(credential.issuer)) {
1630
1650
  import_log.log.warn(`Space member is not authorized to admit feeds: ${credential.issuer}`, void 0, {
1631
- F: __dxlog_file5,
1651
+ F: __dxlog_file6,
1632
1652
  L: 214,
1633
1653
  S: this,
1634
1654
  C: (f, a) => f(...a)
@@ -1642,7 +1662,7 @@ var SpaceStateMachine = class {
1642
1662
  case "dxos.halo.invitations.DelegateSpaceInvitation": {
1643
1663
  if (!this._canInviteNewMembers(credential.issuer)) {
1644
1664
  import_log.log.warn(`Invalid invitation, space member is not authorized to invite new members: ${credential.issuer}`, void 0, {
1645
- F: __dxlog_file5,
1665
+ F: __dxlog_file6,
1646
1666
  L: 225,
1647
1667
  S: this,
1648
1668
  C: (f, a) => f(...a)
@@ -1690,7 +1710,7 @@ var CredentialConsumer = class {
1690
1710
  this._onOpen = _onOpen;
1691
1711
  this._onClose = _onClose;
1692
1712
  this._ctx = new import_context.Context(void 0, {
1693
- F: __dxlog_file5,
1713
+ F: __dxlog_file6,
1694
1714
  L: 275
1695
1715
  });
1696
1716
  this._isReadyForLiveCredentials = false;
@@ -1714,7 +1734,7 @@ var CredentialConsumer = class {
1714
1734
  await this._onClose();
1715
1735
  }
1716
1736
  };
1717
- var __dxlog_file6 = "/home/runner/work/dxos/dxos/packages/core/halo/credentials/src/processor/device-state-machine.ts";
1737
+ var __dxlog_file7 = "/home/runner/work/dxos/dxos/packages/core/halo/credentials/src/processor/device-state-machine.ts";
1718
1738
  var DeviceStateMachine = class {
1719
1739
  constructor(_params) {
1720
1740
  this._params = _params;
@@ -1727,7 +1747,7 @@ var DeviceStateMachine = class {
1727
1747
  deviceKey: this._params.deviceKey,
1728
1748
  credential
1729
1749
  }, {
1730
- F: __dxlog_file6,
1750
+ F: __dxlog_file7,
1731
1751
  L: 35,
1732
1752
  S: this,
1733
1753
  C: (f, a) => f(...a)
@@ -1741,8 +1761,8 @@ var DeviceStateMachine = class {
1741
1761
  const assertion = getCredentialAssertion(credential);
1742
1762
  switch (assertion["@type"]) {
1743
1763
  case "dxos.halo.credentials.AuthorizedDevice": {
1744
- (0, import_invariant5.invariant)(!this.authorizedDeviceKeys.has(assertion.deviceKey), "Device already added.", {
1745
- F: __dxlog_file6,
1764
+ (0, import_invariant6.invariant)(!this.authorizedDeviceKeys.has(assertion.deviceKey), "Device already added.", {
1765
+ F: __dxlog_file7,
1746
1766
  L: 51,
1747
1767
  S: this,
1748
1768
  A: [
@@ -1756,7 +1776,7 @@ var DeviceStateMachine = class {
1756
1776
  deviceKey: assertion.deviceKey,
1757
1777
  size: this.authorizedDeviceKeys.size
1758
1778
  }, {
1759
- F: __dxlog_file6,
1779
+ F: __dxlog_file7,
1760
1780
  L: 54,
1761
1781
  S: this,
1762
1782
  C: (f, a) => f(...a)
@@ -1765,8 +1785,8 @@ var DeviceStateMachine = class {
1765
1785
  break;
1766
1786
  }
1767
1787
  case "dxos.halo.credentials.DeviceProfile": {
1768
- (0, import_invariant5.invariant)(this.authorizedDeviceKeys.has(credential.subject.id), "Device not found.", {
1769
- F: __dxlog_file6,
1788
+ (0, import_invariant6.invariant)(this.authorizedDeviceKeys.has(credential.subject.id), "Device not found.", {
1789
+ F: __dxlog_file7,
1770
1790
  L: 64,
1771
1791
  S: this,
1772
1792
  A: [
@@ -1779,7 +1799,7 @@ var DeviceStateMachine = class {
1779
1799
  deviceKey: credential.subject.id,
1780
1800
  profile: assertion.profile
1781
1801
  }, {
1782
- F: __dxlog_file6,
1802
+ F: __dxlog_file7,
1783
1803
  L: 67,
1784
1804
  S: this,
1785
1805
  C: (f, a) => f(...a)
@@ -1792,7 +1812,7 @@ var DeviceStateMachine = class {
1792
1812
  }
1793
1813
  }
1794
1814
  };
1795
- var __dxlog_file7 = "/home/runner/work/dxos/dxos/packages/core/halo/credentials/src/processor/profile-state-machine.ts";
1815
+ var __dxlog_file8 = "/home/runner/work/dxos/dxos/packages/core/halo/credentials/src/processor/profile-state-machine.ts";
1796
1816
  var ProfileStateMachine = class {
1797
1817
  constructor(_params) {
1798
1818
  this._params = _params;
@@ -1806,7 +1826,7 @@ var ProfileStateMachine = class {
1806
1826
  expectedIdentity: this._params.identityKey,
1807
1827
  credential
1808
1828
  }, {
1809
- F: __dxlog_file7,
1829
+ F: __dxlog_file8,
1810
1830
  L: 34,
1811
1831
  S: this,
1812
1832
  C: (f, a) => f(...a)
@@ -1818,7 +1838,7 @@ var ProfileStateMachine = class {
1818
1838
  identityKey: this._params.identityKey,
1819
1839
  profile: this.profile
1820
1840
  }, {
1821
- F: __dxlog_file7,
1841
+ F: __dxlog_file8,
1822
1842
  L: 40,
1823
1843
  S: this,
1824
1844
  C: (f, a) => f(...a)
@@ -1853,10 +1873,12 @@ var ProfileStateMachine = class {
1853
1873
  defaultSecretProvider,
1854
1874
  defaultSecretValidator,
1855
1875
  generatePasscode,
1876
+ generateSeedPhrase,
1856
1877
  getCredentialAssertion,
1857
1878
  getCredentialProofPayload,
1858
1879
  getPresentationProofPayload,
1859
1880
  isValidAuthorizedDeviceCredential,
1881
+ keyPairFromSeedPhrase,
1860
1882
  signPresentation,
1861
1883
  verifyChain,
1862
1884
  verifyCredential,