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

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;
@@ -23930,11 +23931,13 @@ function registerDoctorCommand(program) {
23930
23931
  if (profileOk && profileName2) {
23931
23932
  try {
23932
23933
  const session = await ProfileManager.getSession(profileName2);
23933
- const { state: state2, expiresAt } = storedSessionState(session);
23934
+ const profile = await ProfileManager.getProfile(profileName2);
23935
+ const { state: state2, expiresAt } = storedSessionState(session, profile);
23934
23936
  sessionOk = sessionStateIsUsable(state2);
23935
23937
  if (state2 === "expired") {
23936
- const posture = resolveProfilePosture(await ProfileManager.getProfile(profileName2));
23937
- sessionDetail = `expired ${expiresAt} \u2014 ${signInAgainHint(profileName2, posture)}`;
23938
+ sessionDetail = `expired ${expiresAt} \u2014 ${signInAgainHint(profileName2, resolveProfilePosture(profile))}`;
23939
+ } else if (state2 === "unverified") {
23940
+ sessionDetail = `not usable (no signed OpenKey proof) \u2014 ${signInAgainHint(profileName2, resolveProfilePosture(profile))}`;
23938
23941
  } else {
23939
23942
  sessionDetail = sessionOk ? "active" : "no session \u2014 run tc auth login";
23940
23943
  }
@@ -25054,6 +25057,7 @@ import {
25054
25057
  readSession as readSession2,
25055
25058
  withProfileLock as withProfileLock5
25056
25059
  } from "@tinycloud/operations/state";
25060
+ import { ownerSessionLacksProof as ownerSessionLacksProof4 } from "@tinycloud/operations/profile";
25057
25061
  init_profiles();
25058
25062
  init_constants();
25059
25063
  init_errors();
@@ -25178,7 +25182,10 @@ async function createReplica(profile, config) {
25178
25182
  async function storedGrants(profile) {
25179
25183
  const authorizations = [];
25180
25184
  const session = await readSession2(profile).catch(() => null);
25181
- if (typeof session?.delegationHeader?.Authorization === "string") authorizations.push(session.delegationHeader.Authorization);
25185
+ const config = await ProfileManager.getProfile(profile).catch(() => null);
25186
+ if (typeof session?.delegationHeader?.Authorization === "string" && !ownerSessionLacksProof4(session, config)) {
25187
+ authorizations.push(session.delegationHeader.Authorization);
25188
+ }
25182
25189
  const records = await readAdditionalDelegations2(profile).catch(
25183
25190
  () => []
25184
25191
  );
@@ -25652,7 +25659,7 @@ import { join as join11 } from "path";
25652
25659
  import { homedir, hostname, userInfo } from "os";
25653
25660
  import { appSecretScope } from "@tinycloud/sdk-core";
25654
25661
  import { invokeOperation as invokeOperation2 } from "@tinycloud/operations";
25655
- import { isLocalOwnerProfile as isLocalOwnerProfile4 } from "@tinycloud/operations/profile";
25662
+ import { isLocalOwnerProfile as isLocalOwnerProfile4, ownerSessionLacksProof as ownerSessionLacksProof5 } from "@tinycloud/operations/profile";
25656
25663
  import {
25657
25664
  buildSecretManagerUrl,
25658
25665
  buildSecretRequestUrl as buildSecretRequestUrl2,
@@ -26187,11 +26194,11 @@ async function ensureSecretsNode(ctx, options, openKeyAcquisition, selectedProfi
26187
26194
  const profile = selectedProfile ?? await ProfileManager.getProfile(ctx.profile).catch(() => null);
26188
26195
  if (profile?.authMethod === "openkey" && canRequestOwnerPermissions(profile)) {
26189
26196
  const session = await ProfileManager.getSession(ctx.profile);
26190
- if (!session || isStoredSessionExpired(session)) {
26197
+ if (!session || isStoredSessionExpired(session) || ownerSessionLacksProof5(session, profile)) {
26191
26198
  if (!process.stdin.isTTY && !process.stderr.isTTY) {
26192
26199
  throw new CLIError(
26193
26200
  "AUTH_REQUIRED",
26194
- `Profile "${ctx.profile}" has ${session ? "an expired" : "no"} OpenKey session; headless secret access cannot open a browser login.`,
26201
+ `Profile "${ctx.profile}" has ${session ? "an expired or unverified" : "no"} OpenKey session; headless secret access cannot open a browser login.`,
26195
26202
  ExitCode.AUTH_REQUIRED,
26196
26203
  { hint: scopedSecretLoginHint(ctx.profile) }
26197
26204
  );
@@ -26299,7 +26306,7 @@ async function canonicalSecretGet(params, collect) {
26299
26306
  throw sessionExpiredError(params.ctx.profile, posture);
26300
26307
  }
26301
26308
  if (profile2.authMethod === "openkey" && canRequestOwnerPermissions(profile2)) {
26302
- if (!session || isStoredSessionExpired(session)) {
26309
+ if (!session || isStoredSessionExpired(session) || ownerSessionLacksProof5(session, profile2)) {
26303
26310
  ownerNode = await ensureSecretsNode(params.ctx, params.options, params.openKeyAcquisition, profile2);
26304
26311
  }
26305
26312
  }
@@ -36547,7 +36554,7 @@ init_permissions();
36547
36554
  import {
36548
36555
  NodeWasmBindings as NodeWasmBindings2
36549
36556
  } from "@tinycloud/node-sdk";
36550
- import { ownerSessionLacksProof as ownerSessionLacksProof3 } from "@tinycloud/operations/profile";
36557
+ import { ownerSessionLacksProof as ownerSessionLacksProof6 } from "@tinycloud/operations/profile";
36551
36558
  var wasmBindings = null;
36552
36559
  function registerStatusCommand(program) {
36553
36560
  program.command("status").description("Show local TinyCloud profile, session, delegation, and permission state").action(async (_options, cmd) => {
@@ -36614,7 +36621,7 @@ async function inspectProfile(params) {
36614
36621
  ]);
36615
36622
  const hasPrivateKey = typeof profile?.privateKey === "string" && profile.privateKey.length > 0;
36616
36623
  const localKeyAuthenticated = profile?.authMethod === "local" && hasPrivateKey;
36617
- const sessionAuthenticated = session !== null && sessionExpired !== true && !ownerSessionLacksProof3(session, profile);
36624
+ const sessionAuthenticated = session !== null && sessionExpired !== true && !ownerSessionLacksProof6(session, profile);
36618
36625
  const authenticated = localKeyAuthenticated || sessionAuthenticated;
36619
36626
  const status = resolveStatus({
36620
36627
  exists: profile !== null,