Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ jobs:
steps:
- uses: actions/checkout@v5
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v6
with:
node-version: 24
- run: echo "VANA_PDPP_NODE=$(command -v node)" >> "$GITHUB_ENV"
- uses: actions/setup-node@v6
with:
node-version: ${{ matrix.node-version }}
Expand Down
55 changes: 41 additions & 14 deletions scripts/prepare-vhs-fixtures.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import fs from "node:fs/promises";
import { createHash } from "node:crypto";
import path from "node:path";
import { fileURLToPath } from "node:url";

Expand Down Expand Up @@ -117,6 +118,34 @@ async function seedDemoHome() {
await fs.writeFile(browserPath, "", "utf8");
await fs.chmod(browserPath, 0o755);

const demoAddress = "0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
const githubResultPath = path.join(dataConnectRoot, "last-result.json");
const githubResult = `${JSON.stringify(
{
profile: { username: "tnunamak" },
repositories: [{ name: "vana-connect" }, { name: "data-connectors" }],
starred: [],
},
null,
2,
)}\n`;
await fs.writeFile(
path.join(dataConnectRoot, "auth.json"),
`${JSON.stringify(
{
account: {
address: demoAddress,
session_token: "expired-demo-token",
expires_at: "2000-01-01T00:00:00.000Z",
},
personal_server: null,
},
null,
2,
)}\n`,
"utf8",
);

const state = {
version: 1,
sources: {
Expand All @@ -125,7 +154,17 @@ async function seedDemoHome() {
lastRunAt: "2026-03-14T13:10:03.677Z",
lastRunOutcome: "connected_local_only",
dataState: "collected_local",
lastResultPath: path.join(dataConnectRoot, "last-result.json"),
lastResultPath: githubResultPath,
exportReceipt: {
version: 1,
id: "demo-github-export",
owner: {
accountUrl: "https://account.vana.org",
address: demoAddress,
},
path: githubResultPath,
sha256: createHash("sha256").update(githubResult).digest("hex"),
},
lastLogPath: path.join(dataConnectRoot, "logs", "run-github-demo.log"),
},
shop: {
Expand Down Expand Up @@ -156,19 +195,7 @@ async function seedDemoHome() {
"utf8",
);

await fs.writeFile(
path.join(dataConnectRoot, "last-result.json"),
`${JSON.stringify(
{
profile: { username: "tnunamak" },
repositories: [{ name: "vana-connect" }, { name: "data-connectors" }],
starred: [],
},
null,
2,
)}\n`,
"utf8",
);
await fs.writeFile(githubResultPath, githubResult, "utf8");
await fs.writeFile(
path.join(dataConnectRoot, "spotify-result.json"),
`${JSON.stringify(
Expand Down
9 changes: 9 additions & 0 deletions src/cli/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import fsp from "node:fs/promises";
import path from "node:path";
import { getVanaHome } from "../core/paths.js";
import { formatDisplayPath } from "./render/format.js";
import type { ExportOwner } from "../core/source-export.js";

export interface VanaCredentials {
account: {
Expand Down Expand Up @@ -175,6 +176,14 @@ export function loadAccountAddressForOwnership(): string | null {
return process.env.VANA_SESSION_TOKEN ? null : readStoredAccountAddress();
}

/** Capture identity independently of token expiry, never from a destination server. */
export function loadExportOwner(): ExportOwner {
const address = loadAccountAddressForOwnership();
if (!address || !/^0x[a-f0-9]{40}$/i.test(address)) return null;
const accountUrl = new URL(getAccountUrl()).toString().replace(/\/+$/, "");
return { accountUrl, address: address.toLowerCase() };
}

/**
* Raw peek at auth.json ignoring expiry: the previous address and the
* previous personal_server block. Login uses it to detect an account switch
Expand Down
Loading
Loading