@interop/wallet-core 0.101.1 → 0.104.0

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 (135) hide show
  1. package/README.md +36 -17
  2. package/dist/audiences/audienceGrant.d.ts +49 -0
  3. package/dist/audiences/audienceGrant.d.ts.map +1 -0
  4. package/dist/audiences/audienceGrant.js +46 -0
  5. package/dist/audiences/audienceGrant.js.map +1 -0
  6. package/dist/audiences/index.d.ts +10 -0
  7. package/dist/audiences/index.d.ts.map +1 -0
  8. package/dist/audiences/index.js +10 -0
  9. package/dist/audiences/index.js.map +1 -0
  10. package/dist/clientAnnex/grantRevocation.d.ts +0 -18
  11. package/dist/clientAnnex/grantRevocation.d.ts.map +1 -1
  12. package/dist/clientAnnex/grantRevocation.js +2 -40
  13. package/dist/clientAnnex/grantRevocation.js.map +1 -1
  14. package/dist/clientAnnex/index.d.ts +2 -1
  15. package/dist/clientAnnex/index.d.ts.map +1 -1
  16. package/dist/clientAnnex/index.js +2 -1
  17. package/dist/clientAnnex/index.js.map +1 -1
  18. package/dist/clientAnnex/log.d.ts +4 -42
  19. package/dist/clientAnnex/log.d.ts.map +1 -1
  20. package/dist/clientAnnex/log.js +10 -65
  21. package/dist/clientAnnex/log.js.map +1 -1
  22. package/dist/clients/rosterPolicy.d.ts.map +1 -1
  23. package/dist/clients/rosterPolicy.js +3 -1
  24. package/dist/clients/rosterPolicy.js.map +1 -1
  25. package/dist/connections/didKey.d.ts +27 -0
  26. package/dist/connections/didKey.d.ts.map +1 -1
  27. package/dist/connections/didKey.js +42 -6
  28. package/dist/connections/didKey.js.map +1 -1
  29. package/dist/connections/entry.d.ts +95 -13
  30. package/dist/connections/entry.d.ts.map +1 -1
  31. package/dist/connections/entry.js +102 -16
  32. package/dist/connections/entry.js.map +1 -1
  33. package/dist/connections/grantProof.d.ts +64 -0
  34. package/dist/connections/grantProof.d.ts.map +1 -0
  35. package/dist/connections/grantProof.js +195 -0
  36. package/dist/connections/grantProof.js.map +1 -0
  37. package/dist/connections/grants.d.ts +225 -3
  38. package/dist/connections/grants.d.ts.map +1 -1
  39. package/dist/connections/grants.js +293 -8
  40. package/dist/connections/grants.js.map +1 -1
  41. package/dist/connections/index.d.ts +22 -8
  42. package/dist/connections/index.d.ts.map +1 -1
  43. package/dist/connections/index.js +19 -6
  44. package/dist/connections/index.js.map +1 -1
  45. package/dist/connections/read.d.ts.map +1 -1
  46. package/dist/connections/read.js +2 -1
  47. package/dist/connections/read.js.map +1 -1
  48. package/dist/connections/resourceId.d.ts +33 -0
  49. package/dist/connections/resourceId.d.ts.map +1 -1
  50. package/dist/connections/resourceId.js +88 -8
  51. package/dist/connections/resourceId.js.map +1 -1
  52. package/dist/connections/upsert.d.ts +252 -7
  53. package/dist/connections/upsert.d.ts.map +1 -1
  54. package/dist/connections/upsert.js +674 -41
  55. package/dist/connections/upsert.js.map +1 -1
  56. package/dist/connections/writers.js +2 -1
  57. package/dist/connections/writers.js.map +1 -1
  58. package/dist/descriptors/index.d.ts +5 -0
  59. package/dist/descriptors/index.d.ts.map +1 -1
  60. package/dist/descriptors/index.js +5 -0
  61. package/dist/descriptors/index.js.map +1 -1
  62. package/dist/descriptors/logSource.d.ts +9 -4
  63. package/dist/descriptors/logSource.d.ts.map +1 -1
  64. package/dist/descriptors/logSource.js +13 -6
  65. package/dist/descriptors/logSource.js.map +1 -1
  66. package/dist/jsonObject.d.ts +16 -0
  67. package/dist/jsonObject.d.ts.map +1 -0
  68. package/dist/jsonObject.js +18 -0
  69. package/dist/jsonObject.js.map +1 -0
  70. package/dist/keys/index.d.ts +13 -9
  71. package/dist/keys/index.d.ts.map +1 -1
  72. package/dist/keys/index.js +11 -7
  73. package/dist/keys/index.js.map +1 -1
  74. package/dist/keys/userKeyCascade.d.ts +46 -0
  75. package/dist/keys/userKeyCascade.d.ts.map +1 -1
  76. package/dist/keys/userKeyCascade.js +153 -65
  77. package/dist/keys/userKeyCascade.js.map +1 -1
  78. package/dist/keys/userKeyRoster.d.ts +60 -7
  79. package/dist/keys/userKeyRoster.d.ts.map +1 -1
  80. package/dist/keys/userKeyRoster.js +165 -47
  81. package/dist/keys/userKeyRoster.js.map +1 -1
  82. package/dist/keys/userKeyRosterCascade.d.ts.map +1 -1
  83. package/dist/keys/userKeyRosterCascade.js +1 -0
  84. package/dist/keys/userKeyRosterCascade.js.map +1 -1
  85. package/dist/menders/ids.d.ts +1 -1
  86. package/dist/menders/ids.d.ts.map +1 -1
  87. package/dist/menders/ids.js +20 -4
  88. package/dist/menders/ids.js.map +1 -1
  89. package/dist/resourceLog/controller.d.ts +11 -7
  90. package/dist/resourceLog/controller.d.ts.map +1 -1
  91. package/dist/resourceLog/controller.js +15 -31
  92. package/dist/resourceLog/controller.js.map +1 -1
  93. package/dist/resourceLog/document.d.ts +9 -11
  94. package/dist/resourceLog/document.d.ts.map +1 -1
  95. package/dist/resourceLog/document.js +9 -11
  96. package/dist/resourceLog/document.js.map +1 -1
  97. package/dist/space/collections.d.ts +23 -3
  98. package/dist/space/collections.d.ts.map +1 -1
  99. package/dist/space/collections.js +26 -2
  100. package/dist/space/collections.js.map +1 -1
  101. package/dist/space/inboxMessage.d.ts +47 -0
  102. package/dist/space/inboxMessage.d.ts.map +1 -0
  103. package/dist/space/inboxMessage.js +86 -0
  104. package/dist/space/inboxMessage.js.map +1 -0
  105. package/dist/space/index.d.ts +6 -1
  106. package/dist/space/index.d.ts.map +1 -1
  107. package/dist/space/index.js +5 -1
  108. package/dist/space/index.js.map +1 -1
  109. package/dist/sync/contactsConflict.d.ts +23 -10
  110. package/dist/sync/contactsConflict.d.ts.map +1 -1
  111. package/dist/sync/contactsConflict.js +40 -21
  112. package/dist/sync/contactsConflict.js.map +1 -1
  113. package/dist/unlock/index.d.ts +1 -1
  114. package/dist/unlock/index.d.ts.map +1 -1
  115. package/dist/unlock/index.js +1 -1
  116. package/dist/unlock/index.js.map +1 -1
  117. package/dist/webvh/clientAnnexDid.d.ts +76 -0
  118. package/dist/webvh/clientAnnexDid.d.ts.map +1 -0
  119. package/dist/webvh/clientAnnexDid.js +117 -0
  120. package/dist/webvh/clientAnnexDid.js.map +1 -0
  121. package/dist/webvh/didWebProjection.d.ts +38 -5
  122. package/dist/webvh/didWebProjection.d.ts.map +1 -1
  123. package/dist/webvh/didWebProjection.js +35 -22
  124. package/dist/webvh/didWebProjection.js.map +1 -1
  125. package/dist/webvh/documentDids.d.ts +3 -3
  126. package/dist/webvh/documentDids.js +3 -3
  127. package/dist/webvh/index.d.ts +4 -3
  128. package/dist/webvh/index.d.ts.map +1 -1
  129. package/dist/webvh/index.js +4 -3
  130. package/dist/webvh/index.js.map +1 -1
  131. package/dist/webvh/standingZcap.d.ts +27 -2
  132. package/dist/webvh/standingZcap.d.ts.map +1 -1
  133. package/dist/webvh/standingZcap.js +42 -4
  134. package/dist/webvh/standingZcap.js.map +1 -1
  135. package/package.json +14 -7
