@calimero-network/mero-react 9.6.4 → 9.7.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/index.cjs +15 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +14 -2
- package/dist/index.d.ts +14 -2
- package/dist/index.js +15 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -66,6 +66,17 @@ interface DelegatedSession extends DelegatedCredential {
|
|
|
66
66
|
* warrant.
|
|
67
67
|
*/
|
|
68
68
|
relayUrl: string | null;
|
|
69
|
+
/**
|
|
70
|
+
* The relay's executor account, hex, when the app knows it — the cloud's
|
|
71
|
+
* machine page names it beside the relay's address.
|
|
72
|
+
*
|
|
73
|
+
* Founding a namespace through a relay names the relay's account in the
|
|
74
|
+
* warrant, and a namespace that does not exist yet cannot be asked for it.
|
|
75
|
+
* Without this the account learns it from a namespace it is already in, so a
|
|
76
|
+
* brand-new account would have to join one first; with it, the account founds
|
|
77
|
+
* on `relayUrl` directly.
|
|
78
|
+
*/
|
|
79
|
+
executorAccount?: string | null;
|
|
69
80
|
}
|
|
70
81
|
/**
|
|
71
82
|
* The enrolled credential, whether or not a relay was ever found for it.
|
|
@@ -1061,8 +1072,9 @@ declare function createDelegatedContext(s: DelegatedSession, req: CreateDelegate
|
|
|
1061
1072
|
* through the same relay straight away.
|
|
1062
1073
|
*
|
|
1063
1074
|
* The relay's executor account cannot be asked about a namespace that does
|
|
1064
|
-
* not exist yet, so it is
|
|
1065
|
-
*
|
|
1075
|
+
* not exist yet, so it is the session's `executorAccount` when the app named
|
|
1076
|
+
* one, else learned from a namespace the account already has on that relay. A
|
|
1077
|
+
* brand-new account with neither is told how to get one.
|
|
1066
1078
|
*/
|
|
1067
1079
|
declare function foundDelegatedNamespace(s: DelegatedSession, req?: {
|
|
1068
1080
|
readonly defaultCapabilities?: number;
|
package/dist/index.d.ts
CHANGED
|
@@ -66,6 +66,17 @@ interface DelegatedSession extends DelegatedCredential {
|
|
|
66
66
|
* warrant.
|
|
67
67
|
*/
|
|
68
68
|
relayUrl: string | null;
|
|
69
|
+
/**
|
|
70
|
+
* The relay's executor account, hex, when the app knows it — the cloud's
|
|
71
|
+
* machine page names it beside the relay's address.
|
|
72
|
+
*
|
|
73
|
+
* Founding a namespace through a relay names the relay's account in the
|
|
74
|
+
* warrant, and a namespace that does not exist yet cannot be asked for it.
|
|
75
|
+
* Without this the account learns it from a namespace it is already in, so a
|
|
76
|
+
* brand-new account would have to join one first; with it, the account founds
|
|
77
|
+
* on `relayUrl` directly.
|
|
78
|
+
*/
|
|
79
|
+
executorAccount?: string | null;
|
|
69
80
|
}
|
|
70
81
|
/**
|
|
71
82
|
* The enrolled credential, whether or not a relay was ever found for it.
|
|
@@ -1061,8 +1072,9 @@ declare function createDelegatedContext(s: DelegatedSession, req: CreateDelegate
|
|
|
1061
1072
|
* through the same relay straight away.
|
|
1062
1073
|
*
|
|
1063
1074
|
* The relay's executor account cannot be asked about a namespace that does
|
|
1064
|
-
* not exist yet, so it is
|
|
1065
|
-
*
|
|
1075
|
+
* not exist yet, so it is the session's `executorAccount` when the app named
|
|
1076
|
+
* one, else learned from a namespace the account already has on that relay. A
|
|
1077
|
+
* brand-new account with neither is told how to get one.
|
|
1066
1078
|
*/
|
|
1067
1079
|
declare function foundDelegatedNamespace(s: DelegatedSession, req?: {
|
|
1068
1080
|
readonly defaultCapabilities?: number;
|
package/dist/index.js
CHANGED
|
@@ -162,10 +162,18 @@ function isLoopback(relayUrl) {
|
|
|
162
162
|
var TRUSTED_RELAY_PROFILE = "locked-read-only";
|
|
163
163
|
var MIN_RELAY_RELEASE = "2.3.99";
|
|
164
164
|
var loadedDcap;
|
|
165
|
+
function dcapVerifyFrom(mod) {
|
|
166
|
+
const ns = mod;
|
|
167
|
+
const verify = typeof ns.verify === "function" ? ns.verify : ns.default?.verify;
|
|
168
|
+
if (typeof verify !== "function") {
|
|
169
|
+
throw new TypeError("@phala/dcap-qvl loaded without a verify function");
|
|
170
|
+
}
|
|
171
|
+
return verify;
|
|
172
|
+
}
|
|
165
173
|
function relayQuoteVerifier(relayUrl) {
|
|
166
174
|
const verify = async (attestation) => {
|
|
167
175
|
loadedDcap ?? (loadedDcap = import('@phala/dcap-qvl').then(
|
|
168
|
-
(
|
|
176
|
+
(mod) => dcapVerifyFrom(mod),
|
|
169
177
|
(error) => {
|
|
170
178
|
loadedDcap = void 0;
|
|
171
179
|
throw error;
|
|
@@ -423,10 +431,13 @@ async function foundDelegatedNamespace(s, req = {}, deps = {}) {
|
|
|
423
431
|
const known = Object.entries(readRelayMap(s.account).namespaces).find(
|
|
424
432
|
([, url]) => url.replace(/\/+$/, "") === relay
|
|
425
433
|
)?.[0];
|
|
426
|
-
|
|
427
|
-
|
|
434
|
+
const named = s.executorAccount && s.relayUrl && s.relayUrl.replace(/\/+$/, "") === relay ? s.executorAccount : null;
|
|
435
|
+
if (!named && !known) {
|
|
436
|
+
throw new Error(
|
|
437
|
+
"the executor account of this relay is not known: join a namespace on it first, or connect with the relay's executor account (the cloud shows it beside the relay)"
|
|
438
|
+
);
|
|
428
439
|
}
|
|
429
|
-
const
|
|
440
|
+
const executorAccount = named ?? (await client(s, relay, governanceNonce(relay, known), deps.fetch).describeGovernance(known)).executorAccount;
|
|
430
441
|
let next = BigInt(Date.now());
|
|
431
442
|
const founded = await client(s, relay, { next: async () => next++ }, deps.fetch).foundNamespace({
|
|
432
443
|
executorAccount,
|