@tinycloud/node-sdk 3.2.2-beta.0 → 3.2.3-beta.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/{WasmKeyProvider-DRlOpvpG.d.cts → WasmKeyProvider-LXRTjZTA.d.cts} +8 -0
- package/dist/{WasmKeyProvider-DRlOpvpG.d.ts → WasmKeyProvider-LXRTjZTA.d.ts} +8 -0
- package/dist/core.cjs +28 -0
- package/dist/core.cjs.map +1 -1
- package/dist/core.d.cts +1 -1
- package/dist/core.d.ts +1 -1
- package/dist/core.js +28 -0
- package/dist/core.js.map +1 -1
- package/dist/index.cjs +26 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +26 -0
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
|
@@ -18329,6 +18329,7 @@ function deserializeDelegation(data) {
|
|
|
18329
18329
|
}
|
|
18330
18330
|
|
|
18331
18331
|
// src/TinyCloudNode.ts
|
|
18332
|
+
var import_siwe2 = require("siwe");
|
|
18332
18333
|
init_config();
|
|
18333
18334
|
|
|
18334
18335
|
// src/replication/module-registry.ts
|
|
@@ -24131,6 +24132,31 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
24131
24132
|
}
|
|
24132
24133
|
};
|
|
24133
24134
|
}
|
|
24135
|
+
/**
|
|
24136
|
+
* Sign a wallet (CACAO) revocation of the delegation `cid` for the node's
|
|
24137
|
+
* `POST /revoke`, and return its Authorization header value. The node
|
|
24138
|
+
* accepts it when the owner delegated `cid` or owns a space its abilities
|
|
24139
|
+
* target, whichever key issued it. Valid for 60 seconds. Requires the
|
|
24140
|
+
* owner wallet signer.
|
|
24141
|
+
*/
|
|
24142
|
+
async signOwnerRevocation(cid) {
|
|
24143
|
+
if (!this.signer) throw new Error("Owner wallet signer is required");
|
|
24144
|
+
const session = this.currentTinyCloudSession();
|
|
24145
|
+
if (!session) throw new Error("Owner session is required");
|
|
24146
|
+
const issuedAt = /* @__PURE__ */ new Date();
|
|
24147
|
+
const siwe = new import_siwe2.SiweMessage({
|
|
24148
|
+
domain: this.siweDomain,
|
|
24149
|
+
address: this.wasmBindings.ensureEip55(session.address),
|
|
24150
|
+
uri: `ucan:${cid}`,
|
|
24151
|
+
version: "1",
|
|
24152
|
+
chainId: session.chainId,
|
|
24153
|
+
nonce: (0, import_siwe2.generateNonce)(),
|
|
24154
|
+
issuedAt: issuedAt.toISOString(),
|
|
24155
|
+
expirationTime: new Date(issuedAt.getTime() + 6e4).toISOString()
|
|
24156
|
+
}).prepareMessage();
|
|
24157
|
+
const signature2 = await this.signer.signMessage(siwe);
|
|
24158
|
+
return this.wasmBindings.siweToDelegationHeaders({ siwe, signature: signature2 }).Authorization;
|
|
24159
|
+
}
|
|
24134
24160
|
/** Register a signed policy and sibling roots with this Node's Policy/v3 runtime. */
|
|
24135
24161
|
async registerPolicy(params) {
|
|
24136
24162
|
this._serviceGraph.assertActive();
|