@@ -16,9 +16,21 @@
16
16
  * - The grant index the revocation orchestrators share
17
17
  * (`connectionGrants`, `grantTargets`, `splitGrantsByExpiry`,
18
18
  * `grantRecipientKid`), with the reader checks every reader applies.
19
+ * - The agent-connection readers: the received list (`receivedGrants`,
20
+ * `receivedGrantLapsed`, `liveInboxChannel`), the latest grant per scope
21
+ * (`latestGrantsPerScope`), a consent's renewal scope
22
+ * (`renewalScopeGrants`), the renewal predicate (`agentGrantDue`,
23
+ * `AGENT_GRANT_RENEWAL_WINDOW_MS`), and `agentConnectionsSignedBy`.
19
24
  * - The upsert helpers (`recordGrants`, `removeGrants`, `retireConnection`,
20
25
  * `unretireConnection`, `setConnectionLabel`) and their kind refusal
21
- * (`ConnectionKindMismatchError`).
26
+ * (`ConnectionKindMismatchError`), and the agent-connection helpers
27
+ * (`recordReceivedGrants`, `recordRenewedGrants`, `settleOutboxItem`,
28
+ * `pruneSupersededGrants`, `dropReceivedGrant`, `clearReceivedGrants`,
29
+ * `markDeclined`).
30
+ * - The proof check a renewal runs over a recorded grant
31
+ * (`verifyRecordedGrantProof`), which verifies the delegation signature
32
+ * under a key the current document lists, and the action-set readers
33
+ * (`allowsAction`, `normalizedActions`).
22
34
  * - The writer arm: lazy registration (`registerConnectionWriter`), the
23
35
  * pull-path touch (`touchConnectionWriter`), the per-entry sweep
24
36
  * (`sweepConnectionWriters`), and `resolveWriter` for history views.
@@ -26,19 +38,21 @@
26
38
  * and the account document, and `normalizeDisplayName`, the one name rule
27
39
  * every producer writes `name` through.
28
40
  */
29
- export { CONNECTION_ENTRY_VERSION, CONNECTION_KINDS, CONNECTION_WRITER_POLICY, GRANT_KINDS, connectionKindOf, connectionWriterPolicy, grantKindOf, isWritableConnectionEntry, parseConnectionEntry } from './entry.js';
30
- export type { ConnectionEntry, ConnectionGrantRecord, ConnectionKind, ConnectionWriter, ConnectionWriterPolicy, ConnectionZcap, GrantKind } from './entry.js';
31
- export { CONNECTIONS_ID_PREFIX, connectionResourceId } from './resourceId.js';
41
+ export { CONNECTION_ENTRY_VERSION, CONNECTION_KINDS, CONNECTION_SEED_BYTES, CONNECTION_WRITER_POLICY, GRANT_KINDS, RECEIVED_GRANT_KINDS, connectionKindOf, decodeConnectionSeed, connectionWriterPolicy, grantKindOf, isWritableConnectionEntry, parseConnectionEntry } from './entry.js';
42
+ export type { ConnectionEntry, ConnectionGrantRecord, ConnectionKind, ConnectionOutboxItem, ConnectionReceivedGrantRecord, ConnectionWriter, ConnectionWriterPolicy, ConnectionZcap, GrantKind, ReceivedGrantKind } from './entry.js';
43
+ export { CONNECTIONS_ID_PREFIX, connectionResourceId, connectionSeedTag, verifyConnectionSeedTag } from './resourceId.js';
32
44
  export type { ConnectionIdKey } from './resourceId.js';
33
45
  export { wasConnectionsStore } from './store.js';
34
46
  export type { ConnectionsStore, StoredConnection } from './store.js';
35
47
  export { findConnection, readConnections } from './read.js';
36
48
  export type { ConnectionsListing, ReadConnection } from './read.js';
37
- export { collectionIdInSpace, connectionGrants, grantRecipientKid, grantTargets, isTargetInSpace, splitGrantsByExpiry } from './grants.js';
38
- export type { ConnectionGrant } from './grants.js';
39
- export { connectionRecipientKid, signingKeyMultibaseOfDid } from './didKey.js';
49
+ export { AGENT_GRANT_RENEWAL_WINDOW_MS, agentConnectionsSignedBy, agentGrantDue, allowsAction, collectionIdInSpace, connectionGrants, grantRecipientKid, grantTargets, isTargetInSpace, grantScopeKey, latestGrantsPerScope, latestIndexPerScope, liveInboxChannel, normalizedActions, receivedGrantLapsed, receivedGrants, renewalScopeGrants, splitGrantsByExpiry } from './grants.js';
50
+ export type { ConnectionGrant, ConnectionReceivedGrant } from './grants.js';
51
+ export { verifyRecordedGrantProof } from './grantProof.js';
52
+ export type { GrantProofRefusal, GrantProofResult } from './grantProof.js';
53
+ export { connectionDidKey, connectionRecipientKid, signingKeyMultibaseOfDid } from './didKey.js';
40
54
  export { ConnectionKindMismatchError } from './errors.js';
