@tinycloud/node-sdk 3.8.0-beta.11 → 3.8.0-beta.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.
@@ -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-BVDUdEcf.cjs';
3
+ import { T as TinyCloudNode } from './TinyCloudNode-DLuN31i0.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-jMK_2Uj8.js';
3
+ import { T as TinyCloudNode } from './TinyCloudNode-DfuhkGz7.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
@@ -17968,6 +17968,7 @@ __export(src_exports, {
17968
17968
  hexDecode: () => import_sdk_core22.hexDecode,
17969
17969
  hexEncode: () => import_sdk_core22.hexEncode,
17970
17970
  installTinyCloudDebugGlobals: () => import_sdk_core16.installTinyCloudDebugGlobals,
17971
+ isAppKeyHostBound: () => isAppKeyHostBound,
17971
17972
  isCapabilitySubset: () => import_sdk_core17.isCapabilitySubset,
17972
17973
  isEvmAddress: () => import_sdk_core16.isEvmAddress,
17973
17974
  isNetworkId: () => import_sdk_core22.isNetworkId,
@@ -18862,6 +18863,18 @@ function appKeyHostBinding(domain, appId) {
18862
18863
  const reversed = labels.reverse().join(".");
18863
18864
  return appId === reversed || appId.startsWith(`${reversed}.`);
18864
18865
  }
18866
+ function isAppKeyHostBound(keysAppId, origin) {
18867
+ if (typeof origin === "string" && !origin.includes("://")) {
18868
+ return appKeyHostBinding(origin, keysAppId);
18869
+ }
18870
+ let url;
18871
+ try {
18872
+ url = typeof origin === "string" ? new URL(origin) : origin;
18873
+ } catch {
18874
+ return false;
18875
+ }
18876
+ return appKeyHostBinding(url.host, keysAppId);
18877
+ }
18865
18878
 
18866
18879
  // src/authorization/NodeUserAuthorization.ts
18867
18880
  init_authority_sign_in();
@@ -24342,6 +24355,7 @@ var _TinyCloudNode = class _TinyCloudNode {
24342
24355
  invoke: graph.invoke,
24343
24356
  invokeAny: graph.invokeAny,
24344
24357
  signOwnerRevocation: this.signer ? (cid) => this.signOwnerRevocation(cid) : void 0,
24358
+ sessionInvocationSigner: this.sessionInvocationSignerFor(input.serviceSession),
24345
24359
  fetch: graph.fetch
24346
24360
  });
24347
24361
  const keyProvider = new WasmKeyProvider({ sessionManager: input.manager });
@@ -24557,6 +24571,31 @@ var _TinyCloudNode = class _TinyCloudNode {
24557
24571
  if (session === void 0) throw new Error("Not signed in. Call signIn() first.");
24558
24572
  return signBytesWithJwk(bytes, session.jwk);
24559
24573
  }
24574
+ /**
24575
+ * Signs proofless invocations with `session`'s own did:key, for the node's
24576
+ * issued-delegation list and revocation by the delegator. The audience is
24577
+ * this Node's DID; each invocation lives 60 seconds.
24578
+ */
24579
+ sessionInvocationSignerFor(session) {
24580
+ return {
24581
+ did: () => session.verificationMethod.split("#", 1)[0],
24582
+ sign: async (attenuation) => {
24583
+ const now = Math.floor(Date.now() / 1e3);
24584
+ const invocation = await (0, import_sdk_core10.signCompactUcanAuthorization)({
24585
+ issuerDid: session.verificationMethod.split("#", 1)[0],
24586
+ audienceDid: await this.fetchNodeId(),
24587
+ attenuation,
24588
+ facts: [{}],
24589
+ proofs: [],
24590
+ notBefore: now,
24591
+ expiresAt: now + 60,
24592
+ nonce: `urn:uuid:${crypto.randomUUID()}`,
24593
+ sign: (bytes) => signBytesWithJwk(bytes, session.jwk)
24594
+ });
24595
+ return invocation.authorization;
24596
+ }
24597
+ };
24598
+ }
24560
24599
  /** Author a proofless Policy/v3 owner root with the authenticated holder key. */
24561
24600
  async createUnifiedOwnerRoot(input) {
24562
24601
  const ownerDid = this.credentialHolderDid;
@@ -25264,6 +25303,7 @@ var _TinyCloudNode = class _TinyCloudNode {
25264
25303
  invoke: graph.invoke,
25265
25304
  invokeAny: graph.invokeAny,
25266
25305
  signOwnerRevocation: this.signer ? (cid) => this.signOwnerRevocation(cid) : void 0,
25306
+ sessionInvocationSigner: this.sessionInvocationSignerFor(serviceSession),
25267
25307
  fetch: graph.fetch
25268
25308
  });
25269
25309
  this._spaceService = new import_sdk_core10.SpaceService({
@@ -30904,6 +30944,7 @@ function sqliteReplicaStorage(options) {
30904
30944
  hexDecode,
30905
30945
  hexEncode,
30906
30946
  installTinyCloudDebugGlobals,
30947
+ isAppKeyHostBound,
30907
30948
  isCapabilitySubset,
30908
30949
  isEvmAddress,
30909
30950
  isNetworkId,