@calimero-network/mero-js 35.2.0 → 35.2.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/README.md +34 -6
- package/dist/client/calimero-client.d.ts +1 -0
- package/dist/client/calimero-client.js +5 -2
- package/dist/client/files.d.ts +2 -1
- package/dist/client/files.js +2 -5
- package/dist/index.browser.mjs +3 -3
- package/dist/index.browser.mjs.map +3 -3
- package/dist/index.cjs +6 -8
- package/dist/index.cjs.map +2 -2
- package/dist/index.mjs +6 -8
- package/dist/index.mjs.map +2 -2
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -4998,12 +4998,7 @@ async function exportFileTo(transport, app, id, sink, signal, recipientSecret) {
|
|
|
4998
4998
|
}
|
|
4999
4999
|
async function exportChecked(transport, app, id, sink, signal, recipientSecret) {
|
|
5000
5000
|
const recipient = await x25519KeyPair(recipientSecret);
|
|
5001
|
-
const answer = checked(
|
|
5002
|
-
await transport.json("POST", routePath("apps/{app}/files/{id}/export", { app, id }), {
|
|
5003
|
-
body: { recipient: hex(recipient.publicKey) },
|
|
5004
|
-
signal
|
|
5005
|
-
})
|
|
5006
|
-
);
|
|
5001
|
+
const answer = checked(await transport.exportsExport({ app, id, recipient: hex(recipient.publicKey) }, { signal }));
|
|
5007
5002
|
const { segments, named } = answer;
|
|
5008
5003
|
if (segments.length === 0 || hex(await fileId(segments)) !== hex(named) || hex(named) !== id) {
|
|
5009
5004
|
throw new ExportError("NOT_THE_FILE", `the node answered segments that are not the file ${id}`);
|
|
@@ -5534,17 +5529,20 @@ var CalimeroClient = class _CalimeroClient {
|
|
|
5534
5529
|
async downloadBlob(app, id) {
|
|
5535
5530
|
return new Uint8Array(await (await this.apps.blobDownload({ app, id })).arrayBuffer());
|
|
5536
5531
|
}
|
|
5532
|
+
get exportClient() {
|
|
5533
|
+
return { exportsExport: this.apps.exportsExport, request: this.transport.request.bind(this.transport) };
|
|
5534
|
+
}
|
|
5537
5535
|
/**
|
|
5538
5536
|
* Write the plaintext of sealed file `id` of component app `app` to `sink`, checked against its id,
|
|
5539
5537
|
* size and hash. On rejection, discard what `sink` received: it is authentic but may be a prefix of
|
|
5540
5538
|
* the file. A failed check is an `ExportError`; `signal` aborts the download.
|
|
5541
5539
|
*/
|
|
5542
5540
|
exportFileTo(app, id, sink, signal) {
|
|
5543
|
-
return exportFileTo(this.
|
|
5541
|
+
return exportFileTo(this.exportClient, app, id, sink, signal);
|
|
5544
5542
|
}
|
|
5545
5543
|
/** The plaintext of sealed file `id` of component app `app`, in memory; use {@link exportFileTo} for a large one. */
|
|
5546
5544
|
exportFile(app, id, signal) {
|
|
5547
|
-
return exportFile(this.
|
|
5545
|
+
return exportFile(this.exportClient, app, id, signal);
|
|
5548
5546
|
}
|
|
5549
5547
|
/**
|
|
5550
5548
|
* Download a component app's blob with a grant one of its runs handed out
|