41
- export { recordGrants, removeGrants, retireConnection, setConnectionLabel, unretireConnection } from './upsert.js';
55
+ export { clearReceivedGrants, dropReceivedGrant, markDeclined, pruneSupersededGrants, recordGrants, recordReceivedGrants, recordRenewedGrants, removeGrants, retireConnection, setConnectionLabel, settleOutboxItem, unretireConnection } from './upsert.js';
42
56
  export type { ConnectionWriteOutcome, ConnectionWriteResult } from './upsert.js';
43
57
  export { registerConnectionWriter, resolveWriter, sweepConnectionWriters, touchConnectionWriter } from './writers.js';
44
58
  export type { ConnectionWritersSweep, ResolvedWriter, WriterFirstSeenRecord, WriterFirstSeenStore, WriterRegistrationOutcome, WriterTouchOutcome } from './writers.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/connections/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,OAAO,EACL,wBAAwB,EACxB,gBAAgB,EAChB,wBAAwB,EACxB,WAAW,EACX,gBAAgB,EAChB,sBAAsB,EACtB,WAAW,EACX,yBAAyB,EACzB,oBAAoB,EACrB,MAAM,YAAY,CAAA;AACnB,Y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"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/connections/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,OAAO,EACL,wBAAwB,EACxB,gBAAgB,EAChB,qBAAqB,EACrB,wBAAwB,EACxB,WAAW,EACX,oBAAoB,EACpB,gBAAgB,EAChB,oBAAoB,EACpB,sBAAsB,EACtB,WAAW,EACX,yBAAyB,EACzB,oBAAoB,EACrB,MAAM,YAAY,CAAA;AACnB,YAAY,EACV,eAAe,EACf,qBAAqB,EACrB,cAAc,EACd,oBAAoB,EACpB,6BAA6B,EAC7B,gBAAgB,EAChB,sBAAsB,EACtB,cAAc,EACd,SAAS,EACT,iBAAiB,EAClB,MAAM,YAAY,CAAA;AACnB,OAAO,EACL,qBAAqB,EACrB,oBAAoB,EACpB,iBAAiB,EACjB,uBAAuB,EACxB,MAAM,iBAAiB,CAAA;AACxB,YAAY,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AACtD,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAA;AAChD,YAAY,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AACpE,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,WAAW,CAAA;AAC3D,YAAY,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA;AACnE,OAAO,EACL,6BAA6B,EAC7B,wBAAwB,EACxB,aAAa,EACb,YAAY,EACZ,mBAAmB,EACnB,gBAAgB,EAChB,iBAAiB,EACjB,YAAY,EACZ,eAAe,EACf,aAAa,EACb,oBAAoB,EACpB,mBAAmB,EACnB,gBAAgB,EAChB,iBAAiB,EACjB,mBAAmB,EACnB,cAAc,EACd,kBAAkB,EAClB,mBAAmB,EACpB,MAAM,aAAa,CAAA;AACpB,YAAY,EAAE,eAAe,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAA;AAC3E,OAAO,EAAE,wBAAwB,EAAE,MAAM,iBAAiB,CAAA;AAC1D,YAAY,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AAC1E,OAAO,EACL,gBAAgB,EAChB,sBAAsB,EACtB,wBAAwB,EACzB,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,2BAA2B,EAAE,MAAM,aAAa,CAAA;AACzD,OAAO,EACL,mBAAmB,EACnB,iBAAiB,EACjB,YAAY,EACZ,qBAAqB,EACrB,YAAY,EACZ,oBAAoB,EACpB,mBAAmB,EACnB,YAAY,EACZ,gBAAgB,EAChB,kBAAkB,EAClB,gBAAgB,EAChB,kBAAkB,EACnB,MAAM,aAAa,CAAA;AACpB,YAAY,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAA;AAChF,OAAO,EACL,wBAAwB,EACxB,aAAa,EACb,sBAAsB,EACtB,qBAAqB,EACtB,MAAM,cAAc,CAAA;AACrB,YAAY,EACV,sBAAsB,EACtB,cAAc,EACd,qBAAqB,EACrB,oBAAoB,EACpB,yBAAyB,EACzB,kBAAkB,EACnB,MAAM,cAAc,CAAA;AACrB,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAA;AACtD,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAA"}
@@ -16,9 +16,21 @@
16
16
  * - The grant index the revocation orchestrators share
17
17
  * (`connectionGrants`, `grantTargets`, `splitGrantsByExpiry`,
18
18
  * `grantRecipientKid`), with the reader checks every reader applies.
19
+ * - The agent-connection readers: the received list (`receivedGrants`,
20
+ * `receivedGrantLapsed`, `liveInboxChannel`), the latest grant per scope
21
+ * (`latestGrantsPerScope`), a consent's renewal scope
22
+ * (`renewalScopeGrants`), the renewal predicate (`agentGrantDue`,
23
+ * `AGENT_GRANT_RENEWAL_WINDOW_MS`), and `agentConnectionsSignedBy`.
19
24
  * - The upsert helpers (`recordGrants`, `removeGrants`, `retireConnection`,
20
25
  * `unretireConnection`, `setConnectionLabel`) and their kind refusal
21
- * (`ConnectionKindMismatchError`).
26
+ * (`ConnectionKindMismatchError`), and the agent-connection helpers
27
+ * (`recordReceivedGrants`, `recordRenewedGrants`, `settleOutboxItem`,
28
+ * `pruneSupersededGrants`, `dropReceivedGrant`, `clearReceivedGrants`,
29
+ * `markDeclined`).
30
+ * - The proof check a renewal runs over a recorded grant
31
+ * (`verifyRecordedGrantProof`), which verifies the delegation signature
32
+ * under a key the current document lists, and the action-set readers
33
+ * (`allowsAction`, `normalizedActions`).
22
34
  * - The writer arm: lazy registration (`registerConnectionWriter`), the
23
35
  * pull-path touch (`touchConnectionWriter`), the per-entry sweep
24
36
  * (`sweepConnectionWriters`), and `resolveWriter` for history views.
@@ -26,14 +38,15 @@
26
38
  * and the account document, and `normalizeDisplayName`, the one name rule
27
39
  * every producer writes `name` through.
28
40
  */
