@storacha/clawracha 0.3.12 → 0.3.14
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/commands.d.ts.map +1 -1
- package/dist/commands.js +13 -1
- package/dist/utils/bundle.d.ts +7 -0
- package/dist/utils/bundle.d.ts.map +1 -1
- package/dist/utils/bundle.js +1 -0
- package/package.json +1 -1
package/dist/commands.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../src/commands.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,KAAK,EAAE,YAAY,
|
|
1
|
+
{"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../src/commands.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,KAAK,EAAE,YAAY,EAAe,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpF,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAoB3C,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,UAAU,CAAC;IACnB,OAAO,EAAE,WAAW,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;CACjB;AAID,wBAAsB,gBAAgB,CACpC,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC,CAS9B;AAED,wBAAsB,gBAAgB,CACpC,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,YAAY,GACnB,OAAO,CAAC,IAAI,CAAC,CAKf;AAED,wBAAsB,sBAAsB,CAC1C,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,MAAM,EACf,aAAa,E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,SAAS,EAAE,MAAM,EACjB,YAAY,EAAE,OAAO,CAAC,gBAAgB,CAAC,EACvC,aAAa,CAAC,EAAE,WAAW,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC,GACrD,OAAO,CAAC,UAAU,CAAC,CAkErB;AAED,wBAAsB,OAAO,CAC3B,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,OAAO,MAAM,IAAI,MAAM,EAAE,GACnC,OAAO,CAAC,UAAU,CAAC,CAyDrB"}
|
package/dist/commands.js
CHANGED
|
@@ -14,6 +14,9 @@ import { createDelegationBundle, extractDelegationBundle, } from "./utils/bundle
|
|
|
14
14
|
import { Agent, Name } from "@storacha/ucn/pail";
|
|
15
15
|
import { extract } from "@storacha/client/delegation";
|
|
16
16
|
import { delegate } from "@ucanto/core";
|
|
17
|
+
import { CID } from "multiformats/basics";
|
|
18
|
+
import { base64 } from "multiformats/bases/base64";
|
|
19
|
+
import { identity } from "multiformats/hashes/identity";
|
|
17
20
|
// --- Config helpers ---
|
|
18
21
|
export async function loadDeviceConfig(workspace) {
|
|
19
22
|
const configPath = path.join(workspace, ".storacha", "config.json");
|
|
@@ -213,7 +216,12 @@ async function readBundleArg(arg) {
|
|
|
213
216
|
throw err;
|
|
214
217
|
}
|
|
215
218
|
// Try as base64
|
|
216
|
-
|
|
219
|
+
const cid = CID.parse(arg, base64);
|
|
220
|
+
if (cid.multihash.code !== identity.code) {
|
|
221
|
+
console.error(`Error: failed to read proof. Must be identity CID. Fetching of remote proof CARs not supported by this command yet`);
|
|
222
|
+
throw new Error("Invalid proof CAR argument");
|
|
223
|
+
}
|
|
224
|
+
return cid.multihash.digest;
|
|
217
225
|
}
|
|
218
226
|
export async function doJoin(workspace, agentId, bundleArg, pluginConfig, gatewayConfig) {
|
|
219
227
|
const deviceConfig = await loadDeviceConfig(workspace);
|
|
@@ -244,6 +252,9 @@ export async function doJoin(workspace, agentId, bundleArg, pluginConfig, gatewa
|
|
|
244
252
|
deviceConfig.nameDelegation = encodeDelegation(bundle.name);
|
|
245
253
|
deviceConfig.planDelegation = encodeDelegation(bundle.plan);
|
|
246
254
|
deviceConfig.spaceDID = spaceDID ?? undefined;
|
|
255
|
+
if (bundle.access) {
|
|
256
|
+
deviceConfig.access = bundle.access;
|
|
257
|
+
}
|
|
247
258
|
deviceConfig.setupComplete = true;
|
|
248
259
|
await saveDeviceConfig(workspace, deviceConfig);
|
|
249
260
|
// One-shot sync: pull remote, stop
|
|
@@ -318,5 +329,6 @@ export async function doGrant(workspace, targetDID) {
|
|
|
318
329
|
upload: uploadArchive,
|
|
319
330
|
name: nameArchive,
|
|
320
331
|
plan: planArchive,
|
|
332
|
+
access: deviceConfig.access,
|
|
321
333
|
});
|
|
322
334
|
}
|
package/dist/utils/bundle.d.ts
CHANGED
|
@@ -6,6 +6,13 @@ export interface DelegationBundle {
|
|
|
6
6
|
upload: Uint8Array;
|
|
7
7
|
name: Uint8Array;
|
|
8
8
|
plan: Uint8Array;
|
|
9
|
+
access?: {
|
|
10
|
+
type: string;
|
|
11
|
+
encryption?: {
|
|
12
|
+
provider: string;
|
|
13
|
+
algorithm: string;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
9
16
|
}
|
|
10
17
|
/**
|
|
11
18
|
* Pack three delegation archives into a single CAR file.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bundle.d.ts","sourceRoot":"","sources":["../../src/utils/bundle.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAQH,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,UAAU,CAAC;IACnB,IAAI,EAAE,UAAU,CAAC;IACjB,IAAI,EAAE,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"bundle.d.ts","sourceRoot":"","sources":["../../src/utils/bundle.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAQH,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,UAAU,CAAC;IACnB,IAAI,EAAE,UAAU,CAAC;IACjB,IAAI,EAAE,UAAU,CAAC;IACjB,MAAM,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,UAAU,CAAC,EAAE;YAAE,QAAQ,EAAE,MAAM,CAAC;YAAC,SAAS,EAAE,MAAM,CAAA;SAAE,CAAA;KAAE,CAAC;CACjF;AAED;;;GAGG;AACH,wBAAsB,sBAAsB,CAC1C,MAAM,EAAE,gBAAgB,GACvB,OAAO,CAAC,UAAU,CAAC,CA2BrB;AAED;;GAEG;AACH,wBAAsB,uBAAuB,CAC3C,QAAQ,EAAE,UAAU,GACnB,OAAO,CAAC,gBAAgB,CAAC,CAyB3B"}
|
package/dist/utils/bundle.js
CHANGED