@dxos/credentials 0.7.4 → 0.7.5-feature-compute.4d9d99a

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.
@@ -1510,20 +1510,18 @@ var SpaceStateMachine = class {
1510
1510
  /**
1511
1511
  * @param credential Message to process.
1512
1512
  * @param fromFeed Key of the feed where this credential is recorded.
1513
+ * @synchronized
1513
1514
  */
1514
1515
  async process(credential, { sourceFeed, skipVerification }) {
1515
- if (credential.id) {
1516
- if (this._processedCredentials.has(credential.id)) {
1517
- return true;
1518
- }
1519
- this._processedCredentials.add(credential.id);
1516
+ if (credential.id && this._processedCredentials.has(credential.id)) {
1517
+ return true;
1520
1518
  }
1521
1519
  if (!skipVerification) {
1522
1520
  const result = await verifyCredential(credential);
1523
1521
  if (result.kind !== "pass") {
1524
1522
  log3.warn(`Invalid credential: ${result.errors.join(", ")}`, void 0, {
1525
1523
  F: __dxlog_file6,
1526
- L: 155,
1524
+ L: 153,
1527
1525
  S: this,
1528
1526
  C: (f, a) => f(...a)
1529
1527
  });
@@ -1536,7 +1534,7 @@ var SpaceStateMachine = class {
1536
1534
  if (this._genesisCredential) {
1537
1535
  log3.warn("Space already has a genesis credential.", void 0, {
1538
1536
  F: __dxlog_file6,
1539
- L: 164,
1537
+ L: 162,
1540
1538
  S: this,
1541
1539
  C: (f, a) => f(...a)
1542
1540
  });
@@ -1545,7 +1543,7 @@ var SpaceStateMachine = class {
1545
1543
  if (!credential.issuer.equals(this._spaceKey)) {
1546
1544
  log3.warn("Space genesis credential must be issued by space.", void 0, {
1547
1545
  F: __dxlog_file6,
1548
- L: 168,
1546
+ L: 166,
1549
1547
  S: this,
1550
1548
  C: (f, a) => f(...a)
1551
1549
  });
@@ -1554,7 +1552,7 @@ var SpaceStateMachine = class {
1554
1552
  if (!credential.subject.id.equals(this._spaceKey)) {
1555
1553
  log3.warn("Space genesis credential must be issued to space.", void 0, {
1556
1554
  F: __dxlog_file6,
1557
- L: 172,
1555
+ L: 170,
1558
1556
  S: this,
1559
1557
  C: (f, a) => f(...a)
1560
1558
  });
@@ -1570,7 +1568,7 @@ var SpaceStateMachine = class {
1570
1568
  if (!this._genesisCredential) {
1571
1569
  log3.warn("Space must have a genesis credential before adding members.", void 0, {
1572
1570
  F: __dxlog_file6,
1573
- L: 185,
1571
+ L: 183,
1574
1572
  S: this,
1575
1573
  C: (f, a) => f(...a)
1576
1574
  });
@@ -1579,7 +1577,7 @@ var SpaceStateMachine = class {
1579
1577
  if (!this._canInviteNewMembers(credential.issuer)) {
1580
1578
  log3.warn(`Space member is not authorized to invite new members: ${credential.issuer}`, void 0, {
1581
1579
  F: __dxlog_file6,
1582
- L: 189,
1580
+ L: 187,
1583
1581
  S: this,
1584
1582
  C: (f, a) => f(...a)
1585
1583
  });
@@ -1593,7 +1591,7 @@ var SpaceStateMachine = class {
1593
1591
  if (!this._genesisCredential) {
1594
1592
  log3.warn("Space must have a genesis credential before adding members.", void 0, {
1595
1593
  F: __dxlog_file6,
1596
- L: 200,
1594
+ L: 198,
1597
1595
  S: this,
1598
1596
  C: (f, a) => f(...a)
1599
1597
  });
@@ -1606,16 +1604,19 @@ var SpaceStateMachine = class {
1606
1604
  if (!this._genesisCredential) {
1607
1605
  log3.warn("Space must have a genesis credential before admitting feeds.", void 0, {
1608
1606
  F: __dxlog_file6,
1609
- L: 210,
1607
+ L: 208,
1610
1608
  S: this,
1611
1609
  C: (f, a) => f(...a)
1612
1610
  });
1613
1611
  return false;
1614
1612
  }
1615
1613
  if (!this._canAdmitFeeds(credential.issuer)) {
1616
- log3.warn(`Space member is not authorized to admit feeds: ${credential.issuer}`, void 0, {
1614
+ log3.warn(`Space member is not authorized to admit feeds: ${credential.issuer}`, {
1615
+ sourceFeed: sourceFeed.toHex(),
1616
+ feed: credential.subject.id.toHex()
1617
+ }, {
1617
1618
  F: __dxlog_file6,
1618
- L: 214,
1619
+ L: 212,
1619
1620
  S: this,
1620
1621
  C: (f, a) => f(...a)
1621
1622
  });
@@ -1629,7 +1630,7 @@ var SpaceStateMachine = class {
1629
1630
  if (!this._canInviteNewMembers(credential.issuer)) {
1630
1631
  log3.warn(`Invalid invitation, space member is not authorized to invite new members: ${credential.issuer}`, void 0, {
1631
1632
  F: __dxlog_file6,
1632
- L: 225,
1633
+ L: 226,
1633
1634
  S: this,
1634
1635
  C: (f, a) => f(...a)
1635
1636
  });
@@ -1654,6 +1655,9 @@ var SpaceStateMachine = class {
1654
1655
  }
1655
1656
  }
1656
1657
  await this.onCredentialProcessed.callIfSet(credential);
1658
+ if (credential.id) {
1659
+ this._processedCredentials.add(credential.id);
1660
+ }
1657
1661
  return true;
1658
1662
  }
1659
1663
  getMemberRole(memberKey) {
@@ -1677,7 +1681,7 @@ var CredentialConsumer = class {
1677
1681
  this._onClose = _onClose;
1678
1682
  this._ctx = new Context(void 0, {
1679
1683
  F: __dxlog_file6,
1680
- L: 275
1684
+ L: 280
1681
1685
  });
1682
1686
  this._isReadyForLiveCredentials = false;
1683
1687
  }