29
- export { CONNECTION_ENTRY_VERSION, CONNECTION_KINDS, CONNECTION_WRITER_POLICY, GRANT_KINDS, connectionKindOf, connectionWriterPolicy, grantKindOf, isWritableConnectionEntry, parseConnectionEntry } from './entry.js';
30
- export { CONNECTIONS_ID_PREFIX, connectionResourceId } from './resourceId.js';
41
+ export { CONNECTION_ENTRY_VERSION, CONNECTION_KINDS, CONNECTION_SEED_BYTES, CONNECTION_WRITER_POLICY, GRANT_KINDS, RECEIVED_GRANT_KINDS, connectionKindOf, decodeConnectionSeed, connectionWriterPolicy, grantKindOf, isWritableConnectionEntry, parseConnectionEntry } from './entry.js';
42
+ export { CONNECTIONS_ID_PREFIX, connectionResourceId, connectionSeedTag, verifyConnectionSeedTag } from './resourceId.js';
31
43
  export { wasConnectionsStore } from './store.js';
32
44
  export { findConnection, readConnections } from './read.js';
33
- export { collectionIdInSpace, connectionGrants, grantRecipientKid, grantTargets, isTargetInSpace, splitGrantsByExpiry } from './grants.js';
34
- export { connectionRecipientKid, signingKeyMultibaseOfDid } from './didKey.js';
45
+ export { AGENT_GRANT_RENEWAL_WINDOW_MS, agentConnectionsSignedBy, agentGrantDue, allowsAction, collectionIdInSpace, connectionGrants, grantRecipientKid, grantTargets, isTargetInSpace, grantScopeKey, latestGrantsPerScope, latestIndexPerScope, liveInboxChannel, normalizedActions, receivedGrantLapsed, receivedGrants, renewalScopeGrants, splitGrantsByExpiry } from './grants.js';
46
+ export { verifyRecordedGrantProof } from './grantProof.js';
47
+ export { connectionDidKey, connectionRecipientKid, signingKeyMultibaseOfDid } from './didKey.js';
35
48
  export { ConnectionKindMismatchError } from './errors.js';
36
- export { recordGrants, removeGrants, retireConnection, setConnectionLabel, unretireConnection } from './upsert.js';
49
+ export { clearReceivedGrants, dropReceivedGrant, markDeclined, pruneSupersededGrants, recordGrants, recordReceivedGrants, recordRenewedGrants, removeGrants, retireConnection, setConnectionLabel, settleOutboxItem, unretireConnection } from './upsert.js';
37
50
  export { registerConnectionWriter, resolveWriter, sweepConnectionWriters, touchConnectionWriter } from './writers.js';
38
51
  export { normalizeDisplayName } from '../labelText.js';
39
52
  export { CONNECTIONS_COLLECTION } from '../space/collections.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/connections/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,OAAO,EACL,wBAAwB,EACxB,gBAAgB,EAChB,wBAAwB,EACxB,WAAW,EACX,gBAAgB,EAChB,sBAAsB,EACtB,WAAW,EACX,yBAAyB,EACzB,oBAAoB,EACrB,MAAM,YAAY,CAAA;AAUnB,OAAO,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAA;AAE7E,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAA;AAEhD,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,WAAW,CAAA;AAE3D,OAAO,EACL,mBAAmB,EACnB,gBAAgB,EAChB,iBAAiB,EACjB,YAAY,EACZ,eAAe,EACf,mBAAmB,EACpB,MAAM,aAAa,CAAA;AAEpB,OAAO,EAAE,sBAAsB,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAA;AAC9E,OAAO,EAAE,2BAA2B,EAAE,MAAM,aAAa,CAAA;AACzD,OAAO,EACL,YAAY,EACZ,YAAY,EACZ,gBAAgB,EAChB,kBAAkB,EAClB,kBAAkB,EACnB,MAAM,aAAa,CAAA;AAEpB,OAAO,EACL,wBAAwB,EACxB,aAAa,EACb,sBAAsB,EACtB,qBAAqB,EACtB,MAAM,cAAc,CAAA;AASrB,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAA;AACtD,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/connections/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,OAAO,EACL,wBAAwB,EACxB,gBAAgB,EAChB,qBAAqB,EACrB,wBAAwB,EACxB,WAAW,EACX,oBAAoB,EACpB,gBAAgB,EAChB,oBAAoB,EACpB,sBAAsB,EACtB,WAAW,EACX,yBAAyB,EACzB,oBAAoB,EACrB,MAAM,YAAY,CAAA;AAanB,OAAO,EACL,qBAAqB,EACrB,oBAAoB,EACpB,iBAAiB,EACjB,uBAAuB,EACxB,MAAM,iBAAiB,CAAA;AAExB,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAA;AAEhD,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,WAAW,CAAA;AAE3D,OAAO,EACL,6BAA6B,EAC7B,wBAAwB,EACxB,aAAa,EACb,YAAY,EACZ,mBAAmB,EACnB,gBAAgB,EAChB,iBAAiB,EACjB,YAAY,EACZ,eAAe,EACf,aAAa,EACb,oBAAoB,EACpB,mBAAmB,EACnB,gBAAgB,EAChB,iBAAiB,EACjB,mBAAmB,EACnB,cAAc,EACd,kBAAkB,EAClB,mBAAmB,EACpB,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ACH,WAAW,EAAE,MAAM,EAAE,CAAA;CACtB;AAED;;;;;;;;;GASG;AACH,wBAAsB,iBAAiB,CAAC,EACtC,IAAI,EACJ,OAAO,EACR,EAAE;IACD,IAAI,EAAE,OAAO,CAAA;IACb,OAAO,EAAE,eAAe,CAAA;CACzB,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAe9B;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,eAAe,CAAC,EACpC,KAAK,EACL,OAAO,EACR,EAAE;IACD,KAAK,EAAE,gBAAgB,CAAA;IACvB,OAAO,EAAE,eAAe,CAAA;CACzB,GAAG,OAAO,CAAC,kBAAkB,GAAG,IAAI,CAAC,CAwCrC;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,EAC7B,OAAO,EACP,GAAG,EACJ,EAAE;IACD,OAAO,EAAE,kBAAkB,CAAA;IAC3B,GAAG,EAAE,MAAM,CAAA;CACZ,GAAG,cAAc,GAAG,SAAS,CAE7B"}
@@ -10,7 +10,8 @@
10
10
  * derives to just to look the party up, since the host would then learn which
11
11
  * id belongs to which DID and whether that DID has an entry.
12
12
  */
13
- import { isJsonObject, parseConnectionEntry } from './entry.js';
13
+ import { isJsonObject } from '../jsonObject.js';
14
+ import { parseConnectionEntry } from './entry.js';
14
15
  import { connectionResourceId } from './resourceId.js';
