@tinycloud/cli 1.2.2-beta.3 → 1.2.2-beta.4

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.
@@ -21023,7 +21023,7 @@ init_constants();
21023
21023
  init_profiles();
21024
21024
  init_errors();
21025
21025
  init_space();
21026
- import { isLocalOwnerProfile as isLocalOwnerProfile3 } from "@tinycloud/operations/profile";
21026
+ import { isLocalOwnerProfile as isLocalOwnerProfile3, ownerSessionLacksProof as ownerSessionLacksProof3 } from "@tinycloud/operations/profile";
21027
21027
  import { ProfileLockTimeoutError as ProfileLockTimeoutError2 } from "@tinycloud/operations/state";
21028
21028
  function assertNotLocalOwner(profileName2, profile, flow) {
21029
21029
  if (profile === null || !isLocalOwnerProfile3(profile)) return;
@@ -21070,6 +21070,7 @@ function assertSessionReplaceable(profileName2, snapshot, ownerDid, scope, newEx
21070
21070
  }
21071
21071
  const { session } = snapshot;
21072
21072
  if (session === null) return;
21073
+ if (ownerSessionLacksProof3(session, snapshot.profile)) return;
21073
21074
  const expiresAt = sessionExpiresAt(session);
21074
21075
  if (expiresAt !== null && Date.parse(expiresAt) <= Date.now()) return;
21075
21076
  const held = Array.isArray(session.permissions) ? session.permissions.filter((permission) => ownerDid === void 0 || typeof session.spaceId !== "string" || !isLegacyNestedDecrypt(permission, scope, ownerDid, session.spaceId)) : void 0;
@@ -25054,6 +25055,7 @@ import {
25054
25055
  readSession as readSession2,
25055
25056
  withProfileLock as withProfileLock5
25056
25057
  } from "@tinycloud/operations/state";
25058
+ import { ownerSessionLacksProof as ownerSessionLacksProof4 } from "@tinycloud/operations/profile";
25057
25059
  init_profiles();
25058
25060
  init_constants();
25059
25061
  init_errors();
@@ -25178,7 +25180,10 @@ async function createReplica(profile, config) {
25178
25180
  async function storedGrants(profile) {
25179
25181
  const authorizations = [];
25180
25182
  const session = await readSession2(profile).catch(() => null);
25181
- if (typeof session?.delegationHeader?.Authorization === "string") authorizations.push(session.delegationHeader.Authorization);
25183
+ const config = await ProfileManager.getProfile(profile).catch(() => null);
25184
+ if (typeof session?.delegationHeader?.Authorization === "string" && !ownerSessionLacksProof4(session, config)) {
25185
+ authorizations.push(session.delegationHeader.Authorization);
25186
+ }
25182
25187
  const records = await readAdditionalDelegations2(profile).catch(
25183
25188
  () => []
25184
25189
  );
@@ -25652,7 +25657,7 @@ import { join as join11 } from "path";
25652
25657
  import { homedir, hostname, userInfo } from "os";
25653
25658
  import { appSecretScope } from "@tinycloud/sdk-core";
25654
25659
  import { invokeOperation as invokeOperation2 } from "@tinycloud/operations";
25655
- import { isLocalOwnerProfile as isLocalOwnerProfile4 } from "@tinycloud/operations/profile";
25660
+ import { isLocalOwnerProfile as isLocalOwnerProfile4, ownerSessionLacksProof as ownerSessionLacksProof5 } from "@tinycloud/operations/profile";
25656
25661
  import {
25657
25662
  buildSecretManagerUrl,
25658
25663
  buildSecretRequestUrl as buildSecretRequestUrl2,
@@ -26187,11 +26192,11 @@ async function ensureSecretsNode(ctx, options, openKeyAcquisition, selectedProfi
26187
26192
  const profile = selectedProfile ?? await ProfileManager.getProfile(ctx.profile).catch(() => null);
26188
26193
  if (profile?.authMethod === "openkey" && canRequestOwnerPermissions(profile)) {
26189
26194
  const session = await ProfileManager.getSession(ctx.profile);
26190
- if (!session || isStoredSessionExpired(session)) {
26195
+ if (!session || isStoredSessionExpired(session) || ownerSessionLacksProof5(session, profile)) {
26191
26196
  if (!process.stdin.isTTY && !process.stderr.isTTY) {
26192
26197
  throw new CLIError(
26193
26198
  "AUTH_REQUIRED",
26194
- `Profile "${ctx.profile}" has ${session ? "an expired" : "no"} OpenKey session; headless secret access cannot open a browser login.`,
26199
+ `Profile "${ctx.profile}" has ${session ? "an expired or unverified" : "no"} OpenKey session; headless secret access cannot open a browser login.`,
26195
26200
  ExitCode.AUTH_REQUIRED,
26196
26201
  { hint: scopedSecretLoginHint(ctx.profile) }
26197
26202
  );
@@ -26299,7 +26304,7 @@ async function canonicalSecretGet(params, collect) {
26299
26304
  throw sessionExpiredError(params.ctx.profile, posture);
26300
26305
  }
26301
26306
  if (profile2.authMethod === "openkey" && canRequestOwnerPermissions(profile2)) {
26302
- if (!session || isStoredSessionExpired(session)) {
26307
+ if (!session || isStoredSessionExpired(session) || ownerSessionLacksProof5(session, profile2)) {
26303
26308
  ownerNode = await ensureSecretsNode(params.ctx, params.options, params.openKeyAcquisition, profile2);
26304
26309
  }
26305
26310
  }
@@ -36547,7 +36552,7 @@ init_permissions();
36547
36552
  import {
36548
36553
  NodeWasmBindings as NodeWasmBindings2
36549
36554
  } from "@tinycloud/node-sdk";
36550
- import { ownerSessionLacksProof as ownerSessionLacksProof3 } from "@tinycloud/operations/profile";
36555
+ import { ownerSessionLacksProof as ownerSessionLacksProof6 } from "@tinycloud/operations/profile";
36551
36556
  var wasmBindings = null;
36552
36557
  function registerStatusCommand(program) {
36553
36558
  program.command("status").description("Show local TinyCloud profile, session, delegation, and permission state").action(async (_options, cmd) => {
@@ -36614,7 +36619,7 @@ async function inspectProfile(params) {
36614
36619
  ]);
36615
36620
  const hasPrivateKey = typeof profile?.privateKey === "string" && profile.privateKey.length > 0;
36616
36621
  const localKeyAuthenticated = profile?.authMethod === "local" && hasPrivateKey;
36617
- const sessionAuthenticated = session !== null && sessionExpired !== true && !ownerSessionLacksProof3(session, profile);
36622
+ const sessionAuthenticated = session !== null && sessionExpired !== true && !ownerSessionLacksProof6(session, profile);
36618
36623
  const authenticated = localKeyAuthenticated || sessionAuthenticated;
36619
36624
  const status = resolveStatus({
36620
36625
  exists: profile !== null,