@tinycloud/node-sdk 3.11.0-beta.0 → 3.11.0-beta.2
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/{TinyCloudNode-BpolXzu5.d.ts → TinyCloudNode-BlNcvo1c.d.ts} +7 -0
- package/dist/{TinyCloudNode-wAQN1Ndh.d.cts → TinyCloudNode-CnVaWnAX.d.cts} +7 -0
- package/dist/{authority-C0JKqTwY.d.cts → authority-B2SLx27M.d.cts} +1 -1
- package/dist/{authority-Cj8MLCkr.d.ts → authority-DHIk5QvV.d.ts} +1 -1
- package/dist/core.cjs +26 -6
- package/dist/core.cjs.map +1 -1
- package/dist/core.d.cts +2 -2
- package/dist/core.d.ts +2 -2
- package/dist/core.js +28 -6
- package/dist/core.js.map +1 -1
- package/dist/encryption-keys.d.cts +1 -1
- package/dist/encryption-keys.d.ts +1 -1
- package/dist/index.cjs +26 -6
- 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 +28 -6
- package/dist/index.js.map +1 -1
- package/dist/replication/authority.d.cts +2 -2
- package/dist/replication/authority.d.ts +2 -2
- package/package.json +4 -4
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { NamedKeyClient } from '@tinycloud/sdk-services/encryption/named-keys';
|
|
2
2
|
export { DecryptManyResult, KeyCallOptions, KeyDescriptor, KeyEncryptOptions, NamedKeyClient, NamedKeyEnvelope, NamedKeyError, NamedKeyErrorCode, PublicKeyDescriptor, buildKeyAdminFacts, buildKeyDescribeFacts } from '@tinycloud/sdk-services/encryption/named-keys';
|
|
3
|
-
import { T as TinyCloudNode } from './TinyCloudNode-
|
|
3
|
+
import { T as TinyCloudNode } from './TinyCloudNode-CnVaWnAX.cjs';
|
|
4
4
|
import '@tinycloud/sdk-core';
|
|
5
5
|
import '@tinycloud/sdk-services/kv/replication';
|
|
6
6
|
import '@tinycloud/sdk-services';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { NamedKeyClient } from '@tinycloud/sdk-services/encryption/named-keys';
|
|
2
2
|
export { DecryptManyResult, KeyCallOptions, KeyDescriptor, KeyEncryptOptions, NamedKeyClient, NamedKeyEnvelope, NamedKeyError, NamedKeyErrorCode, PublicKeyDescriptor, buildKeyAdminFacts, buildKeyDescribeFacts } from '@tinycloud/sdk-services/encryption/named-keys';
|
|
3
|
-
import { T as TinyCloudNode } from './TinyCloudNode-
|
|
3
|
+
import { T as TinyCloudNode } from './TinyCloudNode-BlNcvo1c.js';
|
|
4
4
|
import '@tinycloud/sdk-core';
|
|
5
5
|
import '@tinycloud/sdk-services/kv/replication';
|
|
6
6
|
import '@tinycloud/sdk-services';
|
package/dist/index.cjs
CHANGED
|
@@ -19952,7 +19952,7 @@ var NodeUserAuthorization = class {
|
|
|
19952
19952
|
}
|
|
19953
19953
|
const jwk = JSON.parse(jwkString);
|
|
19954
19954
|
const now = /* @__PURE__ */ new Date();
|
|
19955
|
-
const expirationTime =
|
|
19955
|
+
const expirationTime = this.sessionExpiryFrom(now);
|
|
19956
19956
|
const primaryIdentity = pkhSpaceIdentity(options.spaceId);
|
|
19957
19957
|
const resourcesBySpace = /* @__PURE__ */ new Map();
|
|
19958
19958
|
for (const resource of options.capabilityRequest.resources) {
|
|
@@ -20007,6 +20007,17 @@ var NodeUserAuthorization = class {
|
|
|
20007
20007
|
signature: signature2
|
|
20008
20008
|
};
|
|
20009
20009
|
}
|
|
20010
|
+
/**
|
|
20011
|
+
* When a session that starts at `now` ends. Refused with a dated message when
|
|
20012
|
+
* the configured lifetime reaches past what a sign-in message can carry,
|
|
20013
|
+
* instead of the bare `RangeError` or WASM parse error `toISOString()` and
|
|
20014
|
+
* `prepareSession` would otherwise give.
|
|
20015
|
+
*/
|
|
20016
|
+
sessionExpiryFrom(now) {
|
|
20017
|
+
const expirationTime = new Date(now.getTime() + this.sessionExpirationMs);
|
|
20018
|
+
(0, import_sdk_core5.assertExpiryWithinTechnicalLimit)(expirationTime, "siwe");
|
|
20019
|
+
return expirationTime;
|
|
20020
|
+
}
|
|
20010
20021
|
persistedData(session, expiresAt, createdAt, replicaStamp) {
|
|
20011
20022
|
return {
|
|
20012
20023
|
address: session.address,
|
|
@@ -20062,7 +20073,7 @@ var NodeUserAuthorization = class {
|
|
|
20062
20073
|
const capabilityPlan = this.resolveSignInCapabilities(address, chainId);
|
|
20063
20074
|
const spaceId = capabilityPlan.spaceId;
|
|
20064
20075
|
const now = /* @__PURE__ */ new Date();
|
|
20065
|
-
const expirationTime =
|
|
20076
|
+
const expirationTime = this.sessionExpiryFrom(now);
|
|
20066
20077
|
const prepared = this.prepareSessionWithResources({
|
|
20067
20078
|
abilities: capabilityPlan.abilities,
|
|
20068
20079
|
...capabilityPlan.spaceAbilities !== void 0 ? { spaceAbilities: capabilityPlan.spaceAbilities } : {},
|
|
@@ -20208,7 +20219,7 @@ var NodeUserAuthorization = class {
|
|
|
20208
20219
|
const capabilityPlan = this.resolveSignInCapabilities(address, chainId);
|
|
20209
20220
|
const spaceId = capabilityPlan.spaceId;
|
|
20210
20221
|
const now = /* @__PURE__ */ new Date();
|
|
20211
|
-
const expirationTime =
|
|
20222
|
+
const expirationTime = this.sessionExpiryFrom(now);
|
|
20212
20223
|
const prepared = this.prepareSessionWithResources({
|
|
20213
20224
|
abilities: capabilityPlan.abilities,
|
|
20214
20225
|
...capabilityPlan.spaceAbilities !== void 0 ? { spaceAbilities: capabilityPlan.spaceAbilities } : {},
|
|
@@ -20271,7 +20282,7 @@ var NodeUserAuthorization = class {
|
|
|
20271
20282
|
siwe: prepared.siwe,
|
|
20272
20283
|
signature: signature2
|
|
20273
20284
|
};
|
|
20274
|
-
const expiresAt = lastAnchoredLine(prepared.siwe ?? "", /^Expiration Time: (.+)$/gm) ?? new Date(
|
|
20285
|
+
const expiresAt = lastAnchoredLine(prepared.siwe ?? "", /^Expiration Time: (.+)$/gm) ?? this.sessionExpiryFrom(/* @__PURE__ */ new Date()).toISOString();
|
|
20275
20286
|
const createdAt = lastAnchoredLine(prepared.siwe ?? "", /^Issued At: (.+)$/gm) ?? (/* @__PURE__ */ new Date()).toISOString();
|
|
20276
20287
|
const replicaStamp = await this.establishReplicaStamp?.(tinyCloudSession);
|
|
20277
20288
|
const persistedData = this.persistedData(tinyCloudSession, expiresAt, createdAt, replicaStamp);
|
|
@@ -21527,6 +21538,7 @@ var ServiceGraphLifetime = class {
|
|
|
21527
21538
|
}
|
|
21528
21539
|
combineSignals(signal) {
|
|
21529
21540
|
if (!signal) return this.abortController.signal;
|
|
21541
|
+
if (typeof AbortSignal.any === "function") return AbortSignal.any([signal, this.abortController.signal]);
|
|
21530
21542
|
const combined = new AbortController();
|
|
21531
21543
|
const abort = () => combined.abort();
|
|
21532
21544
|
if (signal.aborted || this.abortController.signal.aborted) {
|
|
@@ -25552,6 +25564,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
25552
25564
|
// DID here and rejects the fragment as an invalid audience DID.
|
|
25553
25565
|
verificationMethod: params.session.verificationMethod.split("#", 1)[0]
|
|
25554
25566
|
};
|
|
25567
|
+
(0, import_sdk_core10.assertExpiryWithinTechnicalLimit)(params.expirationSecs * 1e3, "ucan");
|
|
25555
25568
|
const result = this.wasmBindings.createDelegation(
|
|
25556
25569
|
wasmSession,
|
|
25557
25570
|
params.delegateDID,
|
|
@@ -25584,9 +25597,10 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
25584
25597
|
}
|
|
25585
25598
|
const permissions = ownerDelegationPermissions(params);
|
|
25586
25599
|
const now = /* @__PURE__ */ new Date();
|
|
25587
|
-
if (!(params.expiresAt instanceof Date) || params.expiresAt.getTime() <= now.getTime()
|
|
25588
|
-
throw new Error("Owner delegation expiry must be explicit, future, and
|
|
25600
|
+
if (!(params.expiresAt instanceof Date) || params.expiresAt.getTime() <= now.getTime()) {
|
|
25601
|
+
throw new Error("Owner delegation expiry must be explicit, future, and a valid date");
|
|
25589
25602
|
}
|
|
25603
|
+
(0, import_sdk_core10.assertExpiryWithinTechnicalLimit)(params.expiresAt, "siwe");
|
|
25590
25604
|
if (!this.signer) throw new Error("Owner wallet signer is required");
|
|
25591
25605
|
const session = this.currentTinyCloudSession();
|
|
25592
25606
|
if (!session) throw new Error("Owner session is required");
|
|
@@ -25687,6 +25701,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
25687
25701
|
* not sent.
|
|
25688
25702
|
*/
|
|
25689
25703
|
async authorizeShareDeliveryV3(input) {
|
|
25704
|
+
(0, import_sdk_core10.assertExpiryWithinTechnicalLimit)(new Date(input.expiresAt), "siwe");
|
|
25690
25705
|
const envelopeRef = await (0, import_sdk_core10.shortDeliveryLinkBodyCid)(input.shareUrl, input.trustedOrigins);
|
|
25691
25706
|
const session = this.currentTinyCloudSession();
|
|
25692
25707
|
const serviceSession = this._serviceContext?.session;
|
|
@@ -25739,6 +25754,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
25739
25754
|
};
|
|
25740
25755
|
}
|
|
25741
25756
|
async createRootDelegationForSharing(params, assertActive) {
|
|
25757
|
+
(0, import_sdk_core10.assertExpiryWithinTechnicalLimit)(params.requestedExpiry, "siwe");
|
|
25742
25758
|
try {
|
|
25743
25759
|
return (await this.createOwnerDelegation({
|
|
25744
25760
|
delegateDid: params.shareKeyDID,
|
|
@@ -26435,6 +26451,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
26435
26451
|
if (sessionExpiry !== void 0 && sessionExpiry < expiresAt) {
|
|
26436
26452
|
expiresAt = sessionExpiry;
|
|
26437
26453
|
}
|
|
26454
|
+
(0, import_sdk_core10.assertExpiryWithinTechnicalLimit)(expiresAt, "siwe");
|
|
26438
26455
|
const delegations = [];
|
|
26439
26456
|
let rawEntriesAttached = false;
|
|
26440
26457
|
for (const [spaceId, entries] of bySpace) {
|
|
@@ -27907,6 +27924,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
27907
27924
|
const now = /* @__PURE__ */ new Date();
|
|
27908
27925
|
const expiryMs = params.expiryMs ?? 60 * 60 * 1e3;
|
|
27909
27926
|
const expirationTime = new Date(now.getTime() + expiryMs);
|
|
27927
|
+
(0, import_sdk_core10.assertExpiryWithinTechnicalLimit)(expirationTime, "siwe");
|
|
27910
27928
|
const prepared = this.wasmBindings.prepareSession({
|
|
27911
27929
|
abilities,
|
|
27912
27930
|
address: this.wasmBindings.ensureEip55(session.address),
|
|
@@ -28061,6 +28079,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
28061
28079
|
const { abilities, rawAbilities } = this.buildActivationAbilities(delegation);
|
|
28062
28080
|
const now = /* @__PURE__ */ new Date();
|
|
28063
28081
|
const expirationTime = delegation.expiry;
|
|
28082
|
+
(0, import_sdk_core10.assertExpiryWithinTechnicalLimit)(expirationTime, "siwe");
|
|
28064
28083
|
const prepared = this.wasmBindings.prepareSession({
|
|
28065
28084
|
abilities,
|
|
28066
28085
|
address: this.wasmBindings.ensureEip55(mySession.address),
|
|
@@ -28180,6 +28199,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
28180
28199
|
const now = /* @__PURE__ */ new Date();
|
|
28181
28200
|
const requestedExpiry = params.expiryMs === void 0 ? parentDelegation.expiry : new Date(now.getTime() + params.expiryMs);
|
|
28182
28201
|
const actualExpiry = requestedExpiry > parentDelegation.expiry ? parentDelegation.expiry : requestedExpiry;
|
|
28202
|
+
(0, import_sdk_core10.assertExpiryWithinTechnicalLimit)(actualExpiry, "siwe");
|
|
28183
28203
|
const abilities = {};
|
|
28184
28204
|
const rawAbilities = {};
|
|
28185
28205
|
for (const resource of requestedResources) {
|