15
16
  /**
16
17
  * The resource id a stored body claims by its own members: its `id`, or its
@@ -1 +1 @@
1
- {"version":3,"file":"read.js","sourceRoot":"","sources":["../../src/connections/read.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;GAQG;AACH,OAAO,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAA;AAE/D,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAA;AA2CtD;;;;;;;;;GASG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAC,EACtC,IAAI,EACJ,OAAO,EAIR;IACC,IAAI,CAAC,YAAY,CAAC,IAA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,IAA+B;SAC3C,CAAC,CAAA;IACJ,CAAC;IACD,OAAO,OAAO,CAAA;AAChB,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,cAAc,CAAC,EAC7B,OAAO,EACP,GAAG,EAIJ;IACC,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,KAAK,GAAG,CAAC,CAAA;AAC5D,CAAC"}
@@ -33,4 +33,37 @@ export declare function connectionResourceId(options: {
33
33
  writerId: string;
34
34
  did?: undefined;
35
35
  }): Promise<string>;
36
+ /**
37
+ * The tag an entry stores beside its pairwise `seed`: {@link seedTagBytes}
38
+ * in the seed's own encoding. A seed that is not 32 bytes of base64url is
39
+ * refused with a `TypeError`.
40
+ *
41
+ * @param options {object}
42
+ * @param options.hmacKey {ConnectionIdKey} the collection's blinded-index
43
+ * key
44
+ * @param options.seed {string} the seed, base64url with no padding
45
+ * @returns {Promise<string>}
46
+ */
47
+ export declare function connectionSeedTag({ hmacKey, seed }: {
48
+ hmacKey: ConnectionIdKey;
49
+ seed: string;
50
+ }): Promise<string>;
51
+ /**
52
+ * Whether a stored `seedTag` is the tag of a stored `seed` under this
53
+ * directory's blinded-index key. A malformed seed or tag reads as `false`.
54
+ * Every site that turns a seed into a key asks this first and fails closed
55
+ * on `false`.
56
+ *
57
+ * @param options {object}
58
+ * @param options.hmacKey {ConnectionIdKey} the collection's blinded-index
59
+ * key
60
+ * @param options.seed {string} the stored seed
61
+ * @param options.seedTag {string} the stored tag
62
+ * @returns {Promise<boolean>}
63
+ */
64
+ export declare function verifyConnectionSeedTag({ hmacKey, seed, seedTag }: {
65
+ hmacKey: ConnectionIdKey;
66
+ seed: string;
67
+ seedTag: string;
68
+ }): Promise<boolean>;
36
69
  //# sourceMappingURL=resourceId.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"resourceId.d.ts","sourceRoot":"","sources":["../../src/connections/resourceId.ts"],"names":[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,EACP,IAAI,EACL,EAAE;IACD,OAAO,EAAE,eAAe,CAAA;IACxB,IAAI,EAAE,MAAM,CAAA;CACb,GAAG,OAAO,CAAC,MAAM,CAAC,CASlB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,uBAAuB,CAAC,EAC5C,OAAO,EACP,IAAI,EACJ,OAAO,EACR,EAAE;IACD,OAAO,EAAE,eAAe,CAAA;IACxB,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;CAChB,GAAG,OAAO,CAAC,OAAO,CAAC,CAOnB"}
@@ -2,14 +2,24 @@
2
2
  * Copyright (c) 2026 Interop Alliance. All rights reserved.
3
3
  */
4
4
  /**
5
- * The directory's resource id: where one party's entry lives.
5
+ * The directory's two keyed values: the resource id where one party's entry
6
+ * lives, and the tag over an entry's pairwise seed. Both are HMAC-SHA-256
7
+ * under the collection's blinded-index key, domain-separated by the
8
+ * `connections/v1` prefix and an arm name, so one key signs no two kinds of
9
+ * input under the same bytes.
6
10
  *
7
11
  * The id is the first 16 bytes of
8
12
  * `HMAC-SHA-256(hmacKey, utf8('connections/v1' + '|' + armInput))`, formatted
9
- * with was-client's `edvIdFromBytes`. `hmacKey` is the collection's
10
- * blinded-index key. `armInput` is `'did:' + did` for a party with a DID and
11
- * `'writer:' + writerId` for a keyless writer. The account DID is not an
12
- * input.
13
+ * with was-client's `edvIdFromBytes`. `armInput` is `'did:' + did` for a
14
+ * party with a DID and `'writer:' + writerId` for a keyless writer. The
15
+ * account DID is not an input.
16
+ *
17
+ * The seed tag is the full 32 bytes of
18
+ * `HMAC-SHA-256(hmacKey, utf8('connections/v1' + '|' + 'seed:') || seedBytes)`,
19
+ * base64url with no padding. The blinded-index key is wrapped to the user
20
+ * key's KAK in the descriptor and the descriptor is log-governed, so the host
21
+ * lacks it: a seed the host planted on an entry carries no tag that verifies,
22
+ * and every site that turns a seed into a key checks the tag first.
13
23
  *
14
24
  * Keying the id stops the storage host from computing the id of a guessed
15
25
  * DID and probing for it. The protection lasts only while reads keep it: a
@@ -18,11 +28,27 @@
18
28
  */
19
29
  import { hmac } from '@noble/hashes/hmac.js';
20
30
  import { sha256 } from '@noble/hashes/sha2.js';
31
+ import { equalBytes } from '@noble/ciphers/utils.js';
32
+ import { base64urlnopad } from '@scure/base';
21
33
  import { edvIdFromBytes } from '@interop/was-client/edv/cipher';
34
+ import { decodeConnectionSeed } from './entry.js';
22
35
  /**
23
36
  * The domain prefix of every directory resource id.
24
37
  */
25
38
  export const CONNECTIONS_ID_PREFIX = 'connections/v1';
