@tinycloud/node-sdk 3.11.0-beta.0 → 3.11.0-beta.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/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 +25 -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 +27 -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 +25 -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 +27 -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 +2 -2
|
@@ -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);
|
|
@@ -25552,6 +25563,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
25552
25563
|
// DID here and rejects the fragment as an invalid audience DID.
|
|
25553
25564
|
verificationMethod: params.session.verificationMethod.split("#", 1)[0]
|
|
25554
25565
|
};
|
|
25566
|
+
(0, import_sdk_core10.assertExpiryWithinTechnicalLimit)(params.expirationSecs * 1e3, "ucan");
|
|
25555
25567
|
const result = this.wasmBindings.createDelegation(
|
|
25556
25568
|
wasmSession,
|
|
25557
25569
|
params.delegateDID,
|
|
@@ -25584,9 +25596,10 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
25584
25596
|
}
|
|
25585
25597
|
const permissions = ownerDelegationPermissions(params);
|
|
25586
25598
|
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
|
|
25599
|
+
if (!(params.expiresAt instanceof Date) || params.expiresAt.getTime() <= now.getTime()) {
|
|
25600
|
+
throw new Error("Owner delegation expiry must be explicit, future, and a valid date");
|
|
25589
25601
|
}
|
|
25602
|
+
(0, import_sdk_core10.assertExpiryWithinTechnicalLimit)(params.expiresAt, "siwe");
|
|
25590
25603
|
if (!this.signer) throw new Error("Owner wallet signer is required");
|
|
25591
25604
|
const session = this.currentTinyCloudSession();
|
|
25592
25605
|
if (!session) throw new Error("Owner session is required");
|
|
@@ -25687,6 +25700,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
25687
25700
|
* not sent.
|
|
25688
25701
|
*/
|
|
25689
25702
|
async authorizeShareDeliveryV3(input) {
|
|
25703
|
+
(0, import_sdk_core10.assertExpiryWithinTechnicalLimit)(new Date(input.expiresAt), "siwe");
|
|
25690
25704
|
const envelopeRef = await (0, import_sdk_core10.shortDeliveryLinkBodyCid)(input.shareUrl, input.trustedOrigins);
|
|
25691
25705
|
const session = this.currentTinyCloudSession();
|
|
25692
25706
|
const serviceSession = this._serviceContext?.session;
|
|
@@ -25739,6 +25753,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
25739
25753
|
};
|
|
25740
25754
|
}
|
|
25741
25755
|
async createRootDelegationForSharing(params, assertActive) {
|
|
25756
|
+
(0, import_sdk_core10.assertExpiryWithinTechnicalLimit)(params.requestedExpiry, "siwe");
|
|
25742
25757
|
try {
|
|
25743
25758
|
return (await this.createOwnerDelegation({
|
|
25744
25759
|
delegateDid: params.shareKeyDID,
|
|
@@ -26435,6 +26450,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
26435
26450
|
if (sessionExpiry !== void 0 && sessionExpiry < expiresAt) {
|
|
26436
26451
|
expiresAt = sessionExpiry;
|
|
26437
26452
|
}
|
|
26453
|
+
(0, import_sdk_core10.assertExpiryWithinTechnicalLimit)(expiresAt, "siwe");
|
|
26438
26454
|
const delegations = [];
|
|
26439
26455
|
let rawEntriesAttached = false;
|
|
26440
26456
|
for (const [spaceId, entries] of bySpace) {
|
|
@@ -27907,6 +27923,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
27907
27923
|
const now = /* @__PURE__ */ new Date();
|
|
27908
27924
|
const expiryMs = params.expiryMs ?? 60 * 60 * 1e3;
|
|
27909
27925
|
const expirationTime = new Date(now.getTime() + expiryMs);
|
|
27926
|
+
(0, import_sdk_core10.assertExpiryWithinTechnicalLimit)(expirationTime, "siwe");
|
|
27910
27927
|
const prepared = this.wasmBindings.prepareSession({
|
|
27911
27928
|
abilities,
|
|
27912
27929
|
address: this.wasmBindings.ensureEip55(session.address),
|
|
@@ -28061,6 +28078,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
28061
28078
|
const { abilities, rawAbilities } = this.buildActivationAbilities(delegation);
|
|
28062
28079
|
const now = /* @__PURE__ */ new Date();
|
|
28063
28080
|
const expirationTime = delegation.expiry;
|
|
28081
|
+
(0, import_sdk_core10.assertExpiryWithinTechnicalLimit)(expirationTime, "siwe");
|
|
28064
28082
|
const prepared = this.wasmBindings.prepareSession({
|
|
28065
28083
|
abilities,
|
|
28066
28084
|
address: this.wasmBindings.ensureEip55(mySession.address),
|
|
@@ -28180,6 +28198,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
28180
28198
|
const now = /* @__PURE__ */ new Date();
|
|
28181
28199
|
const requestedExpiry = params.expiryMs === void 0 ? parentDelegation.expiry : new Date(now.getTime() + params.expiryMs);
|
|
28182
28200
|
const actualExpiry = requestedExpiry > parentDelegation.expiry ? parentDelegation.expiry : requestedExpiry;
|
|
28201
|
+
(0, import_sdk_core10.assertExpiryWithinTechnicalLimit)(actualExpiry, "siwe");
|
|
28183
28202
|
const abilities = {};
|
|
28184
28203
|
const rawAbilities = {};
|
|
28185
28204
|
for (const resource of requestedResources) {
|