@calimero-network/mero-js 19.25.0 → 19.27.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/dist/admin-api/admin-client.d.ts +4 -0
- package/dist/admin-api/admin-client.js +4 -0
- package/dist/admin-api/admin-types.d.ts +18 -0
- package/dist/admin-api/admin-types.js +0 -2
- package/dist/cloud/connect.d.ts +19 -0
- package/dist/cloud/connect.js +17 -1
- package/dist/index.browser.mjs +2 -2
- package/dist/index.browser.mjs.map +4 -4
- package/dist/index.cjs +222 -91
- package/dist/index.cjs.map +4 -4
- package/dist/index.mjs +222 -91
- package/dist/index.mjs.map +4 -4
- package/dist/sealed/index.d.ts +4 -2
- package/dist/sealed/index.js +2 -1
- package/dist/sealed/noise.js +11 -3
- package/dist/sealed/sealed.d.ts +46 -6
- package/dist/sealed/sealed.js +57 -1
- package/dist/sealed/verify.d.ts +109 -0
- package/dist/sealed/verify.js +116 -0
- package/package.json +2 -1
|
@@ -534,6 +534,10 @@ export declare class AdminApiClient {
|
|
|
534
534
|
joinSubgroupInheritance(groupId: string): Promise<JoinSubgroupInheritanceResponseData>;
|
|
535
535
|
getTeeInfo(): Promise<TeeInfoResponseData>;
|
|
536
536
|
teeAttest(request: TeeAttestRequest): Promise<TeeAttestResponseData>;
|
|
537
|
+
/**
|
|
538
|
+
* @deprecated Nodes no longer serve `/admin-api/tee/verify-quote` (removed in
|
|
539
|
+
* core#3262), so this fails. Verify quotes with `createQuoteVerifier`.
|
|
540
|
+
*/
|
|
537
541
|
teeVerifyQuote(request: TeeVerifyQuoteRequest): Promise<TeeVerifyQuoteResponseData>;
|
|
538
542
|
getPeersCount(): Promise<{
|
|
539
543
|
count: number;
|
|
@@ -1002,6 +1002,10 @@ export class AdminApiClient {
|
|
|
1002
1002
|
async teeAttest(request) {
|
|
1003
1003
|
return unwrap(await this.httpClient.post('/admin-api/tee/attest', request));
|
|
1004
1004
|
}
|
|
1005
|
+
/**
|
|
1006
|
+
* @deprecated Nodes no longer serve `/admin-api/tee/verify-quote` (removed in
|
|
1007
|
+
* core#3262), so this fails. Verify quotes with `createQuoteVerifier`.
|
|
1008
|
+
*/
|
|
1005
1009
|
async teeVerifyQuote(request) {
|
|
1006
1010
|
return unwrap(await this.httpClient.post('/admin-api/tee/verify-quote', request));
|
|
1007
1011
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { DcapCollateral } from '../sealed/verify.js';
|
|
1
2
|
export { ApiResponse } from '../http-client/index.js';
|
|
2
3
|
export interface HealthStatus {
|
|
3
4
|
status: string;
|
|
@@ -1577,6 +1578,12 @@ export interface TeeAttestRequest {
|
|
|
1577
1578
|
* as `transportPublicKey`. See `fetchAttestedTransportKey`.
|
|
1578
1579
|
*/
|
|
1579
1580
|
bindTransportKey?: boolean;
|
|
1581
|
+
/**
|
|
1582
|
+
* Also return the Intel-signed collateral the quote is verified against, as
|
|
1583
|
+
* `collateral`, so the quote can be verified with nothing but the node. See
|
|
1584
|
+
* `createQuoteVerifier`. A node that predates it refuses the field.
|
|
1585
|
+
*/
|
|
1586
|
+
includeCollateral?: boolean;
|
|
1580
1587
|
}
|
|
1581
1588
|
export interface QuoteHeader {
|
|
1582
1589
|
version: number;
|
|
@@ -1617,12 +1624,23 @@ export interface TeeAttestResponseData {
|
|
|
1617
1624
|
quote: Quote;
|
|
1618
1625
|
/** Hex X25519 transport key, present only when the request set `bindTransportKey`. */
|
|
1619
1626
|
transportPublicKey?: string;
|
|
1627
|
+
/**
|
|
1628
|
+
* The Intel-signed collateral the quote verifies against, present only when
|
|
1629
|
+
* the request set `includeCollateral` and the quote is not a mock.
|
|
1630
|
+
*/
|
|
1631
|
+
collateral?: DcapCollateral;
|
|
1620
1632
|
}
|
|
1633
|
+
/**
|
|
1634
|
+
* @deprecated Nodes no longer serve `/admin-api/tee/verify-quote` (removed in
|
|
1635
|
+
* core#3262), so a request for it fails. Verify quotes with
|
|
1636
|
+
* `createQuoteVerifier`.
|
|
1637
|
+
*/
|
|
1621
1638
|
export interface TeeVerifyQuoteRequest {
|
|
1622
1639
|
quoteB64: string;
|
|
1623
1640
|
nonce: string;
|
|
1624
1641
|
expectedApplicationHash?: string;
|
|
1625
1642
|
}
|
|
1643
|
+
/** @deprecated See {@link TeeVerifyQuoteRequest}. */
|
|
1626
1644
|
export interface TeeVerifyQuoteResponseData {
|
|
1627
1645
|
quoteVerified: boolean;
|
|
1628
1646
|
nonceVerified: boolean;
|
package/dist/cloud/connect.d.ts
CHANGED
|
@@ -21,6 +21,13 @@
|
|
|
21
21
|
*
|
|
22
22
|
* # What it does not do
|
|
23
23
|
*
|
|
24
|
+
* # Sealing the relay
|
|
25
|
+
*
|
|
26
|
+
* TLS in front of a relay ends outside its TD, at the host's ingress, where
|
|
27
|
+
* the warrant and the method's arguments are readable. Pass `seal` (a quote
|
|
28
|
+
* verifier) and every call to the relay is sealed to the key its attested TD
|
|
29
|
+
* holds, so they are readable only inside it.
|
|
30
|
+
*
|
|
24
31
|
* It does not read state. A relay writes on the author's behalf; reads still
|
|
25
32
|
* come from a node the client can query, or from the app's own projection of
|
|
26
33
|
* the events it receives. `connectCloud` is deliberately narrow about this
|
|
@@ -31,6 +38,7 @@ import { CloudClient } from './cloud-client.js';
|
|
|
31
38
|
import type { CloudClientConfig, CloudNamespace, CloudRelay } from './cloud-client.js';
|
|
32
39
|
import { RelayClient } from '../relay/relay-client.js';
|
|
33
40
|
import type { IntentResult, NonceSource } from '../relay/index.js';
|
|
41
|
+
import type { VerifyTransportQuote } from '../sealed/sealed.js';
|
|
34
42
|
export interface ConnectCloudOptions {
|
|
35
43
|
/** Defaults to the hosted cloud. */
|
|
36
44
|
cloudBaseUrl?: string;
|
|
@@ -65,6 +73,17 @@ export interface ConnectCloudOptions {
|
|
|
65
73
|
nonces?: NonceSource;
|
|
66
74
|
/** Seconds a minted warrant stays presentable. Defaults to 300. */
|
|
67
75
|
ttlSeconds?: number;
|
|
76
|
+
/**
|
|
77
|
+
* Seal every call to the relay to its attested TEE, verified with this — for
|
|
78
|
+
* example {@link createQuoteVerifier} with the MRTDs you trust. The warrant
|
|
79
|
+
* and the method's arguments then reach only the relay's TD, not whatever
|
|
80
|
+
* terminates TLS in front of it, and the relay is one this client checked
|
|
81
|
+
* itself rather than one the cloud vouched for. Calls to the cloud are not
|
|
82
|
+
* sealed; they carry no intent.
|
|
83
|
+
*
|
|
84
|
+
* Without it, calls to the relay are plain HTTPS.
|
|
85
|
+
*/
|
|
86
|
+
seal?: VerifyTransportQuote;
|
|
68
87
|
fetch?: typeof fetch;
|
|
69
88
|
timeoutMs?: number;
|
|
70
89
|
}
|
package/dist/cloud/connect.js
CHANGED
|
@@ -21,6 +21,13 @@
|
|
|
21
21
|
*
|
|
22
22
|
* # What it does not do
|
|
23
23
|
*
|
|
24
|
+
* # Sealing the relay
|
|
25
|
+
*
|
|
26
|
+
* TLS in front of a relay ends outside its TD, at the host's ingress, where
|
|
27
|
+
* the warrant and the method's arguments are readable. Pass `seal` (a quote
|
|
28
|
+
* verifier) and every call to the relay is sealed to the key its attested TD
|
|
29
|
+
* holds, so they are readable only inside it.
|
|
30
|
+
*
|
|
24
31
|
* It does not read state. A relay writes on the author's behalf; reads still
|
|
25
32
|
* come from a node the client can query, or from the app's own projection of
|
|
26
33
|
* the events it receives. `connectCloud` is deliberately narrow about this
|
|
@@ -31,6 +38,7 @@ import { CloudClient } from './cloud-client.js';
|
|
|
31
38
|
import { RelayClient } from '../relay/relay-client.js';
|
|
32
39
|
import { createLocalStorageNonceSource, createMemoryNonceSource } from '../relay/nonce-source.js';
|
|
33
40
|
import { derivePublicKey, hex } from '../crypto/internal.js';
|
|
41
|
+
import { createAttestedSealedFetch } from '../sealed/sealed.js';
|
|
34
42
|
/**
|
|
35
43
|
* Sign in to the cloud and return a connection that can write.
|
|
36
44
|
*
|
|
@@ -77,7 +85,15 @@ export async function connectCloud(options) {
|
|
|
77
85
|
deviceSecret: options.deviceSecret,
|
|
78
86
|
nonces: options.nonces ?? (await defaultNonceSource(options.deviceSecret)),
|
|
79
87
|
ttlSeconds: options.ttlSeconds,
|
|
80
|
-
|
|
88
|
+
// Only the relay is sealed: a sealed fetch is bound to one node and refuses
|
|
89
|
+
// any other URL, and the cloud calls above carry no intent.
|
|
90
|
+
fetch: options.seal
|
|
91
|
+
? createAttestedSealedFetch({
|
|
92
|
+
baseUrl: relayInfo.relayUrl,
|
|
93
|
+
verify: options.seal,
|
|
94
|
+
fetch: options.fetch,
|
|
95
|
+
})
|
|
96
|
+
: options.fetch,
|
|
81
97
|
timeoutMs: options.timeoutMs,
|
|
82
98
|
});
|
|
83
99
|
return {
|