39
+ /**
40
+ * HMAC-SHA-256 under the blinded-index key, in either form.
41
+ *
42
+ * @param options {object}
43
+ * @param options.hmacKey {ConnectionIdKey}
44
+ * @param options.data {Uint8Array}
45
+ * @returns {Promise<Uint8Array>}
46
+ */
47
+ async function keyedMac({ hmacKey, data }) {
48
+ return hmacKey instanceof Uint8Array
49
+ ? hmac(sha256, hmacKey, data)
50
+ : hmacKey.sign({ data });
51
+ }
26
52
  /**
27
53
  * The resource id of a party's entry (`did`) or of a keyless writer's entry
28
54
  * (`writerId`). Exactly one of the two is given.
@@ -41,9 +67,63 @@ export async function connectionResourceId(options) {
41
67
  }
42
68
  const armInput = did !== undefined ? `did:${did}` : `writer:${writerId}`;
43
69
  const data = new TextEncoder().encode(`${CONNECTIONS_ID_PREFIX}|${armInput}`);
44
- const mac = hmacKey instanceof Uint8Array
45
- ? hmac(sha256, hmacKey, data)
46
- : await hmacKey.sign({ data });
70
+ const mac = await keyedMac({ hmacKey, data });
47
71
  return edvIdFromBytes(mac.subarray(0, 16));
48
72
  }
73
+ /**
74
+ * The tag bytes over a seed: the full MAC over the `seed:` arm's prefix
75
+ * followed by the raw seed bytes.
76
+ *
77
+ * @param options {object}
78
+ * @param options.hmacKey {ConnectionIdKey}
79
+ * @param options.seedBytes {Uint8Array}
80
+ * @returns {Promise<Uint8Array>}
81
+ */
82
+ async function seedTagBytes({ hmacKey, seedBytes }) {
83
+ const prefix = new TextEncoder().encode(`${CONNECTIONS_ID_PREFIX}|seed:`);
84
+ const data = new Uint8Array(prefix.length + seedBytes.length);
85
+ data.set(prefix);
86
+ data.set(seedBytes, prefix.length);
87
+ return keyedMac({ hmacKey, data });
88
+ }
89
+ /**
90
+ * The tag an entry stores beside its pairwise `seed`: {@link seedTagBytes}
91
+ * in the seed's own encoding. A seed that is not 32 bytes of base64url is
92
+ * refused with a `TypeError`.
93
+ *
94
+ * @param options {object}
95
+ * @param options.hmacKey {ConnectionIdKey} the collection's blinded-index
96
+ * key
97
+ * @param options.seed {string} the seed, base64url with no padding
98
+ * @returns {Promise<string>}
99
+ */
100
+ export async function connectionSeedTag({ hmacKey, seed }) {
101
+ const seedBytes = decodeConnectionSeed(seed);
102
+ if (seedBytes === undefined) {
103
+ throw new TypeError('A connection seed is 43 characters of base64url with no padding, ' +
104
+ 'decoding to 32 bytes.');
105
+ }
106
+ return base64urlnopad.encode(await seedTagBytes({ hmacKey, seedBytes }));
107
+ }
108
+ /**
109
+ * Whether a stored `seedTag` is the tag of a stored `seed` under this
110
+ * directory's blinded-index key. A malformed seed or tag reads as `false`.
111
+ * Every site that turns a seed into a key asks this first and fails closed
112
+ * on `false`.
113
+ *
114
+ * @param options {object}
115
+ * @param options.hmacKey {ConnectionIdKey} the collection's blinded-index
116
+ * key
117
+ * @param options.seed {string} the stored seed
118
+ * @param options.seedTag {string} the stored tag
119
+ * @returns {Promise<boolean>}
120
+ */
121
+ export async function verifyConnectionSeedTag({ hmacKey, seed, seedTag }) {
122
+ const seedBytes = decodeConnectionSeed(seed);
123
+ const tagBytes = decodeConnectionSeed(seedTag);
124
+ if (seedBytes === undefined || tagBytes === undefined) {
125
+ return false;
126
+ }
127
+ return equalBytes(await seedTagBytes({ hmacKey, seedBytes }), tagBytes);
128
+ }
49
129
  //# sourceMappingURL=resourceId.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"resourceId.js","sourceRoot":"","sources":["../../src/connections/resourceId.ts"],"names":[],"mappings":"AAAA;;GA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AO,KAAK,CAAA;IACd,CAAC;IACD,OAAO,UAAU,CAAC,MAAM,YAAY,CAAC,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC,EAAE,QAAQ,CAAC,CAAA;AACzE,CAAC"}
@@ -1,4 +1,7 @@
1
- import type { ConnectionEntry, ConnectionKind, GrantKind } from './entry.js';
1
+ /*!
2
+ * Copyright (c) 2026 Interop Alliance. All rights reserved.
3
+ */
4
+ import type { ConnectionEntry, ConnectionKind, GrantKind, ReceivedGrantKind } from './entry.js';
2
5
  import type { ConnectionIdKey } from './resourceId.js';
3
6
  import type { ConnectionsStore } from './store.js';
4
7
  /**
@@ -83,9 +86,33 @@ export declare function writeConnection<Stop>({ store, hmacKey, resourceId, chan
83
86
  * it. Each new grant is added by its capability id (one already recorded is
84
87
  * left as stored), `name` is set when it passes the display-name rule (left
85
88
  * as it was otherwise), `origin`, `url`, and `appKey` are set when given,
86
- * `retired` is cleared, and `lastSeen` moves to `now`. `firstSeen` is set
87
- * only on create, and `label` is never touched. A zero-grant consent writes
88
- * too, so an App Connect app with no grants is indexed by its key.
89
+ * `retired` and `declined` are cleared, and `lastSeen` moves to `now`.
90
+ * `firstSeen` is set only on create, and `label` is never touched. Every
91
+ * grant of one call carries the same `grantedAt`. A zero-grant consent
92
+ * writes too, so an App Connect app with no grants is indexed by its key.
93
+ *
94
+ * With `unlessRetired`, a retired entry is left as stored and the result's
95
+ * outcome is `unchanged`. A party's own fresh consent un-retires its entry,
96
+ * and a restore the owner runs from a listing does not: the entry was
97
+ * retired by a revoke that landed after that listing was read, and the
98
+ * restore must not undo it. The check runs inside the compare-and-swap, so
99
+ * a revoke racing the write is met on the re-read.
100
+ *
101
+ * A `message` (an envelope carrying exactly the grants of this call) is
102
+ * queued on `outbox` in the same write, stamped `now`, so a restore that
103
+ * records fresh grants and owes the party their envelope has no tear between
104
+ * the two. Each zcap of this call is first removed from every pending
105
+ * envelope that carries it (an envelope left with none is dropped), so no
106
+ * two pending envelopes name one zcap id. A consent torn after its write
107
+ * lands and re-run therefore leaves one pending envelope, the re-run's, and
108
+ * a grant recorded earlier with no envelope is told on the first call that
109
+ * brings one.
110
+ *
111
+ * A `seed` and its `seedTag` (both or neither) are written when the entry
112
+ * carries no seed, and left as stored when it carries the same one. An entry
113
+ * carrying a different seed is refused with an `Error`, since the seed is
114
+ * written once. A tag that does not verify under `hmacKey` is refused with a
115
+ * `TypeError` before anything is read.
89
116
  *
90
117
  * Refuses an entry of another kind with {@link ConnectionKindMismatchError},
91
118
  * and a grant delegated to another party or targeting another Space with a
@@ -105,10 +132,17 @@ export declare function writeConnection<Stop>({ store, hmacKey, resourceId, chan
105
132
  * @param [options.origin] {string} the attested Web origin (App Connect)
106
133
  * @param [options.url] {string} the canonical app URL (App Connect)
107
134
  * @param [options.appKey] {string} the app-key Resource id (App Connect)
135
+ * @param [options.seed] {string} the wallet's pairwise seed toward the
136
+ * party, base64url with no padding
137
+ * @param [options.seedTag] {string} the seed's tag (`connectionSeedTag`)
138
+ * @param [options.message] {object} an envelope to queue on `outbox` with
139
+ * the consent, carrying exactly the grants of this call
140
+ * @param [options.unlessRetired] {boolean} leave a retired entry as
141
+ * stored, with the outcome `unchanged`
108
142
  * @param [options.now] {Date}
109
143
  * @returns {Promise<ConnectionWriteResult>}
110
144
  */
