@tinycloud/cli 1.0.0-beta.21 → 1.0.0-beta.23

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/index.js CHANGED
@@ -5590,6 +5590,23 @@ var init_zod = __esm({
5590
5590
  }
5591
5591
  });
5592
5592
 
5593
+ // src/lib/raw-encryption.ts
5594
+ var init_raw_encryption = __esm({
5595
+ "src/lib/raw-encryption.ts"() {
5596
+ "use strict";
5597
+ }
5598
+ });
5599
+
5600
+ // src/lib/owner-did.ts
5601
+ import { ensureEip55 } from "@tinycloud/node-sdk-wasm";
5602
+ var init_owner_did = __esm({
5603
+ "src/lib/owner-did.ts"() {
5604
+ "use strict";
5605
+ init_constants();
5606
+ init_errors();
5607
+ }
5608
+ });
5609
+
5593
5610
  // src/share/publishing-manifest.ts
5594
5611
  var init_publishing_manifest = __esm({
5595
5612
  "src/share/publishing-manifest.ts"() {
@@ -5641,6 +5658,8 @@ var init_permissions = __esm({
5641
5658
  init_errors();
5642
5659
  init_constants();
5643
5660
  init_space();
5661
+ init_raw_encryption();
5662
+ init_owner_did();
5644
5663
  init_publishing_manifest();
5645
5664
  init_types();
5646
5665
  }
@@ -14003,6 +14022,7 @@ function targetMatcher(target) {
14003
14022
  function targetKind(target) {
14004
14023
  return target.kind;
14005
14024
  }
14025
+ var OWNER_SHARE_ACTIONS = /* @__PURE__ */ new Set(["tinycloud.kv/get", "tinycloud.kv/list", "tinycloud.kv/metadata", "tinycloud.kv/put"]);
14006
14026
  function assertSafeInput(input) {
14007
14027
  if (!/^[A-Za-z0-9_-]{16,128}$/.test(input.shareId)) throw new TypeError("addressed share id is invalid");
14008
14028
  if (!Number.isSafeInteger(input.byteLength) || input.byteLength < 0 || input.byteLength > SHARE_CONTENT_LIMIT) throw new TypeError("addressed content length is invalid");
@@ -14126,12 +14146,12 @@ function prepareAddressedShare(request) {
14126
14146
  throw new TypeError("addressed filename is invalid");
14127
14147
  }
14128
14148
  if (request.actions.length === 0 || request.policyActions.length === 0) throw new TypeError("addressed share actions are empty");
14149
+ if (request.policyActions.some((action) => !OWNER_SHARE_ACTIONS.has(action))) throw new TypeError("addressed share action is not supported");
14129
14150
  const target = normalizeShareTarget(request.target);
14130
14151
  if (target.kind === "bearer") throw new TypeError("addressed target is required");
14131
14152
  if (target.kind === "recipientDid") return { target };
14132
- if (target.kind === "emailDomain") {
14133
- if (!request.actions.every((action) => action === "read" || action === "list") || !request.policyActions.every((action) => action === "tinycloud.kv/get" || action === "tinycloud.kv/list" || action === "tinycloud.kv/metadata")) throw new TypeError("email-domain shares are view-only");
14134
- if (request.deliveryEmail !== void 0) throw new TypeError("email-domain shares are not emailed");
14153
+ if (target.kind === "emailDomain" && request.deliveryEmail !== void 0 && (request.deliveryEmail !== request.deliveryEmail.toLowerCase() || !request.deliveryEmail.endsWith(`@${target.domain}`))) {
14154
+ throw new TypeError("email-domain delivery address must be a lowercase mailbox at the domain");
14135
14155
  }
14136
14156
  return { target, credentialRequirement: mailboxCredentialCommitment(target) };
14137
14157
  }