@calimero-network/mero-js 23.6.0 → 23.8.1
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/dist/admin-api/admin-types.d.ts +14 -0
- package/dist/cloud/cloud-client.d.ts +20 -1
- package/dist/cloud/cloud-client.js +11 -1
- package/dist/index.browser.mjs +2 -2
- package/dist/index.browser.mjs.map +3 -3
- package/dist/index.cjs +12 -2
- package/dist/index.cjs.map +2 -2
- package/dist/index.mjs +12 -2
- package/dist/index.mjs.map +2 -2
- package/package.json +1 -1
|
@@ -1714,6 +1714,20 @@ export interface IssueOwnershipProofResponseData {
|
|
|
1714
1714
|
signedPayload: string;
|
|
1715
1715
|
/** Base64 64-byte ed25519 signature. */
|
|
1716
1716
|
signature: string;
|
|
1717
|
+
/**
|
|
1718
|
+
* Namespace proofs only: what the namespace id was derived from. Not signed;
|
|
1719
|
+
* the id commits to it. With {@link credential}, it is what lets the cloud
|
|
1720
|
+
* check that the signer is a node of the account that FOUNDED the namespace
|
|
1721
|
+
* (mdma refuses a namespace proof without both). Absent on nodes that predate
|
|
1722
|
+
* it, and on context proofs.
|
|
1723
|
+
*/
|
|
1724
|
+
founding?: NamespaceFounding;
|
|
1725
|
+
/**
|
|
1726
|
+
* Namespace proofs only: hex borsh `AccountProof<DeviceCert>` — the node's join
|
|
1727
|
+
* credential, whose account root certifies `signerPublicKey`. See
|
|
1728
|
+
* {@link founding}.
|
|
1729
|
+
*/
|
|
1730
|
+
credential?: string;
|
|
1717
1731
|
}
|
|
1718
1732
|
export interface CreateGroupInvitationRequest {
|
|
1719
1733
|
expirationTimestamp?: number;
|
|
@@ -176,6 +176,21 @@ export interface CloudAccountRelay {
|
|
|
176
176
|
peerId: string;
|
|
177
177
|
relayUrl: string | null;
|
|
178
178
|
fresh: boolean;
|
|
179
|
+
/**
|
|
180
|
+
* The relay's own account id: 64 lowercase hex, the executor a delegated
|
|
181
|
+
* write through this relay names.
|
|
182
|
+
*
|
|
183
|
+
* Null when the server did not say (older servers omit it) or sent anything
|
|
184
|
+
* that is not 64 lowercase hex — an executor that cannot be named is the
|
|
185
|
+
* same as none, and a malformed one would only fail later, at the node.
|
|
186
|
+
*/
|
|
187
|
+
executorAccount: string | null;
|
|
188
|
+
/**
|
|
189
|
+
* True when the cloud has just assigned this relay to an account that had
|
|
190
|
+
* none (the assignment is sticky); false for relays the account already
|
|
191
|
+
* used, and on older servers that omit the field.
|
|
192
|
+
*/
|
|
193
|
+
assigned: boolean;
|
|
179
194
|
}
|
|
180
195
|
export interface CloudNamespaceNode {
|
|
181
196
|
peerId: string;
|
|
@@ -656,7 +671,11 @@ export declare class CloudClient {
|
|
|
656
671
|
* Pass merod's response object straight through. The cloud accepts core's
|
|
657
672
|
* `signerPublicKey`/`signedPayload` casing as well as snake_case, so there is
|
|
658
673
|
* no re-keying step — and getting that wrong used to surface as a `422`
|
|
659
|
-
* naming three missing fields.
|
|
674
|
+
* naming three missing fields. Passing it whole also carries the `founding`
|
|
675
|
+
* and `credential` merod attaches: the cloud accepts a namespace proof only
|
|
676
|
+
* from a node of the account that founded the namespace, checked with those
|
|
677
|
+
* two, and only when that account is linked to this login. A node that
|
|
678
|
+
* predates them, or an admin that did not found the namespace, gets a `422`.
|
|
660
679
|
*
|
|
661
680
|
* Idempotent for the same account. A namespace already claimed by someone
|
|
662
681
|
* else is a `409`; a replayed proof nonce is a `403`.
|
|
@@ -66,6 +66,10 @@ function teeRoleOf(row) {
|
|
|
66
66
|
export function pickExecutingRelay(relays) {
|
|
67
67
|
return (relays.find((r) => r.canExecute && r.relayUrl !== null && r.executorAccount !== null) ?? null);
|
|
68
68
|
}
|
|
69
|
+
const ACCOUNT_HEX = /^[0-9a-f]{64}$/;
|
|
70
|
+
function accountHexOrNull(value) {
|
|
71
|
+
return typeof value === 'string' && ACCOUNT_HEX.test(value) ? value : null;
|
|
72
|
+
}
|
|
69
73
|
/**
|
|
70
74
|
* The cloud's refusals of {@link CloudClient.enableHaAsAccount} that a
|
|
71
75
|
* person can do something about. Both are `409`s with `{"error": code}`.
|
|
@@ -497,6 +501,8 @@ export class CloudClient {
|
|
|
497
501
|
peerId: String(row.peer_id ?? ''),
|
|
498
502
|
relayUrl: row.relay_url ?? null,
|
|
499
503
|
fresh: row.fresh === true,
|
|
504
|
+
executorAccount: accountHexOrNull(row.executor_account),
|
|
505
|
+
assigned: row.assigned === true,
|
|
500
506
|
}));
|
|
501
507
|
}
|
|
502
508
|
/**
|
|
@@ -567,7 +573,11 @@ export class CloudClient {
|
|
|
567
573
|
* Pass merod's response object straight through. The cloud accepts core's
|
|
568
574
|
* `signerPublicKey`/`signedPayload` casing as well as snake_case, so there is
|
|
569
575
|
* no re-keying step — and getting that wrong used to surface as a `422`
|
|
570
|
-
* naming three missing fields.
|
|
576
|
+
* naming three missing fields. Passing it whole also carries the `founding`
|
|
577
|
+
* and `credential` merod attaches: the cloud accepts a namespace proof only
|
|
578
|
+
* from a node of the account that founded the namespace, checked with those
|
|
579
|
+
* two, and only when that account is linked to this login. A node that
|
|
580
|
+
* predates them, or an admin that did not found the namespace, gets a `422`.
|
|
571
581
|
*
|
|
572
582
|
* Idempotent for the same account. A namespace already claimed by someone
|
|
573
583
|
* else is a `409`; a replayed proof nonce is a `403`.
|