111
- export declare function recordGrants({ store, hmacKey, did, kind, spaceUrl, grants, name, origin, url, appKey, now }: {
145
+ export declare function recordGrants({ store, hmacKey, did, kind, spaceUrl, grants, name, origin, url, appKey, seed, seedTag, message, unlessRetired, now }: {
112
146
  store: ConnectionsStore;
113
147
  hmacKey: ConnectionIdKey;
114
148
  did: string;
@@ -122,6 +156,10 @@ export declare function recordGrants({ store, hmacKey, did, kind, spaceUrl, gran
122
156
  origin?: string;
123
157
  url?: string;
124
158
  appKey?: string;
159
+ seed?: string;
160
+ seedTag?: string;
161
+ message?: Record<string, unknown>;
162
+ unlessRetired?: boolean;
125
163
  now?: Date;
126
164
  }): Promise<ConnectionWriteResult>;
127
165
  /**
@@ -145,8 +183,9 @@ export declare function removeGrants({ store, hmacKey, did, zcapIds }: {
145
183
  }): Promise<ConnectionWriteResult>;
146
184
  /**
147
185
  * Retires the party's entry, of any kind, once a revocation has handled its
148
- * grants: empties `grants`, drops `appKey`, and stamps `retired`. `name`,
149
- * `label`, `origin`, `url`, `firstSeen`, `lastSeen`, and `writers` stay, so a
186
+ * grants: empties `grants`, `grantsReceived`, and `outbox`, drops `appKey`,
187
+ * and stamps `retired`. `name`, `label`, `origin`, `url`, `firstSeen`,
188
+ * `lastSeen`, `writers`, `seed`, `seedTag`, and `declined` stay, so a
150
189
  * departed party keeps resolving. An entry already retired with nothing left
151
190
  * to empty writes nothing, and an absent entry writes nothing.
152
191
  *
@@ -241,4 +280,210 @@ export declare function setConnectionLabel({ store, hmacKey, did, kind, label, n
241
280
  enrolledSigningKeys?: ReadonlySet<string>;
242
281
  now?: Date;
243
282
  }): Promise<ConnectionWriteResult>;
283
+ /**
284
+ * Records the capabilities a party handed the wallet on its entry's
285
+ * `grantsReceived`. Each new record is merged in turn: one whose capability
286
+ * id is already held is left as stored, so the drain's re-run is a no-op;
287
+ * one with the `grantKind` and `invocationTarget` of a held record replaces
288
+ * it when its `expires` is strictly later or when the held record has
289
+ * lapsed as of `now` (at the earlier of its `expires` and `receivedAt` plus
290
+ * `channelMaxLifetimeMs`), and leaves the held record otherwise; any other
291
+ * is appended. Every record whose `expires`
292
+ * is past by more than the revocation clock skew is then dropped. A new
293
+ * record carries `receivedAt: now`.
294
+ *
295
+ * Each grant is checked strictly before anything is read, refused with a
296
+ * `TypeError`: its known members well-formed, its `controller` the wallet's
297
+ * pairwise DID toward the party, its `invocationTarget` outside this Space,
298
+ * its kind one of `RECEIVED_GRANT_KINDS`, an `'inbox'` grant allowing POST,
299
+ * and an `expires` in strict ISO 8601 form, with any number of fractional
300
+ * second digits (a format one engine's `Date.parse` accepts and another's
301
+ * refuses would make the entry unparseable there). A retired entry is refused
302
+ * with an `Error`, and an absent entry writes nothing.
303
+ *
304
+ * @param options {object}
305
+ * @param options.store {ConnectionsStore}
306
+ * @param options.hmacKey {ConnectionIdKey}
307
+ * @param options.did {string} the party's DID
308
+ * @param options.pairwiseDid {string} the wallet's pairwise did:key toward
309
+ * the party, every received grant's controller
310
+ * @param options.spaceUrl {string} this Space's container URL, which no
311
+ * received grant may target
312
+ * @param options.grants {Array<object>} `{ zcap, grantKind }` per grant
313
+ * @param options.channelMaxLifetimeMs {number} how long after `receivedAt`
314
+ * a received record lapses at the latest
315
+ * @param [options.now] {Date}
316
+ * @returns {Promise<ConnectionWriteResult>}
317
+ */
318
+ export declare function recordReceivedGrants({ store, hmacKey, did, pairwiseDid, spaceUrl, grants, channelMaxLifetimeMs, now }: {
319
+ store: ConnectionsStore;
320
+ hmacKey: ConnectionIdKey;
321
+ did: string;
322
+ pairwiseDid: string;
323
+ spaceUrl: string;
324
+ grants: Array<{
325
+ zcap: object;
326
+ grantKind: ReceivedGrantKind;
327
+ }>;
328
+ channelMaxLifetimeMs: number;
329
+ now?: Date;
330
+ }): Promise<ConnectionWriteResult>;
331
+ /**
332
+ * The renewal's pivot: appends the renewed grant records and queues the
333
+ * envelope that carries them to the party, in one compare-and-swap. Each
334
+ * renewed record keeps its source's `grantKind` and `grantedAt` and carries
335
+ * `renewedAt: now`; the source record stays as stored. On `outbox`, every
336
+ * zcap sharing a renewed zcap's scope is removed from the envelopes already
337
+ * pending, an envelope left with none is dropped, and `message` is appended
338
+ * with `createdAt: now`.
339
+ *
340
+ * A renewed zcap must copy its source's `invocationTarget` as stored, since
341
+ * the scope compares it verbatim (a trailing `*` marker included).
342
+ *
343
+ * Refuses with an `Error`, writing nothing: a retired entry (whose `retired`
344
+ * stays), an entry with no live inbox channel (`receivedGrants`, then
345
+ * `liveInboxChannel`), a renewal whose source record is gone, a renewal
346
+ * whose source is no longer the latest record of its scope (a concurrent
347
+ * renewal ran), and a renewal whose `expires` is not strictly later than its
348
+ * source's. The last is what keeps a renewal minted under a short-lived parent from
349
+ * being appended at every login. A renewed zcap not delegated to the party,
350
+ * not targeting this Space, or of another scope than its source, and a
351
+ * `message` whose zcap ids are not exactly the renewed zcap ids, are refused
352
+ * with a `TypeError`. An absent entry writes nothing.
353
+ *
354
+ * @param options {object}
355
+ * @param options.store {ConnectionsStore}
356
+ * @param options.hmacKey {ConnectionIdKey}
357
+ * @param options.did {string} the party's DID, every renewed grant's
358
+ * controller
359
+ * @param options.pairwiseDid {string} the wallet's pairwise did:key toward
360
+ * the party, the inbox channel's controller
361
+ * @param options.spaceUrl {string} this Space's container URL
362
+ * @param options.renewals {Array<object>} `{ zcap, sourceZcapId }` per
363
+ * renewed grant: the new capability and the id of the record it renews
364
+ * @param options.message {object} the envelope to queue, verbatim
365
+ * @param options.channelMaxLifetimeMs {number} how long after `receivedAt`
366
+ * an inbox record lapses at the latest
367
+ * @param [options.now] {Date}
368
+ * @returns {Promise<ConnectionWriteResult>}
369
+ */
370
+ export declare function recordRenewedGrants({ store, hmacKey, did, pairwiseDid, spaceUrl, renewals, message, channelMaxLifetimeMs, now }: {
371
+ store: ConnectionsStore;
372
+ hmacKey: ConnectionIdKey;
373
+ did: string;
374
+ pairwiseDid: string;
375
+ spaceUrl: string;
376
+ renewals: Array<{
377
+ zcap: object;
378
+ sourceZcapId: string;
379
+ }>;
380
+ message: Record<string, unknown>;
381
+ channelMaxLifetimeMs: number;
382
+ now?: Date;
383
+ }): Promise<ConnectionWriteResult>;
384
+ /**
385
+ * Removes the outbox item(s) queued at `createdAt`, once a push delivered
386
+ * them. None queued then writes nothing, and an absent entry writes nothing.
387
+ *
388
+ * @param options {object}
389
+ * @param options.store {ConnectionsStore}
390
+ * @param options.hmacKey {ConnectionIdKey}
391
+ * @param options.did {string} the party's DID
392
+ * @param options.createdAt {string} the delivered item's `createdAt`
393
+ * @returns {Promise<ConnectionWriteResult>}
394
+ */
395
+ export declare function settleOutboxItem({ store, hmacKey, did, createdAt }: {
396
+ store: ConnectionsStore;
397
+ hmacKey: ConnectionIdKey;
398
+ did: string;
399
+ createdAt: string;
400
+ }): Promise<ConnectionWriteResult>;
401
+ /**
402
+ * Drops the grant records renewal superseded, and the outbox items no push
403
+ * can still deliver. In each scope holding more than one record, every
404
+ * record but the latest is dropped when its `expires` is past by more than
405
+ * the revocation clock skew, or when its capability id is among
406
+ * `deadChainZcapIds`. The latest record of a scope always stays. An outbox
407
+ * item is discarded when every zcap its envelope carries is past `expires` by
408
+ * more than the skew; an item carrying a zcap this build cannot read stays.
409
+ * Nothing to drop writes nothing, and an absent
410
+ * entry writes nothing.
411
+ *
412
+ * @param options {object}
413
+ * @param options.store {ConnectionsStore}
414
+ * @param options.hmacKey {ConnectionIdKey}
415
+ * @param options.did {string} the party's DID
416
+ * @param [options.deadChainZcapIds] {Iterable<string>} ids of superseded
417
+ * records whose chain revocation reads as dead (the signer gone from the
418
+ * account document, or the parent naming another annex generation) and
419
+ * whose successor's outbox item was settled. A grant `agentGrantDue` reads
420
+ * as due by replacement does not qualify on that alone: a grant under an
421
+ * in-place-renewed delegation stays live until that delegation expires.
422
+ * @param [options.now] {Date}
423
+ * @returns {Promise<ConnectionWriteResult>}
424
+ */
425
+ export declare function pruneSupersededGrants({ store, hmacKey, did, deadChainZcapIds, now }: {
426
+ store: ConnectionsStore;
427
+ hmacKey: ConnectionIdKey;
428
+ did: string;
429
+ deadChainZcapIds?: Iterable<string>;
430
+ now?: Date;
431
+ }): Promise<ConnectionWriteResult>;
432
+ /**
433
+ * Empties the party's `grantsReceived` and `outbox`: the agent revoke's
434
+ * first write, so no client pushes to the party once it starts. Both already
435
+ * empty writes nothing, and an absent entry writes nothing.
436
+ *
437
+ * @param options {object}
438
+ * @param options.store {ConnectionsStore}
439
+ * @param options.hmacKey {ConnectionIdKey}
440
+ * @param options.did {string} the party's DID
441
+ * @returns {Promise<ConnectionWriteResult>}
442
+ */
443
+ export declare function clearReceivedGrants({ store, hmacKey, did }: {
444
+ store: ConnectionsStore;
445
+ hmacKey: ConnectionIdKey;
446
+ did: string;
447
+ }): Promise<ConnectionWriteResult>;
448
+ /**
449
+ * Drops one record from the party's `grantsReceived` by its capability id,
450
+ * and leaves `outbox` as it is: what a push refused by the party's server
451
+ * (a 401, a 403, or a WAS host's masked 404) does with the channel it went
452
+ * through, since the refusal says the capability is expired or revoked. The
453
+ * queued envelopes stay for the party's next invitation, and a replacement
454
+ * channel the party then hands over is stored by `recordReceivedGrants`
455
+ * whatever its `expires`, since the dropped record is gone. A record not
456
+ * held writes nothing, and an absent entry writes nothing.
457
+ *
458
+ * @param options {object}
459
+ * @param options.store {ConnectionsStore}
460
+ * @param options.hmacKey {ConnectionIdKey}
461
+ * @param options.did {string} the party's DID
462
+ * @param options.zcapId {string} the `id` of the received capability
463
+ * @returns {Promise<ConnectionWriteResult>}
464
+ */
465
+ export declare function dropReceivedGrant({ store, hmacKey, did, zcapId }: {
466
+ store: ConnectionsStore;
467
+ hmacKey: ConnectionIdKey;
468
+ did: string;
469
+ zcapId: string;
470
+ }): Promise<ConnectionWriteResult>;
471
+ /**
472
+ * Records the owner's decline of the party's offer: sets `declined` to
473
+ * `now`. An entry already declined keeps its time and writes nothing, and an
474
+ * absent entry writes nothing. A later consent (`recordGrants`) clears it.
475
+ *
476
+ * @param options {object}
477
+ * @param options.store {ConnectionsStore}
478
+ * @param options.hmacKey {ConnectionIdKey}
479
+ * @param options.did {string} the party's DID
480
+ * @param [options.now] {Date}
481
+ * @returns {Promise<ConnectionWriteResult>}
482
+ */
483
+ export declare function markDeclined({ store, hmacKey, did, now }: {
484
+ store: ConnectionsStore;
485
+ hmacKey: ConnectionIdKey;
486
+ did: string;
487
+ now?: Date;
488
+ }): Promise<ConnectionWriteResult>;
244
489
  //# sourceMappingURL=upsert.d.ts.map