@serfab/cadre-core 1.16.0 → 1.17.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.
- package/README.md +1 -1
- package/dist/bootstrap-peer-store-file.js +1 -1
- package/dist/bootstrap-peer-store.d.ts +1 -1
- package/dist/bootstrap-peer-store.js +4 -4
- package/dist/cadre-invite-protocol.d.ts +55 -138
- package/dist/cadre-invite-protocol.js +94 -449
- package/dist/cadre-invite-protocol.js.map +1 -1
- package/dist/cadre-join-request.d.ts +15 -2
- package/dist/cadre-join-request.js +22 -3
- package/dist/cadre-join-request.js.map +1 -1
- package/dist/cadre-node.d.ts +530 -247
- package/dist/cadre-node.js +1046 -525
- package/dist/cadre-node.js.map +1 -1
- package/dist/control-authorization.d.ts +36 -14
- package/dist/control-authorization.js +20 -3
- package/dist/control-authorization.js.map +1 -1
- package/dist/control-cohort.d.ts +22 -23
- package/dist/control-cohort.js +24 -24
- package/dist/control-cohort.js.map +1 -1
- package/dist/control-database.d.ts +416 -136
- package/dist/control-database.js +757 -378
- package/dist/control-database.js.map +1 -1
- package/dist/control-protocol-guard.d.ts +5 -4
- package/dist/control-protocol-guard.js +6 -3
- package/dist/control-protocol-guard.js.map +1 -1
- package/dist/control-schema-version.d.ts +80 -0
- package/dist/control-schema-version.js +203 -0
- package/dist/control-schema-version.js.map +1 -0
- package/dist/control-schema.d.ts +45 -5
- package/dist/control-schema.js +254 -70
- package/dist/control-schema.js.map +1 -1
- package/dist/control-write-retry.d.ts +5 -5
- package/dist/control-write-retry.js +10 -8
- package/dist/control-write-retry.js.map +1 -1
- package/dist/delegate-admission.d.ts +13 -0
- package/dist/delegate-admission.js +27 -0
- package/dist/delegate-admission.js.map +1 -1
- package/dist/ed25519-key.d.ts +10 -7
- package/dist/ed25519-key.js +23 -20
- package/dist/ed25519-key.js.map +1 -1
- package/dist/edge-node/config.d.ts +122 -0
- package/dist/edge-node/config.js +199 -0
- package/dist/edge-node/config.js.map +1 -0
- package/dist/edge-node/dissolve.d.ts +95 -0
- package/dist/edge-node/dissolve.js +184 -0
- package/dist/edge-node/dissolve.js.map +1 -0
- package/dist/edge-node/edge-join.d.ts +44 -0
- package/dist/edge-node/edge-join.js +227 -0
- package/dist/edge-node/edge-join.js.map +1 -0
- package/dist/edge-node/edge-node.d.ts +295 -0
- package/dist/edge-node/edge-node.js +704 -0
- package/dist/edge-node/edge-node.js.map +1 -0
- package/dist/edge-node/index.d.ts +18 -0
- package/dist/edge-node/index.js +18 -0
- package/dist/edge-node/index.js.map +1 -0
- package/dist/edge-node/join-credential.d.ts +11 -0
- package/dist/edge-node/join-credential.js +11 -0
- package/dist/edge-node/join-credential.js.map +1 -0
- package/dist/edge-node/lazy-raw-storage.d.ts +40 -0
- package/dist/edge-node/lazy-raw-storage.js +134 -0
- package/dist/edge-node/lazy-raw-storage.js.map +1 -0
- package/dist/edge-node/node-local.d.ts +60 -0
- package/dist/edge-node/node-local.js +58 -0
- package/dist/edge-node/node-local.js.map +1 -0
- package/dist/edge-node/options.d.ts +83 -0
- package/dist/edge-node/options.js +110 -0
- package/dist/edge-node/options.js.map +1 -0
- package/dist/edge-node/owner-grant.d.ts +41 -0
- package/dist/edge-node/owner-grant.js +38 -0
- package/dist/edge-node/owner-grant.js.map +1 -0
- package/dist/edge-node/platform.d.ts +140 -0
- package/dist/edge-node/platform.js +12 -0
- package/dist/edge-node/platform.js.map +1 -0
- package/dist/edge-node/strand-move.d.ts +115 -0
- package/dist/edge-node/strand-move.js +223 -0
- package/dist/edge-node/strand-move.js.map +1 -0
- package/dist/edge-node/strands.d.ts +28 -0
- package/dist/edge-node/strands.js +60 -0
- package/dist/edge-node/strands.js.map +1 -0
- package/dist/index.d.ts +16 -7
- package/dist/index.js +26 -7
- package/dist/index.js.map +1 -1
- package/dist/joined-strand-store.d.ts +3 -3
- package/dist/joined-strand-store.js +3 -3
- package/dist/joined-strand-store.js.map +1 -1
- package/dist/key-store.d.ts +9 -4
- package/dist/key-store.js +9 -4
- package/dist/key-store.js.map +1 -1
- package/dist/machine-removal.d.ts +19 -39
- package/dist/machine-removal.js +24 -98
- package/dist/machine-removal.js.map +1 -1
- package/dist/member-redemption.d.ts +250 -0
- package/dist/member-redemption.js +485 -0
- package/dist/member-redemption.js.map +1 -0
- package/dist/owner-anchor-sync.d.ts +4 -4
- package/dist/owner-anchor-sync.js +16 -15
- package/dist/owner-anchor-sync.js.map +1 -1
- package/dist/owner-grant-protocol.d.ts +247 -0
- package/dist/owner-grant-protocol.js +330 -0
- package/dist/owner-grant-protocol.js.map +1 -0
- package/dist/owner-key-export.d.ts +70 -0
- package/dist/owner-key-export.js +279 -0
- package/dist/owner-key-export.js.map +1 -0
- package/dist/owner-key-flows.d.ts +55 -0
- package/dist/owner-key-flows.js +60 -0
- package/dist/owner-key-flows.js.map +1 -0
- package/dist/owner-key-store.d.ts +31 -0
- package/dist/owner-key-store.js +81 -0
- package/dist/owner-key-store.js.map +1 -0
- package/dist/owner-keys.d.ts +78 -0
- package/dist/owner-keys.js +133 -0
- package/dist/owner-keys.js.map +1 -0
- package/dist/owner-signer.d.ts +54 -0
- package/dist/owner-signer.js +51 -0
- package/dist/owner-signer.js.map +1 -0
- package/dist/peer-authorization.d.ts +83 -18
- package/dist/peer-authorization.js +123 -53
- package/dist/peer-authorization.js.map +1 -1
- package/dist/provider/rent-node.js +1 -1
- package/dist/provider/rent-node.js.map +1 -1
- package/dist/seed-bootstrap.d.ts +131 -109
- package/dist/seed-bootstrap.js +260 -248
- package/dist/seed-bootstrap.js.map +1 -1
- package/dist/seed-trust-policy.js +4 -4
- package/dist/strand-addr-protocol.d.ts +4 -1
- package/dist/strand-addr-protocol.js +8 -2
- package/dist/strand-addr-protocol.js.map +1 -1
- package/dist/strand-cohort.d.ts +3 -0
- package/dist/strand-cohort.js.map +1 -1
- package/dist/strand-database.d.ts +1 -0
- package/dist/strand-database.js +3 -0
- package/dist/strand-database.js.map +1 -1
- package/dist/strand-first-sync-gate.d.ts +4 -3
- package/dist/strand-first-sync-gate.js +4 -3
- package/dist/strand-first-sync-gate.js.map +1 -1
- package/dist/strand-instance-manager.d.ts +1 -1
- package/dist/strand-membership-writer.d.ts +13 -2
- package/dist/strand-membership-writer.js +52 -16
- package/dist/strand-membership-writer.js.map +1 -1
- package/dist/strand-move.d.ts +6 -5
- package/dist/strand-move.js +31 -30
- package/dist/strand-move.js.map +1 -1
- package/dist/strand-peer-redial.js +2 -3
- package/dist/strand-peer-redial.js.map +1 -1
- package/dist/types.d.ts +286 -103
- package/dist/types.js.map +1 -1
- package/package.json +11 -2
- package/src/bootstrap-peer-store-file.ts +44 -44
- package/src/bootstrap-peer-store.ts +214 -214
- package/src/cadre-invite-protocol.ts +652 -1052
- package/src/cadre-join-request.ts +24 -3
- package/src/cadre-node.ts +1166 -541
- package/src/control-authorization.ts +47 -14
- package/src/control-cohort.ts +127 -128
- package/src/control-database.ts +940 -456
- package/src/control-protocol-guard.ts +7 -4
- package/src/control-schema-version.ts +251 -0
- package/src/control-schema.ts +265 -70
- package/src/control-write-retry.ts +569 -567
- package/src/delegate-admission.ts +37 -0
- package/src/ed25519-key.ts +174 -171
- package/src/edge-node/config.ts +277 -0
- package/src/edge-node/dissolve.ts +251 -0
- package/src/edge-node/edge-join.ts +319 -0
- package/src/edge-node/edge-node.ts +1045 -0
- package/src/edge-node/index.ts +59 -0
- package/src/edge-node/join-credential.ts +16 -0
- package/src/edge-node/lazy-raw-storage.ts +178 -0
- package/src/edge-node/node-local.ts +84 -0
- package/src/edge-node/options.ts +179 -0
- package/src/edge-node/owner-grant.ts +63 -0
- package/src/edge-node/platform.ts +151 -0
- package/src/edge-node/strand-move.ts +270 -0
- package/src/edge-node/strands.ts +72 -0
- package/src/index.ts +886 -789
- package/src/joined-strand-store.ts +4 -4
- package/src/key-store.ts +10 -4
- package/src/machine-removal.ts +26 -111
- package/src/member-redemption.ts +642 -0
- package/src/owner-anchor-sync.ts +19 -18
- package/src/owner-grant-protocol.ts +532 -0
- package/src/owner-key-export.ts +348 -0
- package/src/owner-key-flows.ts +109 -0
- package/src/owner-key-store.ts +85 -0
- package/src/owner-keys.ts +178 -0
- package/src/owner-signer.ts +94 -0
- package/src/peer-authorization.ts +558 -488
- package/src/provider/rent-node.ts +1 -1
- package/src/seed-bootstrap.ts +301 -312
- package/src/seed-trust-policy.ts +4 -4
- package/src/strand-addr-protocol.ts +547 -538
- package/src/strand-cohort.ts +4 -0
- package/src/strand-database.ts +3 -0
- package/src/strand-first-sync-gate.ts +4 -3
- package/src/strand-instance-manager.ts +1 -1
- package/src/strand-membership-writer.ts +61 -16
- package/src/strand-move.ts +45 -36
- package/src/strand-peer-redial.ts +2 -3
- package/src/types.ts +304 -103
package/dist/types.d.ts
CHANGED
|
@@ -17,8 +17,10 @@ import type { StrandNetworkStateStore } from './strand-network-state.js';
|
|
|
17
17
|
import type { EnrolledMachineStore } from './enrolled-machine-store.js';
|
|
18
18
|
import type { JoinedStrandStore } from './joined-strand-store.js';
|
|
19
19
|
import type { PushNotifier } from './push-notifier.js';
|
|
20
|
-
import type { CadreInviteSignedFields, RevocableTable } from './control-authorization.js';
|
|
21
|
-
import type { CadreInvitation
|
|
20
|
+
import type { CadreInviteSignedFields, OwnerGrantSignedFields, RevocableTable } from './control-authorization.js';
|
|
21
|
+
import type { CadreInvitation } from './cadre-invite-protocol.js';
|
|
22
|
+
import type { OwnerGrantBundle } from './owner-grant-protocol.js';
|
|
23
|
+
import type { RedemptionAddressOutcome } from './member-redemption.js';
|
|
22
24
|
import type { ControlRetryAbandonment } from './control-retry.js';
|
|
23
25
|
import type { FormationRejectionCode } from './strand-formation-rejection.js';
|
|
24
26
|
import type { ListenTransportOptions } from './relay-addrs.js';
|
|
@@ -723,11 +725,10 @@ export interface CadreNodeConfig {
|
|
|
723
725
|
* form). Mutually exclusive with {@link privateKey}. Absent ⇒ use `privateKey`
|
|
724
726
|
* when set, else libp2p generates an ephemeral key.
|
|
725
727
|
*
|
|
726
|
-
*
|
|
727
|
-
*
|
|
728
|
-
*
|
|
729
|
-
*
|
|
730
|
-
* built here.
|
|
728
|
+
* The node signs owner writes through whatever owner signer the embedder wires
|
|
729
|
+
* (`CadreNode.useOwnerSigner`). An owner key has its own slot
|
|
730
|
+
* (`owner-key-store.ts`), which may be in this same store; this identity is never
|
|
731
|
+
* an owner key.
|
|
731
732
|
*/
|
|
732
733
|
keyStore?: KeyStore;
|
|
733
734
|
/** Slot id for the node identity in {@link keyStore}. Default: `'cadre/identity'`. */
|
|
@@ -900,7 +901,7 @@ export interface CadreNodeConfig {
|
|
|
900
901
|
*
|
|
901
902
|
* A node has exactly one cold-start trust source, so `claim` beside a non-empty
|
|
902
903
|
* `trustedOwners.pinnedKeys` or a `seedTrustPolicy` fails `start()` closed, and
|
|
903
|
-
* `
|
|
904
|
+
* `useOwnerSigner` (an owner key) refuses on such a node: a hosted node never
|
|
904
905
|
* holds an owner key. A claimed node restarted with this still set ignores it (its
|
|
905
906
|
* anchor is non-empty), so the operator need not remove it.
|
|
906
907
|
*
|
|
@@ -952,7 +953,7 @@ export interface CadreNodeConfig {
|
|
|
952
953
|
/**
|
|
953
954
|
* Provenance recorded for {@link pinnedKeys}. Default: 'operator'.
|
|
954
955
|
* ('genesis' is reserved for the node's own founding key, seeded
|
|
955
|
-
* internally by `
|
|
956
|
+
* internally by `useOwnerSigner`; 'chain' is written only by the
|
|
956
957
|
* anchor sync, `CadreNode.syncOwnerAnchor`.)
|
|
957
958
|
*/
|
|
958
959
|
pinnedSource?: Exclude<TrustSource, 'genesis' | 'chain'>;
|
|
@@ -1175,16 +1176,21 @@ export interface StrandRow {
|
|
|
1175
1176
|
MemberPrivateKey: string | null;
|
|
1176
1177
|
Type: 'o' | 'c';
|
|
1177
1178
|
/**
|
|
1178
|
-
* ed25519 (base64url) owner key
|
|
1179
|
-
*
|
|
1180
|
-
* the
|
|
1181
|
-
*
|
|
1182
|
-
*
|
|
1183
|
-
* `null` on a consent-seated strand (the unsigned `FormationUsage` branch
|
|
1184
|
-
* records no trustworthy signer). Provenance, not content —
|
|
1185
|
-
* `strandRowMismatches` excludes it from the identical-content comparison.
|
|
1179
|
+
* ed25519 (base64url) owner key that signed the owner-signed `Strand` insert
|
|
1180
|
+
* (`== context.OwnerKey`, pinned by the schema's `AuthorizedInsert`). `null` on a
|
|
1181
|
+
* consent-seated strand (the unsigned `FormationUsage` branch records no
|
|
1182
|
+
* signer). Provenance, not content — `strandRowMismatches` excludes it from the
|
|
1183
|
+
* identical-content comparison.
|
|
1186
1184
|
*/
|
|
1187
1185
|
FounderOwnerKey: string | null;
|
|
1186
|
+
/**
|
|
1187
|
+
* Peer id of the machine that runs the founder bootstrap, named by the owner
|
|
1188
|
+
* signature on the insert (`CadreNode.publishStrand` writes its own). A launch
|
|
1189
|
+
* with no explicit `founder` flag founds iff this is its own peer id (see
|
|
1190
|
+
* `CadreNode.launchStrand`), so two machines holding one owner key never both
|
|
1191
|
+
* found. `null` on a consent-seated strand. Provenance, as {@link FounderOwnerKey}.
|
|
1192
|
+
*/
|
|
1193
|
+
FounderPeerId: string | null;
|
|
1188
1194
|
}
|
|
1189
1195
|
/**
|
|
1190
1196
|
* A `CadreControl.JoinRequest` row: a join this party asked for through another party's
|
|
@@ -1305,7 +1311,7 @@ export interface StrandConfig {
|
|
|
1305
1311
|
* unset and writes nothing — it receives those rows via Optimystic sync.
|
|
1306
1312
|
*
|
|
1307
1313
|
* When unset, founder-ness is DERIVED from the row: this node founds iff
|
|
1308
|
-
* {@link StrandRow.
|
|
1314
|
+
* {@link StrandRow.FounderPeerId} is its own peer id. An explicit
|
|
1309
1315
|
* `true`/`false` wins over the derivation — the formation/responder flows pass
|
|
1310
1316
|
* it deliberately, since a consent-seated row carries a null column.
|
|
1311
1317
|
*/
|
|
@@ -1390,6 +1396,35 @@ export interface FoundStrandResult {
|
|
|
1390
1396
|
*/
|
|
1391
1397
|
founded: boolean;
|
|
1392
1398
|
}
|
|
1399
|
+
/**
|
|
1400
|
+
* Options for {@link CadreNode.foundStrand}. Passing them selects the form that returns once
|
|
1401
|
+
* the row is published ({@link FoundStrandBackgroundResult}), for a caller that needs only the
|
|
1402
|
+
* row: minting an invitation reads just its id and membership key.
|
|
1403
|
+
*
|
|
1404
|
+
* An invitation redeemed before the start finishes is refused, retryably: a closed host
|
|
1405
|
+
* strand answers `host-strand-unavailable` and leaves the token unspent. For an open host
|
|
1406
|
+
* strand the approval is sent, but carries no strand addresses, because the strand node does
|
|
1407
|
+
* not exist yet.
|
|
1408
|
+
*/
|
|
1409
|
+
export interface FoundStrandOptions {
|
|
1410
|
+
/** Return once the row is published; the start continues in {@link FoundStrandBackgroundResult.ready}. */
|
|
1411
|
+
background: true;
|
|
1412
|
+
}
|
|
1413
|
+
/** What {@link CadreNode.foundStrand} returns with `{ background: true }`: the row is published; the local start continues. */
|
|
1414
|
+
export interface FoundStrandBackgroundResult {
|
|
1415
|
+
/** The live control-plane row: freshly published, or the one already there. Same as {@link FoundStrandResult.strandRow}. */
|
|
1416
|
+
strandRow: StrandRow;
|
|
1417
|
+
/** Same as {@link FoundStrandResult.founded}. */
|
|
1418
|
+
founded: boolean;
|
|
1419
|
+
/**
|
|
1420
|
+
* Settles when the local start does. Resolves with the instance `addStrand` returns.
|
|
1421
|
+
* Rejects with the start's own error. After a launch failure the strand stays published
|
|
1422
|
+
* and the strand watcher keeps retrying it. After a first-sync timeout (only an adopted,
|
|
1423
|
+
* not-founded row waits for one) the instance stays up and still syncing, so wait with
|
|
1424
|
+
* {@link CadreNode.whenStrandWritable}.
|
|
1425
|
+
*/
|
|
1426
|
+
ready: Promise<StrandInstance>;
|
|
1427
|
+
}
|
|
1393
1428
|
/**
|
|
1394
1429
|
* Result of creating a new cadre peer
|
|
1395
1430
|
*/
|
|
@@ -1643,7 +1678,7 @@ export interface CadreNodeEvents {
|
|
|
1643
1678
|
* Also emitted for a strand this node joined from ANOTHER party, which no control
|
|
1644
1679
|
* row names: the node remembers every such join (see
|
|
1645
1680
|
* {@link CadreNodeConfig.joinedStrands}) and offers it here on each start, as a row
|
|
1646
|
-
* with
|
|
1681
|
+
* with null founder columns carrying the closed strand's `MemberPrivateKey`. That
|
|
1647
1682
|
* row is the product of the formation's consent, so claiming it needs no second one.
|
|
1648
1683
|
*
|
|
1649
1684
|
* **Fired once per strand per session, and it can fire before your listener is
|
|
@@ -1820,25 +1855,27 @@ export interface CadrePeerRow {
|
|
|
1820
1855
|
export type CadrePeerVoucherFields = Pick<CadrePeerRow, 'peerId' | 'stampId' | 'vouchOwner' | 'vouchSig' | 'vouchUsage'>;
|
|
1821
1856
|
/**
|
|
1822
1857
|
* One live `CadreControl.OwnerKey` row as `ControlDatabase.queryOwnerKeyRows` reads it: the
|
|
1823
|
-
* key and the persisted proof of how it was seated. The three proof shapes are the
|
|
1824
|
-
* (`OwnerKey.Authorized`): the founding row (all three null), an owner-signed add
|
|
1825
|
-
* and `vouchSig`, the signer's signature over `ownerKeyAddDigest(key, stampId)`), or an
|
|
1826
|
-
* owner
|
|
1827
|
-
* `
|
|
1828
|
-
* the stampless row the schema permits but no writer produces,
|
|
1829
|
-
* `stampId` is non-null here. The anchor sync (`deriveOwnerAnchor`)
|
|
1830
|
-
* the proof against the keys it already trusts, never against the table itself.
|
|
1858
|
+
* key, its label and the persisted proof of how it was seated. The three proof shapes are the
|
|
1859
|
+
* schema's (`OwnerKey.Authorized`): the founding row (all three null), an owner-signed add
|
|
1860
|
+
* (`vouchOwner` and `vouchSig`, the signer's signature over `ownerKeyAddDigest(key, label, stampId)`), or an
|
|
1861
|
+
* owner grant redeemed by consent (`vouchOwner` the issuer, `vouchSig` null, `vouchUsage` the
|
|
1862
|
+
* `OwnerGrantUsage` row). Rows whose stamp is
|
|
1863
|
+
* retired in `Revocation`, and the stampless row the schema permits but no writer produces,
|
|
1864
|
+
* never reach a reader, so `stampId` is non-null here. The anchor sync (`deriveOwnerAnchor`)
|
|
1865
|
+
* judges the proof against the keys it already trusts, never against the table itself.
|
|
1831
1866
|
*/
|
|
1832
1867
|
export interface OwnerKeyRow {
|
|
1833
1868
|
/** ed25519 public key (base64url) — the row key. */
|
|
1834
1869
|
key: string;
|
|
1870
|
+
/** The user's name for the key, bound into an owner-signed add or into the grant that seated it; null when none was given. */
|
|
1871
|
+
label: string | null;
|
|
1835
1872
|
/** Single-use anti-replay nonce the voucher signature, or the usage row, is bound to. */
|
|
1836
1873
|
stampId: string;
|
|
1837
|
-
/** The owner that signed the add, or that issued the
|
|
1874
|
+
/** The owner that signed the add, or that issued the grant that seated it; null on the founding row. */
|
|
1838
1875
|
vouchOwner: string | null;
|
|
1839
|
-
/** That owner's signature over the row's `'add'` digest, base64url; null on the founding row and on
|
|
1876
|
+
/** That owner's signature over the row's `'add'` digest, base64url; null on the founding row and on a consent-seated row. */
|
|
1840
1877
|
vouchSig: string | null;
|
|
1841
|
-
/** The `
|
|
1878
|
+
/** The `OwnerGrantUsage.UsageStampId` that seated this row; null otherwise. */
|
|
1842
1879
|
vouchUsage: string | null;
|
|
1843
1880
|
}
|
|
1844
1881
|
/**
|
|
@@ -1870,30 +1907,70 @@ export interface CadreInviteUsageRow {
|
|
|
1870
1907
|
peerId: string;
|
|
1871
1908
|
/** The admitted device's ed25519 public key (base64url). */
|
|
1872
1909
|
peerKey: string;
|
|
1873
|
-
/** The `CadrePeer.StampId` this redemption seated
|
|
1910
|
+
/** The `CadrePeer.StampId` this redemption seated. */
|
|
1874
1911
|
peerStampId: string;
|
|
1875
|
-
/** The `OwnerKey.StampId` this redemption seated, when the invitation grants ownership; else null. */
|
|
1876
|
-
ownerStampId: string | null;
|
|
1877
1912
|
/** The invitation private key's signature over the `'redeem'` digest, base64url. */
|
|
1878
1913
|
inviteSig: string;
|
|
1879
1914
|
/** The device's signature over the `'consent'` digest, base64url. */
|
|
1880
1915
|
peerSig: string;
|
|
1881
1916
|
}
|
|
1882
1917
|
/**
|
|
1883
|
-
* The usage and invitation rows an invitation-admitted row is verified through
|
|
1884
|
-
* `
|
|
1885
|
-
*
|
|
1886
|
-
* `verifyInvitationOwnerAdmission` (`deriveOwnerAnchor`). Loaded once per membership refresh
|
|
1887
|
-
* (`CadreNode.loadInvitationChain`) and shared by both readers.
|
|
1918
|
+
* The usage and invitation rows an invitation-admitted `CadrePeer` row is verified through
|
|
1919
|
+
* (`verifyInvitationAdmission`, `CadreNode.listAuthorizedMembers`), keyed by `UsageStampId`
|
|
1920
|
+
* and `CadreInvite.Key`. Loaded once per membership refresh (`CadreNode.loadInvitationChain`).
|
|
1888
1921
|
*/
|
|
1889
1922
|
export interface InvitationChain {
|
|
1890
1923
|
usages: Map<string, CadreInviteUsageRow>;
|
|
1891
1924
|
invites: Map<string, CadreInviteRow>;
|
|
1892
1925
|
}
|
|
1893
1926
|
/**
|
|
1894
|
-
* One
|
|
1895
|
-
*
|
|
1896
|
-
*
|
|
1927
|
+
* One `CadreControl.OwnerGrant` row: an owner-signed grant of ownership to whoever holds its
|
|
1928
|
+
* private half, as `ControlDatabase.insertOwnerGrant` returns it and `queryOwnerGrant` reads
|
|
1929
|
+
* it. Every column is here because the row travels, as a {@link CadreInviteRow} does: the
|
|
1930
|
+
* holder carries it inside the grant bundle and a member re-seats it verbatim
|
|
1931
|
+
* (`seatOwnerGrant`), so `expiresAt` is the engine-canonical `datetime` string the row
|
|
1932
|
+
* stores. The signed subset is `OwnerGrantSignedFields` (`control-authorization.ts`); the
|
|
1933
|
+
* grant names no machine and no peer id.
|
|
1934
|
+
*/
|
|
1935
|
+
export interface OwnerGrantRow extends OwnerGrantSignedFields {
|
|
1936
|
+
/** The owner that signed the row (`IssuerKey`, base64url ed25519); a reader checks it against its anchor. */
|
|
1937
|
+
issuerKey: string;
|
|
1938
|
+
/** That owner's `'add'` signature over the row (`IssuerSig`, base64url). */
|
|
1939
|
+
issuerSig: string;
|
|
1940
|
+
}
|
|
1941
|
+
/**
|
|
1942
|
+
* One `CadreControl.OwnerGrantUsage` row: a redemption of an {@link OwnerGrantRow}, as
|
|
1943
|
+
* `ControlDatabase.queryOwnerGrantUsages` reads it. Both signatures are stored so any reader
|
|
1944
|
+
* can re-verify the chain grant → usage → `OwnerKey` row (`verifyOwnerGrantAdmission`).
|
|
1945
|
+
*/
|
|
1946
|
+
export interface OwnerGrantUsageRow {
|
|
1947
|
+
/** The redemption's single-use nonce (the row key), signed into both signatures. */
|
|
1948
|
+
usageStampId: string;
|
|
1949
|
+
/** The `OwnerGrant.Key` redeemed. */
|
|
1950
|
+
grantKey: string;
|
|
1951
|
+
/** The owner key seated (base64url ed25519): the holder's, fresh or already held. */
|
|
1952
|
+
seatedKey: string;
|
|
1953
|
+
/** The `OwnerKey.StampId` this redemption seated. */
|
|
1954
|
+
seatedStampId: string;
|
|
1955
|
+
/** The grant private key's signature over the `'redeem'` digest, base64url. */
|
|
1956
|
+
grantSig: string;
|
|
1957
|
+
/** The seated key's signature over the `'consent'` digest, base64url. */
|
|
1958
|
+
ownerSig: string;
|
|
1959
|
+
}
|
|
1960
|
+
/**
|
|
1961
|
+
* The usage and grant rows a grant-seated `OwnerKey` row is verified through, keyed by
|
|
1962
|
+
* `UsageStampId` and `OwnerGrant.Key` (`verifyOwnerGrantAdmission`, from `deriveOwnerAnchor`).
|
|
1963
|
+
* The grant twin of {@link InvitationChain}, loaded beside it by `CadreNode.syncOwnerAnchor`
|
|
1964
|
+
* when some owner row is consent-seated; a row's `vouchUsage` is looked up in this chain
|
|
1965
|
+
* first and in the invitation chain otherwise.
|
|
1966
|
+
*/
|
|
1967
|
+
export interface OwnerGrantChain {
|
|
1968
|
+
usages: Map<string, OwnerGrantUsageRow>;
|
|
1969
|
+
grants: Map<string, OwnerGrantRow>;
|
|
1970
|
+
}
|
|
1971
|
+
/**
|
|
1972
|
+
* One machine of the cadre as `CadreNode.listMachines` reports it: a live `CadrePeer` row. An
|
|
1973
|
+
* owner key is not a machine; `CadreNode.listOwnerKeys` lists those.
|
|
1897
1974
|
*
|
|
1898
1975
|
* `profile` and `lastPublishedAt` are the machine's own claim only when the row's
|
|
1899
1976
|
* self-signature verifies; both are null otherwise, so an owner re-vouch that bumped
|
|
@@ -1902,74 +1979,112 @@ export interface InvitationChain {
|
|
|
1902
1979
|
*/
|
|
1903
1980
|
export interface CadreMachine {
|
|
1904
1981
|
peerId: string;
|
|
1905
|
-
/** ed25519
|
|
1982
|
+
/** The machine's ed25519 identity key (base64url) behind `peerId`; null when the id is not ed25519. Never an owner key (`listOwnerKeys` lists those). */
|
|
1906
1983
|
publicKey: string | null;
|
|
1907
1984
|
/** This node itself. */
|
|
1908
1985
|
isSelf: boolean;
|
|
1909
|
-
/** `publicKey` is a live `OwnerKey` here. */
|
|
1910
|
-
isOwner: boolean;
|
|
1911
|
-
/** Has a live `CadrePeer` row; false for an owner key with no machine row. */
|
|
1912
|
-
isMember: boolean;
|
|
1913
1986
|
/** Passes this node's authorized-membership predicate now (`CadreNode.listAuthorizedMembers`; always false for self, which that set excludes). */
|
|
1914
1987
|
trusted: boolean;
|
|
1915
1988
|
/** The machine's self-published node profile; null until it publishes, or when its signature does not verify. */
|
|
1916
1989
|
profile: NodeProfile | null;
|
|
1917
1990
|
/** `UpdatedAt` of its self-signed record, re-stamped while it runs; null on the same terms as `profile`. */
|
|
1918
1991
|
lastPublishedAt: number | null;
|
|
1919
|
-
/** `CadrePeer.VouchOwner
|
|
1992
|
+
/** `CadrePeer.VouchOwner`: the owner key that vouched it, or the issuer of the invitation that admitted it. */
|
|
1920
1993
|
vouchedBy: string | null;
|
|
1921
1994
|
}
|
|
1995
|
+
/** One live owner key as `CadreNode.listOwnerKeys` lists it, for an app's owner-key screen. */
|
|
1996
|
+
export interface CadreOwnerKey {
|
|
1997
|
+
/** ed25519 public key (base64url). */
|
|
1998
|
+
key: string;
|
|
1999
|
+
/** The user's name for the key ("phone", "paper backup"); null when none was given. */
|
|
2000
|
+
label: string | null;
|
|
2001
|
+
/** `OwnerKey.VouchOwner`: the owner that signed its add, or that issued the owner grant that seated it; null on the founding key. */
|
|
2002
|
+
vouchedBy: string | null;
|
|
2003
|
+
/** This node's owner signer holds it. */
|
|
2004
|
+
heldHere: boolean;
|
|
2005
|
+
/** In this node's trusted-owner anchor, so this node accepts what it signs. */
|
|
2006
|
+
trusted: boolean;
|
|
2007
|
+
}
|
|
2008
|
+
/** Why `CadreNode.addOwner` refuses by name (`OwnerKeyAddRefusedError.code`). */
|
|
2009
|
+
export type OwnerKeyAddRefusal =
|
|
2010
|
+
/** No control connection while the party has other members: the row would stay on this node, and nothing re-issues an `OwnerKey` add. */
|
|
2011
|
+
'alone';
|
|
1922
2012
|
/** Why `CadreNode.removeMachine` refuses by name (`MachineRemovalRefusedError.code`). */
|
|
1923
2013
|
export type MachineRemovalRefusal =
|
|
1924
2014
|
/** This node holds no enrolled owner key, so it cannot sign the removal. */
|
|
1925
2015
|
'not-an-owner'
|
|
1926
|
-
/** The machine is this node:
|
|
1927
|
-
| 'self'
|
|
1928
|
-
/** The machine holds the only live owner key here (`MinOneOwner`). */
|
|
1929
|
-
| 'last-owner';
|
|
2016
|
+
/** The machine is this node: leaving a cadre is the embedder's flow (stop the node, delete its data), not a removal. */
|
|
2017
|
+
| 'self';
|
|
1930
2018
|
/**
|
|
1931
2019
|
* What `CadreNode.removeMachine` would do for one machine, read without writing
|
|
1932
|
-
* (`CadreNode.planMachineRemoval`), for an app's confirmation step.
|
|
2020
|
+
* (`CadreNode.planMachineRemoval`), for an app's confirmation step. A machine vouches nothing
|
|
2021
|
+
* (a `VouchOwner` is an owner key), so removing one strands no other row.
|
|
1933
2022
|
*/
|
|
1934
2023
|
export interface MachineRemovalPlan {
|
|
1935
2024
|
/** The machine as listed, or null when no live row names it here (already removed). */
|
|
1936
2025
|
machine: CadreMachine | null;
|
|
1937
2026
|
refusal: MachineRemovalRefusal | null;
|
|
1938
|
-
/** The machine's key is a live owner key, so the removal also retires it. */
|
|
1939
|
-
removesOwnerKey: boolean;
|
|
1940
|
-
/** Rows the machine's owner key vouched, which stop passing the membership predicate everywhere once it is removed unless re-vouched first. Empty unless `removesOwnerKey`. */
|
|
1941
|
-
dependents: {
|
|
1942
|
-
/** Live `OwnerKey` rows whose `VouchOwner` is the machine's key, this node's own excluded. */
|
|
1943
|
-
owners: string[];
|
|
1944
|
-
/** Live `CadrePeer` rows whose `VouchOwner` is the machine's key, the machine itself and this node excluded. */
|
|
1945
|
-
peers: string[];
|
|
1946
|
-
};
|
|
1947
2027
|
/** Live `CadreInvite` keys the machine could redeem to come back: targeted at it, or already redeemed by it with uses left. */
|
|
1948
2028
|
invitations: string[];
|
|
1949
|
-
/** This node's own `OwnerKey` or `CadrePeer` row was vouched by the machine. It cannot re-vouch its own rows; another owner has to re-add it afterwards. */
|
|
1950
|
-
ownDependency: boolean;
|
|
1951
|
-
}
|
|
1952
|
-
/** Options for `CadreNode.removeMachine`. */
|
|
1953
|
-
export interface RemoveMachineOptions {
|
|
1954
|
-
/** Dependents to re-vouch under this node's key before the removal; each must appear in the plan's `dependents`. */
|
|
1955
|
-
revouch?: {
|
|
1956
|
-
owners?: readonly string[];
|
|
1957
|
-
peers?: readonly string[];
|
|
1958
|
-
};
|
|
1959
2029
|
}
|
|
1960
2030
|
/** What `CadreNode.removeMachine` wrote. All false and empty when no live row named the machine here. */
|
|
1961
2031
|
export interface MachineRemovalResult {
|
|
1962
2032
|
removedPeer: boolean;
|
|
1963
|
-
removedOwnerKey: boolean;
|
|
1964
2033
|
removedDeviceToken: boolean;
|
|
1965
2034
|
/** `CadreInvite` keys whose withdrawal tombstone this call filed. */
|
|
1966
2035
|
withdrawnInvitations: string[];
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
2036
|
+
}
|
|
2037
|
+
/** Why `CadreNode.removeOwner` refuses by name (`OwnerKeyRemovalRefusedError.code`). */
|
|
2038
|
+
export type OwnerKeyRemovalRefusal =
|
|
2039
|
+
/** This node holds no enrolled owner key, so it cannot sign the removal. */
|
|
2040
|
+
'not-an-owner'
|
|
2041
|
+
/** No live `OwnerKey` row names the key here (never an owner, or already removed). */
|
|
2042
|
+
| 'unknown'
|
|
2043
|
+
/** The key is the only live owner key (`MinOneOwner`); no owner can remove it. */
|
|
2044
|
+
| 'last-owner'
|
|
2045
|
+
/** The key is this node's own owner key: an owner cannot sign its own row's removal (`A.Key <> old.Key`), so ask another owner key. */
|
|
2046
|
+
| 'self'
|
|
2047
|
+
/** A re-vouch of an `OwnerKey` row was asked for while this node has no control connection and the party has other members: the re-added row has no re-issue path. Decided at call time, so never planned. */
|
|
2048
|
+
| 'alone';
|
|
2049
|
+
/** The rows sharing the owner keys' voucher column that a removed owner key strands unless re-vouched first. */
|
|
2050
|
+
export interface OwnerKeyDependents {
|
|
2051
|
+
/** Live `OwnerKey` rows whose `VouchOwner` is the key, this node's own excluded. */
|
|
2052
|
+
owners: string[];
|
|
2053
|
+
/** Live `CadrePeer` rows (peer ids) whose `VouchOwner` is the key, this node's own excluded. */
|
|
2054
|
+
peers: string[];
|
|
2055
|
+
}
|
|
2056
|
+
/**
|
|
2057
|
+
* What `CadreNode.removeOwner` would do for one owner key, read without writing
|
|
2058
|
+
* (`CadreNode.planOwnerKeyRemoval`), for an app's confirmation step.
|
|
2059
|
+
*/
|
|
2060
|
+
export interface OwnerKeyRemovalPlan {
|
|
2061
|
+
/** The key as `CadreNode.listOwnerKeys` lists it, or null when no live row names it here. */
|
|
2062
|
+
ownerKey: CadreOwnerKey | null;
|
|
2063
|
+
refusal: Exclude<OwnerKeyRemovalRefusal, 'alone'> | null;
|
|
2064
|
+
/** Rows the key vouched, which stop passing the membership predicate on every machine once it is removed unless re-vouched first. */
|
|
2065
|
+
dependents: OwnerKeyDependents;
|
|
2066
|
+
/** This node's own `CadrePeer` row was vouched by the key, so `removeOwner` re-vouches it under this node's key first, unasked: left on the removed key, every other machine would drop this node. */
|
|
2067
|
+
revouchesOwnRow: boolean;
|
|
2068
|
+
/** This node's own `OwnerKey` row was vouched by the key. It cannot re-vouch that row (the re-add's delete would be its own removal); it keeps its place in every anchor that already derived it, and another owner can re-vouch it afterwards. */
|
|
2069
|
+
ownDependency: boolean;
|
|
2070
|
+
/** Live owner grants the key issued, which stop being redeemable once it is removed (`OwnerGrantUsage.Authorized` wants a live issuer): an app says "the backup made with this key stops working". Withdrawn, expired and spent grants are not listed. */
|
|
2071
|
+
grants: OwnerGrantRow[];
|
|
2072
|
+
}
|
|
2073
|
+
/** Options for `CadreNode.removeOwner`. */
|
|
2074
|
+
export interface RemoveOwnerOptions {
|
|
2075
|
+
/** Dependents to re-vouch under this node's key before the removal; each must appear in the plan's `dependents`. */
|
|
2076
|
+
revouch?: {
|
|
2077
|
+
owners?: readonly string[];
|
|
2078
|
+
peers?: readonly string[];
|
|
1971
2079
|
};
|
|
1972
2080
|
}
|
|
2081
|
+
/** What `CadreNode.removeOwner` wrote. */
|
|
2082
|
+
export interface OwnerKeyRemovalResult {
|
|
2083
|
+
/** The `OwnerKey` row and its tombstone were written; false only when another owner's removal reached this node between the plan and the write. */
|
|
2084
|
+
removed: boolean;
|
|
2085
|
+
/** Rows re-vouched under this node's key before the removal: the dependents asked for, and this node's own row when the plan's `revouchesOwnRow`. */
|
|
2086
|
+
revouched: OwnerKeyDependents;
|
|
2087
|
+
}
|
|
1973
2088
|
/**
|
|
1974
2089
|
* This node's own removal from its cadre, as it learned it: the `CadrePeer` tombstone naming
|
|
1975
2090
|
* its peer id, read after it had seen its own live row (`CadreNode.removedFromCadre`, the
|
|
@@ -1999,14 +2114,34 @@ export interface CadreInviteStatus {
|
|
|
1999
2114
|
}
|
|
2000
2115
|
/**
|
|
2001
2116
|
* What `ControlDatabase.redeemCadreInvite` did. `alreadyMember` is the idempotent
|
|
2002
|
-
* retry after a dropped reply: the device's row
|
|
2003
|
-
*
|
|
2004
|
-
* no seat was spent. The stamps are the live rows' either way.
|
|
2117
|
+
* retry after a dropped reply: the device's row was already present, so nothing was
|
|
2118
|
+
* written and no seat was spent. The stamp is the live row's either way.
|
|
2005
2119
|
*/
|
|
2006
2120
|
export interface CadreInviteRedemptionResult {
|
|
2007
2121
|
alreadyMember: boolean;
|
|
2008
2122
|
peerStampId: string;
|
|
2009
|
-
|
|
2123
|
+
}
|
|
2124
|
+
/**
|
|
2125
|
+
* One {@link OwnerGrantRow} with its standing, as `ControlDatabase.listOwnerGrantStatuses`
|
|
2126
|
+
* reports it. `live` is the redemption's own test: not withdrawn, unexpired, uses left,
|
|
2127
|
+
* issuer still an owner here.
|
|
2128
|
+
*/
|
|
2129
|
+
export interface OwnerGrantStatus {
|
|
2130
|
+
grant: OwnerGrantRow;
|
|
2131
|
+
live: boolean;
|
|
2132
|
+
withdrawn: boolean;
|
|
2133
|
+
/** Redemptions this node holds for it (`OwnerGrantUsage` rows). */
|
|
2134
|
+
usesRecorded: number;
|
|
2135
|
+
}
|
|
2136
|
+
/**
|
|
2137
|
+
* What `ControlDatabase.redeemOwnerGrant` did. `alreadyOwner` is the idempotent retry after
|
|
2138
|
+
* a dropped reply, and the case of a holder seating a key that is already an owner: the
|
|
2139
|
+
* key's live `OwnerKey` row was already present, so nothing was written and no use was
|
|
2140
|
+
* spent. `seatedStampId` is the live row's either way.
|
|
2141
|
+
*/
|
|
2142
|
+
export interface OwnerGrantRedemptionResult {
|
|
2143
|
+
alreadyOwner: boolean;
|
|
2144
|
+
seatedStampId: string;
|
|
2010
2145
|
}
|
|
2011
2146
|
/**
|
|
2012
2147
|
* One `CadreControl.Revocation` tombstone as read by
|
|
@@ -2197,7 +2332,7 @@ export interface ApnsCredentials {
|
|
|
2197
2332
|
production?: boolean;
|
|
2198
2333
|
}
|
|
2199
2334
|
/**
|
|
2200
|
-
* A peer entry in a control network seed.
|
|
2335
|
+
* A peer entry in a control network seed, or in a cadre invitation redemption reply.
|
|
2201
2336
|
* Contains connection information for a cadre peer.
|
|
2202
2337
|
*/
|
|
2203
2338
|
export interface SeedPeer {
|
|
@@ -2205,10 +2340,12 @@ export interface SeedPeer {
|
|
|
2205
2340
|
peerId: string;
|
|
2206
2341
|
/** Multiaddrs for connecting to this peer */
|
|
2207
2342
|
multiaddrs: string[];
|
|
2208
|
-
/**
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2343
|
+
/**
|
|
2344
|
+
* Dial this peer first: the machine that minted the seed (or answered the redemption) and
|
|
2345
|
+
* every always-on machine (`CadrePeer.Profile = 'storage'`). A dial hint only — it grants
|
|
2346
|
+
* nothing, and says nothing about owner keys (`projectSeedPeers`).
|
|
2347
|
+
*/
|
|
2348
|
+
preferred: boolean;
|
|
2212
2349
|
}
|
|
2213
2350
|
/**
|
|
2214
2351
|
* Control network seed for bootstrapping new nodes.
|
|
@@ -2399,15 +2536,15 @@ export interface ApplySeedResult {
|
|
|
2399
2536
|
/** Machine-readable refusal cause, when the refusing trust policy supplied one. */
|
|
2400
2537
|
code?: SeedRefusalCode;
|
|
2401
2538
|
/**
|
|
2402
|
-
*
|
|
2403
|
-
* carried no
|
|
2539
|
+
* Preferred seed peers (`SeedPeer.preferred`) this apply attempted to dial. Zero when the
|
|
2540
|
+
* seed carried no preferred peer with an address, or when the seed was rejected before
|
|
2404
2541
|
* the dial loop ran.
|
|
2405
2542
|
*/
|
|
2406
|
-
|
|
2543
|
+
preferredDialsAttempted: number;
|
|
2407
2544
|
/**
|
|
2408
|
-
* How many of those dials threw. `
|
|
2409
|
-
* ===
|
|
2410
|
-
* accepted (`success: true`) but no
|
|
2545
|
+
* How many of those dials threw. `preferredDialsAttempted > 0 && preferredDialsFailed
|
|
2546
|
+
* === preferredDialsAttempted` means "seeded but stranded": the seed itself was
|
|
2547
|
+
* accepted (`success: true`) but no preferred peer could be reached, so this node has
|
|
2411
2548
|
* no connection to bootstrap its control database from. The node retries those
|
|
2412
2549
|
* addresses on every control-cohort reconcile pass (see
|
|
2413
2550
|
* `CadreNode.dialColdStartBootstrap`), so this is a signal, not a fatal error.
|
|
@@ -2419,7 +2556,7 @@ export interface ApplySeedResult {
|
|
|
2419
2556
|
* down. Treat a non-zero value as certain failure and zero as "no failure
|
|
2420
2557
|
* observed".
|
|
2421
2558
|
*/
|
|
2422
|
-
|
|
2559
|
+
preferredDialsFailed: number;
|
|
2423
2560
|
}
|
|
2424
2561
|
/**
|
|
2425
2562
|
* Node network topology type for seed helper scenarios.
|
|
@@ -2427,18 +2564,13 @@ export interface ApplySeedResult {
|
|
|
2427
2564
|
export type NodeTopology = 'public' | 'nat';
|
|
2428
2565
|
/**
|
|
2429
2566
|
* What an owner asks `CadreNode.createCadreInvitation` for. The invitation is a keypair the
|
|
2430
|
-
* node mints; whoever holds the returned bundle can redeem it at any member machine.
|
|
2567
|
+
* node mints; whoever holds the returned bundle can redeem it at any member machine. It admits
|
|
2568
|
+
* a machine and grants nothing else; ownership is an owner grant (`CreateOwnerGrantOptions`).
|
|
2431
2569
|
*/
|
|
2432
2570
|
export interface CreateCadreInvitationOptions {
|
|
2433
2571
|
/** The one device that may redeem it; omit for whoever redeems first. */
|
|
2434
2572
|
peerId?: string;
|
|
2435
|
-
/**
|
|
2436
|
-
grantsOwner: boolean;
|
|
2437
|
-
/**
|
|
2438
|
-
* Lifetime from now, in ms. Defaults to 15 minutes for an untargeted owner-granting
|
|
2439
|
-
* invitation — a bearer credential for admin rights — and 24 hours otherwise. A negative
|
|
2440
|
-
* value mints an already-expired invitation (tests).
|
|
2441
|
-
*/
|
|
2573
|
+
/** Lifetime from now, in ms; default 24 hours. A negative value mints an already-expired invitation (tests). */
|
|
2442
2574
|
expiresInMs?: number;
|
|
2443
2575
|
/** How many redemptions it allows; default 1. */
|
|
2444
2576
|
uses?: number;
|
|
@@ -2490,17 +2622,68 @@ export type CadreJoinProgress = {
|
|
|
2490
2622
|
* least one member answered with a retryable refusal (issuer-unknown, busy, conflict, internal).
|
|
2491
2623
|
*/
|
|
2492
2624
|
reason: 'no-member-answered' | 'member-not-ready';
|
|
2493
|
-
outcomes: readonly
|
|
2625
|
+
outcomes: readonly RedemptionAddressOutcome[];
|
|
2494
2626
|
};
|
|
2495
2627
|
/** What `CadreNode.redeemCadreInvitation` returns once a member accepted. */
|
|
2496
2628
|
export interface RedeemCadreInvitationResult {
|
|
2497
2629
|
/** The member machine that admitted this device, when its address named one. */
|
|
2498
2630
|
peerId: string | null;
|
|
2499
|
-
/** Whether the invitation also seated this device's key as an owner. */
|
|
2500
|
-
grantsOwner: boolean;
|
|
2501
2631
|
/** When the member accepted, ISO 8601. */
|
|
2502
2632
|
redeemedAt: string;
|
|
2503
2633
|
}
|
|
2634
|
+
/**
|
|
2635
|
+
* What an owner asks `CadreNode.createOwnerGrant` for. The grant is a keypair the node mints;
|
|
2636
|
+
* whoever holds the returned bundle can become an owner of this cadre through any member
|
|
2637
|
+
* machine, so it is a bearer credential for admin rights.
|
|
2638
|
+
*/
|
|
2639
|
+
export interface CreateOwnerGrantOptions {
|
|
2640
|
+
/** The label every key the grant seats will carry; trimmed, at most 64 characters, blank meaning none. */
|
|
2641
|
+
label?: string;
|
|
2642
|
+
/**
|
|
2643
|
+
* Lifetime from now, in ms; default 15 minutes. `null` means NO expiry and must be passed
|
|
2644
|
+
* explicitly: a backup grant, kept as carefully as an owner key. A negative value mints an
|
|
2645
|
+
* already-expired grant (tests).
|
|
2646
|
+
*/
|
|
2647
|
+
expiresInMs?: number | null;
|
|
2648
|
+
/** How many redemptions it allows; default 1. */
|
|
2649
|
+
uses?: number;
|
|
2650
|
+
}
|
|
2651
|
+
/** What `CadreNode.createOwnerGrant` returns: the bundle, the same encoded for sharing, and how far it reaches. */
|
|
2652
|
+
export interface CreateOwnerGrantResult {
|
|
2653
|
+
grant: OwnerGrantBundle;
|
|
2654
|
+
/** `encodeOwnerGrant(grant)`: `sereus-owner-grant:1.` and base64url JSON, for a QR code, a paste or a file. */
|
|
2655
|
+
encoded: string;
|
|
2656
|
+
/** Whether a holder could redeem it once the minting machine is gone; see {@link CadreInvitationReach}. */
|
|
2657
|
+
reach: CadreInvitationReach;
|
|
2658
|
+
}
|
|
2659
|
+
/** How `CadreNode.redeemOwnerGrant` and `joinWithOwnerGrant` dial the grant's members: the invitation's options, with the same meanings. */
|
|
2660
|
+
export type RedeemOwnerGrantOptions = RedeemCadreInvitationOptions;
|
|
2661
|
+
/** What `CadreNode.redeemOwnerGrant` returns once the key is seated. */
|
|
2662
|
+
export interface RedeemOwnerGrantResult {
|
|
2663
|
+
/** The key seated as an owner: the signer's public key. */
|
|
2664
|
+
ownerKey: string;
|
|
2665
|
+
/** The key was already a live owner, so nothing was written and no use of the grant was spent. */
|
|
2666
|
+
alreadyOwner: boolean;
|
|
2667
|
+
/** The member machine that wrote the row, when the redemption went over the protocol and its address named one; null on the local path. */
|
|
2668
|
+
memberPeerId: string | null;
|
|
2669
|
+
}
|
|
2670
|
+
/** What `CadreNode.joinWithOwnerGrant` returns once this node is a member and its key an owner. */
|
|
2671
|
+
export interface JoinWithOwnerGrantResult {
|
|
2672
|
+
/** The member machine that admitted this node, when its address named one. */
|
|
2673
|
+
peerId: string | null;
|
|
2674
|
+
/** When the member admitted this node, ISO 8601. */
|
|
2675
|
+
redeemedAt: string;
|
|
2676
|
+
/** The key seated as an owner: the signer's public key. */
|
|
2677
|
+
ownerKey: string;
|
|
2678
|
+
/** The key was already a live owner of the party, so the grant spent no use. */
|
|
2679
|
+
alreadyOwner: boolean;
|
|
2680
|
+
/**
|
|
2681
|
+
* The signer was wired as this node's owner signer, because its `OwnerKey` row reached this
|
|
2682
|
+
* node within the bound. False when the row had not synced in time: the node is a member and
|
|
2683
|
+
* the key an owner all the same, and `CadreNode.wireOwnKeyIfOwner(signer)` wires it later.
|
|
2684
|
+
*/
|
|
2685
|
+
ownerWired: boolean;
|
|
2686
|
+
}
|
|
2504
2687
|
/**
|
|
2505
2688
|
* Options for adding a drone via provider API.
|
|
2506
2689
|
*/
|
package/dist/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AA0FA;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAA6C;IAC5E,QAAQ,EAAE;QACR,WAAW,EAAE,QAAQ,EAAS,aAAa;QAC3C,gBAAgB,EAAE,QAAQ,EAAI,kBAAkB;QAChD,eAAe,EAAE,QAAQ,EAAK,MAAM;QACpC,oBAAoB,EAAE,CAAC;QACvB,kBAAkB,EAAE,QAAQ,CAAE,MAAM;KACrC;IACD,WAAW,EAAE;QACX,WAAW,EAAE,CAAC,GAAG,EAAE,GAAG,IAAI,EAAI,YAAY;QAC1C,gBAAgB,EAAE,EAAE,GAAG,EAAE,GAAG,IAAI,EAAE,wBAAwB;QAC1D,eAAe,EAAE,EAAE,GAAG,IAAI,EAAI,mBAAmB;QACjD,oBAAoB,EAAE,CAAC;QACvB,kBAAkB,EAAE,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,eAAe;KACnD;IACD,UAAU,EAAE;QACV,WAAW,EAAE,CAAC,GAAG,EAAE,GAAG,IAAI,EAAI,WAAW;QACzC,gBAAgB,EAAE,CAAC,GAAG,EAAE,GAAG,IAAI,EAAG,uBAAuB;QACzD,eAAe,EAAE,CAAC,GAAG,EAAE,GAAG,IAAI,EAAI,kBAAkB;QACpD,oBAAoB,EAAE,CAAC;QACvB,kBAAkB,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,gBAAgB;KACxD;IACD,OAAO,EAAE;QACP,WAAW,EAAE,EAAE,GAAG,IAAI,EAAQ,aAAa;QAC3C,gBAAgB,EAAE,EAAE,GAAG,IAAI,EAAG,wBAAwB;QACtD,eAAe,EAAE,EAAE,GAAG,EAAE,GAAG,IAAI,EAAG,eAAe;QACjD,oBAAoB,EAAE,CAAC;QACvB,kBAAkB,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,eAAe;KAC5D;CACF,CAAC;AAweF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6DG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,MAAM,CAAC,MAAM,CAAC;IACtD,uFAAuF;IACvF,mFAAmF;IACnF,YAAY,EAAE,KAAM;IACpB,kFAAkF;IAClF,kFAAkF;IAClF,mBAAmB;IACnB,WAAW,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,UAAU,EAAE,KAAM,EAAE,UAAU,EAAE,KAAM,EAAE,CAAC;CACjC,CAAC,CAAC;AAmBzC;;;GAGG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,EAAE,GAAG,IAAI,CAAC;AAYnD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,OAAO,EACL,gBAAgB,EAChB,uBAAuB,EACvB,2BAA2B,EAC3B,sBAAsB,EACtB,2BAA2B,EAC3B,qBAAqB,EACrB,wBAAwB,EACxB,sBAAsB,EACtB,oBAAoB,EACpB,mBAAmB,EACpB,MAAM,+BAA+B,CAAC;AAEvC;;;;;GAKG;AACH,OAAO,EAAE,2BAA2B,EAAE,MAAM,kBAAkB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@serfab/cadre-core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.17.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Core library for Sereus cadre nodes - manages control networks and strand participation",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -51,6 +51,14 @@
|
|
|
51
51
|
"./node-default-transports": {
|
|
52
52
|
"types": "./dist/node-default-transports.d.ts",
|
|
53
53
|
"import": "./dist/node-default-transports.js"
|
|
54
|
+
},
|
|
55
|
+
"./edge-node": {
|
|
56
|
+
"react-native": {
|
|
57
|
+
"types": "./dist/edge-node/index.d.ts",
|
|
58
|
+
"import": "./dist/edge-node/index.js"
|
|
59
|
+
},
|
|
60
|
+
"types": "./dist/edge-node/index.d.ts",
|
|
61
|
+
"import": "./dist/edge-node/index.js"
|
|
54
62
|
}
|
|
55
63
|
},
|
|
56
64
|
"repository": {
|
|
@@ -101,13 +109,14 @@
|
|
|
101
109
|
"@libp2p/tcp": "^11.0.28",
|
|
102
110
|
"@libp2p/websockets": "^10.1.21",
|
|
103
111
|
"@multiformats/multiaddr": "^13.0.3",
|
|
112
|
+
"@noble/ciphers": "^2.0.1",
|
|
104
113
|
"@noble/hashes": "^2.0.0",
|
|
105
114
|
"@optimystic/db-core": "^1.15.0",
|
|
106
115
|
"@optimystic/db-p2p": "^1.15.0",
|
|
107
116
|
"@optimystic/quereus-plugin-crypto": "^1.15.0",
|
|
108
117
|
"@optimystic/quereus-plugin-optimystic": "^1.15.0",
|
|
109
118
|
"@quereus/quereus": "^4.20.1",
|
|
110
|
-
"@serfab/quereus-plugin-sereus": "^1.
|
|
119
|
+
"@serfab/quereus-plugin-sereus": "^1.17.0",
|
|
111
120
|
"debug": "^4.4.3",
|
|
112
121
|
"libp2p": "^3.3.11",
|
|
113
122
|
"uint8arrays": "^6.1.1"
|