clearcote 0.62.1 → 0.63.1
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/README.md +19 -0
- package/dist/download.d.ts.map +1 -1
- package/dist/download.js +6 -1
- package/dist/download.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12 -4
- package/dist/index.js.map +1 -1
- package/dist/license.d.ts +9 -0
- package/dist/license.d.ts.map +1 -1
- package/dist/license.js +78 -3
- package/dist/license.js.map +1 -1
- package/dist/persona.d.ts +80 -0
- package/dist/persona.d.ts.map +1 -0
- package/dist/persona.js +271 -0
- package/dist/persona.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { LicenseError } from "./license.js";
|
|
2
|
+
export declare const TOKEN_ENV = "CLEARCOTE_PERSONA_TOKEN";
|
|
3
|
+
export declare const TOKEN_GZ_ENV = "CLEARCOTE_PERSONA_TOKEN_GZ";
|
|
4
|
+
export declare const API_ENV = "CLEARCOTE_PERSONA_API";
|
|
5
|
+
export declare const MARKER_SWITCH = "cc-persona-host-facts";
|
|
6
|
+
export declare const DEFAULT_HOSTS: string[];
|
|
7
|
+
export declare const ENV_INLINE_LIMIT = 30000;
|
|
8
|
+
export declare const SELECTOR_SWITCHES: ReadonlySet<string>;
|
|
9
|
+
export type Env = Record<string, string | undefined>;
|
|
10
|
+
export type Selector = Record<string, string>;
|
|
11
|
+
export type HostFacts = {
|
|
12
|
+
gpu_vendor: string;
|
|
13
|
+
};
|
|
14
|
+
export type Probe = (exe: string | undefined, name: string) => boolean;
|
|
15
|
+
export type FactsRunner = (cmd: string[], env: Env) => string;
|
|
16
|
+
export type Fetcher = (runToken: string, sel: Selector, host: HostFacts, profileJson: string | null, proxy: unknown) => Promise<{
|
|
17
|
+
token: string;
|
|
18
|
+
exp: number;
|
|
19
|
+
}>;
|
|
20
|
+
/** What a lease must offer here; the SDK's LeaseSession does. */
|
|
21
|
+
export interface LeaseLike {
|
|
22
|
+
readonly token: string | null;
|
|
23
|
+
readonly leaseId?: string | null;
|
|
24
|
+
}
|
|
25
|
+
export declare class PersonaServiceError extends LicenseError {
|
|
26
|
+
constructor(message: string);
|
|
27
|
+
}
|
|
28
|
+
/** Whether `exe` is an r51+ engine, which starts only with a persona token. */
|
|
29
|
+
export declare function engineWantsPersonaToken(exe: string | undefined, supports?: Probe): boolean;
|
|
30
|
+
/**
|
|
31
|
+
* The selector the generator reads from `args` (last value wins, as Chromium keeps the last copy), the captured
|
|
32
|
+
* profile's exact JSON text when --fingerprint-profile is present, and `args` with that switch removed and
|
|
33
|
+
* --fingerprint-profile-sha256 added in its place.
|
|
34
|
+
*/
|
|
35
|
+
export declare function selectorFromArgs(args: readonly string[]): {
|
|
36
|
+
sel: Selector;
|
|
37
|
+
profileJson: string | null;
|
|
38
|
+
args: string[];
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* The facts of this machine the generator needs, as the engine itself reports them for a launch with these
|
|
42
|
+
* switches: `chrome --cc-persona-host-facts` prints {"gpu_vendor": ...} and exits. Cached per (binary, the switches
|
|
43
|
+
* that influence the answer) in memory and in ~/.clearcote.
|
|
44
|
+
*/
|
|
45
|
+
export declare function hostFacts(exe: string, args: readonly string[], runToken: string, runner?: FactsRunner, env?: Env): HostFacts;
|
|
46
|
+
export declare function personaHosts(env?: Env): string[];
|
|
47
|
+
/** POST the request to the first persona host that answers. */
|
|
48
|
+
export declare function fetchPersonaToken(runToken: string, sel: Selector, host: HostFacts, profileJson?: string | null, proxy?: unknown, hosts?: string[], timeoutMs?: number): Promise<{
|
|
49
|
+
token: string;
|
|
50
|
+
exp: number;
|
|
51
|
+
}>;
|
|
52
|
+
/** A valid persona token for this lease + selector + host, from the cache or the service. */
|
|
53
|
+
export declare function personaTokenFor(lease: LeaseLike, sel: Selector, host: HostFacts, profileJson: string | null, proxy: unknown, fetch?: Fetcher): Promise<string>;
|
|
54
|
+
/** `env` with the token the way the engine reads it (gzip + base64 when long). */
|
|
55
|
+
export declare function injectPersonaToken(env: Env, token: string): Env;
|
|
56
|
+
export interface PersonaLaunch {
|
|
57
|
+
/** The launch args, with a captured profile replaced by its hash. */
|
|
58
|
+
args: string[];
|
|
59
|
+
/** `base` with the persona token added (or `base` itself when this engine needs none). */
|
|
60
|
+
env(base: Env | undefined): Env | undefined;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Prepare a launch of `exe`: on an r51+ engine with a lease, fetch the persona token; `env()` then adds it to each
|
|
64
|
+
* attempt's environment (a retried launch rebuilds its env). Otherwise the args come back unchanged and `env()` is
|
|
65
|
+
* the identity.
|
|
66
|
+
*/
|
|
67
|
+
export declare function preparePersonaLaunch(exe: string, args: readonly string[], lease: LeaseLike | null | undefined, proxy?: unknown, deps?: {
|
|
68
|
+
supports?: Probe;
|
|
69
|
+
runner?: FactsRunner;
|
|
70
|
+
fetch?: Fetcher;
|
|
71
|
+
env?: Env;
|
|
72
|
+
}): Promise<PersonaLaunch>;
|
|
73
|
+
/**
|
|
74
|
+
* A lease-like view of a run token the CALLER put in the environment (CLEARCOTE_RUN_TOKEN, or _FILE): the hosted
|
|
75
|
+
* gateway mints its own run tokens and hands them to serve() this way with no SDK lease. The lease id is read from
|
|
76
|
+
* the token's payload without verifying it (the engine and the persona service verify; here it only keys the cache).
|
|
77
|
+
*/
|
|
78
|
+
export declare function leaseFromEnv(env: Env | undefined): LeaseLike | null;
|
|
79
|
+
export declare function clearPersonaCaches(): void;
|
|
80
|
+
//# sourceMappingURL=persona.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"persona.d.ts","sourceRoot":"","sources":["../src/persona.ts"],"names":[],"mappings":"AAyBA,OAAO,EAAE,YAAY,EAAoB,MAAM,cAAc,CAAC;AAG9D,eAAO,MAAM,SAAS,4BAA4B,CAAC;AACnD,eAAO,MAAM,YAAY,+BAA+B,CAAC;AACzD,eAAO,M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FAA0F;IAC1F,GAAG,CAAC,IAAI,EAAE,GAAG,GAAG,SAAS,GAAG,GAAG,GAAG,SAAS,CAAC;CAC7C;AAED;;;;GAIG;AACH,wBAAsB,oBAAoB,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,MAAM,EAAE,EAAE,KAAK,EAAE,SAAS,GAAG,IAAI,GAAG,SAAS,EAAE,KAAK,GAAE,OAAmB,EAC9I,IAAI,GAAE;IAAE,QAAQ,CAAC,EAAE,KAAK,CAAC;IAAC,MAAM,CAAC,EAAE,WAAW,CAAC;IAAC,KAAK,CAAC,EAAE,OAAO,CAAC;IAAC,GAAG,CAAC,EAAE,GAAG,CAAA;CAAO,GAAG,OAAO,CAAC,aAAa,CAAC,CAO3G;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,GAAG,GAAG,SAAS,GAAG,SAAS,GAAG,IAAI,CAanE;AAED,wBAAgB,kBAAkB,IAAI,IAAI,CAGzC"}
|
package/dist/persona.js
ADDED
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
// Server-side personas (engine r51+): fetch the signed persona token for a launch and hand it to the engine.
|
|
2
|
+
//
|
|
3
|
+
// From r51 the engine derives no persona of its own. The launcher asks the persona service for one -- with the run
|
|
4
|
+
// token it just leased, the persona switches it is about to launch with (the *selector*) and the one fact of this
|
|
5
|
+
// machine the generator needs (the host GPU vendor) -- and passes the signed answer to the browser in
|
|
6
|
+
// CLEARCOTE_PERSONA_TOKEN, next to CLEARCOTE_RUN_TOKEN. Every launch gets one, persona or not: a selector without a
|
|
7
|
+
// seed yields the persona the engine computed for seed 0 up to r50, so a launch with no fingerprint behaves exactly
|
|
8
|
+
// as before. The engine checks the token's signature and that it was issued to this licence and lease for exactly
|
|
9
|
+
// these switches on this machine; it refuses to start without one.
|
|
10
|
+
//
|
|
11
|
+
// Engines before r51 ignore the variable and keep deriving personas themselves, so this module does nothing for
|
|
12
|
+
// them (engineWantsPersonaToken), and the SDK keeps working with either.
|
|
13
|
+
//
|
|
14
|
+
// A captured profile (fingerprintProfile) no longer rides on the command line: its exact JSON text goes to the
|
|
15
|
+
// service, which hashes it, generates from it and names the hash in the token's selector; the launch carries
|
|
16
|
+
// --fingerprint-profile-sha256=<hash> so the engine can bind the two.
|
|
17
|
+
//
|
|
18
|
+
// The selector list mirrors the Python SDK's (_persona.py), the engine's (components/ungoogled/persona_token.cc)
|
|
19
|
+
// and the service's (services/cc-persona/src/selector.mjs): a switch added to one must be added to the others.
|
|
20
|
+
import { spawnSync } from "node:child_process";
|
|
21
|
+
import { createHash } from "node:crypto";
|
|
22
|
+
import { existsSync, mkdirSync, readFileSync, statSync, writeFileSync } from "node:fs";
|
|
23
|
+
import { dirname, join, resolve as resolvePath } from "node:path";
|
|
24
|
+
import { gunzipSync, gzipSync } from "node:zlib";
|
|
25
|
+
import { engineSupportsSwitch } from "./launchopts.js";
|
|
26
|
+
import { LicenseError, licenseUserAgent } from "./license.js";
|
|
27
|
+
import { proxiedRequest } from "./net.js";
|
|
28
|
+
export const TOKEN_ENV = "CLEARCOTE_PERSONA_TOKEN";
|
|
29
|
+
export const TOKEN_GZ_ENV = "CLEARCOTE_PERSONA_TOKEN_GZ";
|
|
30
|
+
export const API_ENV = "CLEARCOTE_PERSONA_API"; // comma-separated base URLs; tests and self-hosting
|
|
31
|
+
export const MARKER_SWITCH = "cc-persona-host-facts"; // only an r51+ engine implements it
|
|
32
|
+
export const DEFAULT_HOSTS = ["https://persona.clearcotelabs.com", "https://persona-us.clearcotelabs.com"];
|
|
33
|
+
// Over this many bytes the token goes gzip + base64 in TOKEN_GZ_ENV (a Windows environment variable holds at most
|
|
34
|
+
// 32,767 characters; a macOS persona lists 180 voices).
|
|
35
|
+
export const ENV_INLINE_LIMIT = 30000;
|
|
36
|
+
const REQUEST_TIMEOUT_MS = 8000;
|
|
37
|
+
const SKEW_SEC = 60;
|
|
38
|
+
export const SELECTOR_SWITCHES = new Set([
|
|
39
|
+
"fingerprint", "fingerprint-platform", "fingerprint-brand", "fingerprint-brand-version",
|
|
40
|
+
"fingerprint-schema", "fingerprint-gpu-vendor", "fingerprint-gpu-renderer", "fingerprint-gpu-draw",
|
|
41
|
+
"fingerprint-gpu-backend-real", "fingerprint-hardware-concurrency", "fingerprint-device-pixel-ratio",
|
|
42
|
+
"fingerprint-color-scheme", "fingerprint-reduced-motion", "fingerprint-webauthn", "fingerprint-bluetooth",
|
|
43
|
+
"fingerprint-webgpu-vendor", "fingerprint-webgpu-architecture", "disable-gpu-string-spoof",
|
|
44
|
+
"disable-gpu-fingerprint", "disable-fingerprint-voices", "canvas-bridge-url", "fingerprint-profile-id",
|
|
45
|
+
"fingerprint-profile-sha256",
|
|
46
|
+
]);
|
|
47
|
+
// The switches the engine's host-GPU-vendor detection reads; the host-facts run carries exactly these.
|
|
48
|
+
const HOST_FACT_SWITCHES = new Set([
|
|
49
|
+
"headless", "disable-gpu", "enable-gpu", "use-gl", "use-angle", "use-adapter-luid", "canvas-bridge-url",
|
|
50
|
+
"fingerprint-gpu-host-vendor",
|
|
51
|
+
]);
|
|
52
|
+
const PROFILE_SWITCH = "fingerprint-profile";
|
|
53
|
+
const PROFILE_SHA_SWITCH = "fingerprint-profile-sha256";
|
|
54
|
+
export class PersonaServiceError extends LicenseError {
|
|
55
|
+
constructor(message) { super(message); this.name = "PersonaServiceError"; }
|
|
56
|
+
}
|
|
57
|
+
const tokens = new Map();
|
|
58
|
+
const facts = new Map();
|
|
59
|
+
function parseSwitch(arg) {
|
|
60
|
+
if (!arg.startsWith("--") || arg.length === 2)
|
|
61
|
+
return null;
|
|
62
|
+
const eq = arg.indexOf("=");
|
|
63
|
+
const name = eq < 0 ? arg.slice(2) : arg.slice(2, eq);
|
|
64
|
+
return name ? [name, eq < 0 ? "" : arg.slice(eq + 1)] : null;
|
|
65
|
+
}
|
|
66
|
+
/** Whether `exe` is an r51+ engine, which starts only with a persona token. */
|
|
67
|
+
export function engineWantsPersonaToken(exe, supports = engineSupportsSwitch) {
|
|
68
|
+
return !!exe && supports(exe, MARKER_SWITCH);
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* The selector the generator reads from `args` (last value wins, as Chromium keeps the last copy), the captured
|
|
72
|
+
* profile's exact JSON text when --fingerprint-profile is present, and `args` with that switch removed and
|
|
73
|
+
* --fingerprint-profile-sha256 added in its place.
|
|
74
|
+
*/
|
|
75
|
+
export function selectorFromArgs(args) {
|
|
76
|
+
const sel = {};
|
|
77
|
+
let profileJson = null;
|
|
78
|
+
let out = [];
|
|
79
|
+
for (const arg of args) {
|
|
80
|
+
const s = parseSwitch(arg);
|
|
81
|
+
if (s && s[0] === PROFILE_SWITCH) {
|
|
82
|
+
let raw = Buffer.from(s[1], "base64");
|
|
83
|
+
try {
|
|
84
|
+
raw = gunzipSync(raw);
|
|
85
|
+
}
|
|
86
|
+
catch { /* an uncompressed profile */ }
|
|
87
|
+
profileJson = raw.toString("utf8");
|
|
88
|
+
continue;
|
|
89
|
+
}
|
|
90
|
+
if (s && SELECTOR_SWITCHES.has(s[0]))
|
|
91
|
+
sel[s[0]] = s[0] === "canvas-bridge-url" ? "1" : s[1];
|
|
92
|
+
out.push(arg);
|
|
93
|
+
}
|
|
94
|
+
if (profileJson !== null) {
|
|
95
|
+
delete sel[PROFILE_SHA_SWITCH];
|
|
96
|
+
out = out.filter((a) => parseSwitch(a)?.[0] !== PROFILE_SHA_SWITCH);
|
|
97
|
+
const sha = createHash("sha256").update(profileJson, "utf8").digest("hex");
|
|
98
|
+
sel[PROFILE_SHA_SWITCH] = sha;
|
|
99
|
+
out.push(`--${PROFILE_SHA_SWITCH}=${sha}`);
|
|
100
|
+
}
|
|
101
|
+
return { sel, profileJson, args: out };
|
|
102
|
+
}
|
|
103
|
+
function factsCachePath(env) {
|
|
104
|
+
const base = process.platform === "win32" ? env.LOCALAPPDATA : env.HOME;
|
|
105
|
+
return base ? join(base, ".clearcote", "persona-host-facts.json") : null;
|
|
106
|
+
}
|
|
107
|
+
function defaultRunner(cmd, env) {
|
|
108
|
+
const r = spawnSync(cmd[0], cmd.slice(1), { env: env, encoding: "utf8", timeout: 30000, windowsHide: true });
|
|
109
|
+
return r.stdout ?? "";
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* The facts of this machine the generator needs, as the engine itself reports them for a launch with these
|
|
113
|
+
* switches: `chrome --cc-persona-host-facts` prints {"gpu_vendor": ...} and exits. Cached per (binary, the switches
|
|
114
|
+
* that influence the answer) in memory and in ~/.clearcote.
|
|
115
|
+
*/
|
|
116
|
+
export function hostFacts(exe, args, runToken, runner = defaultRunner, env = process.env) {
|
|
117
|
+
const relevant = args.filter((a) => { const s = parseSwitch(a); return !!s && HOST_FACT_SWITCHES.has(s[0]); }).sort();
|
|
118
|
+
let key;
|
|
119
|
+
try {
|
|
120
|
+
const st = statSync(exe);
|
|
121
|
+
key = JSON.stringify([resolvePath(exe), st.size, Math.floor(st.mtimeMs / 1000), relevant]);
|
|
122
|
+
}
|
|
123
|
+
catch {
|
|
124
|
+
key = JSON.stringify([exe, 0, 0, relevant]);
|
|
125
|
+
}
|
|
126
|
+
const hit = facts.get(key);
|
|
127
|
+
if (hit)
|
|
128
|
+
return { ...hit };
|
|
129
|
+
const disk = factsCachePath(env);
|
|
130
|
+
if (disk && existsSync(disk)) {
|
|
131
|
+
try {
|
|
132
|
+
const stored = JSON.parse(readFileSync(disk, "utf8"))[key];
|
|
133
|
+
if (stored && typeof stored.gpu_vendor === "string") {
|
|
134
|
+
facts.set(key, stored);
|
|
135
|
+
return { ...stored };
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
catch { /* unreadable cache: probe again */ }
|
|
139
|
+
}
|
|
140
|
+
const probeEnv = { ...env, CLEARCOTE_RUN_TOKEN: runToken }; // the probe runs after the licence gate, like every launch
|
|
141
|
+
delete probeEnv[TOKEN_ENV];
|
|
142
|
+
delete probeEnv[TOKEN_GZ_ENV];
|
|
143
|
+
let out;
|
|
144
|
+
try {
|
|
145
|
+
const text = runner([exe, `--${MARKER_SWITCH}`, ...relevant], probeEnv);
|
|
146
|
+
const lines = text.trim().split(/\r?\n/);
|
|
147
|
+
const parsed = JSON.parse(lines[lines.length - 1]);
|
|
148
|
+
if (typeof parsed.gpu_vendor !== "string")
|
|
149
|
+
throw new Error("no gpu_vendor");
|
|
150
|
+
out = { gpu_vendor: parsed.gpu_vendor };
|
|
151
|
+
}
|
|
152
|
+
catch (e) {
|
|
153
|
+
throw new PersonaServiceError(`the engine did not report its host facts (${e.message})`);
|
|
154
|
+
}
|
|
155
|
+
facts.set(key, out);
|
|
156
|
+
if (disk) {
|
|
157
|
+
try {
|
|
158
|
+
mkdirSync(dirname(disk), { recursive: true });
|
|
159
|
+
let all = {};
|
|
160
|
+
try {
|
|
161
|
+
all = JSON.parse(readFileSync(disk, "utf8"));
|
|
162
|
+
}
|
|
163
|
+
catch { /* fresh cache */ }
|
|
164
|
+
all[key] = out;
|
|
165
|
+
writeFileSync(disk, JSON.stringify(all));
|
|
166
|
+
}
|
|
167
|
+
catch { /* best effort */ }
|
|
168
|
+
}
|
|
169
|
+
return { ...out };
|
|
170
|
+
}
|
|
171
|
+
export function personaHosts(env = process.env) {
|
|
172
|
+
const raw = (env[API_ENV] ?? "").trim();
|
|
173
|
+
if (raw)
|
|
174
|
+
return raw.split(",").map((h) => h.trim().replace(/\/+$/, "")).filter(Boolean);
|
|
175
|
+
return DEFAULT_HOSTS;
|
|
176
|
+
}
|
|
177
|
+
/** POST the request to the first persona host that answers. */
|
|
178
|
+
export async function fetchPersonaToken(runToken, sel, host, profileJson = null, proxy = undefined, hosts = personaHosts(), timeoutMs = REQUEST_TIMEOUT_MS) {
|
|
179
|
+
const body = JSON.stringify(profileJson === null ? { token: runToken, sel, host } : { token: runToken, sel, host, profile_json: profileJson });
|
|
180
|
+
const failures = [];
|
|
181
|
+
for (const base of hosts) {
|
|
182
|
+
let res;
|
|
183
|
+
try {
|
|
184
|
+
res = await proxiedRequest(`${base}/v1/persona`, {
|
|
185
|
+
method: "POST", body, timeoutMs, proxy: proxy,
|
|
186
|
+
headers: { "content-type": "application/json", "User-Agent": licenseUserAgent() },
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
catch (e) {
|
|
190
|
+
failures.push(`${base}: ${e.message}`);
|
|
191
|
+
continue;
|
|
192
|
+
}
|
|
193
|
+
let answer = {};
|
|
194
|
+
try {
|
|
195
|
+
answer = (await res.json());
|
|
196
|
+
}
|
|
197
|
+
catch { /* not JSON */ }
|
|
198
|
+
if (res.ok && typeof answer.persona_token === "string")
|
|
199
|
+
return { token: answer.persona_token, exp: Number(answer.exp ?? 0) };
|
|
200
|
+
const reason = typeof answer.error === "string" ? answer.error : `HTTP ${res.status}`;
|
|
201
|
+
if (res.status >= 400 && res.status < 500)
|
|
202
|
+
throw new PersonaServiceError(`the persona service refused this launch: ${reason}`);
|
|
203
|
+
failures.push(`${base}: ${reason}`);
|
|
204
|
+
}
|
|
205
|
+
throw new PersonaServiceError(`no persona service answered (${failures.join("; ")}). The engine cannot start without a persona; check outbound HTTPS to persona.clearcotelabs.com.`);
|
|
206
|
+
}
|
|
207
|
+
/** A valid persona token for this lease + selector + host, from the cache or the service. */
|
|
208
|
+
export async function personaTokenFor(lease, sel, host, profileJson, proxy, fetch = fetchPersonaToken) {
|
|
209
|
+
const key = createHash("sha256").update(JSON.stringify([lease.leaseId ?? null, Object.fromEntries(Object.entries(sel).sort()), host])).digest("hex");
|
|
210
|
+
const now = Date.now() / 1000;
|
|
211
|
+
const hit = tokens.get(key);
|
|
212
|
+
if (hit && hit.exp > now + SKEW_SEC)
|
|
213
|
+
return hit.token;
|
|
214
|
+
const got = await fetch(lease.token ?? "", sel, host, profileJson, proxy);
|
|
215
|
+
tokens.set(key, got);
|
|
216
|
+
return got.token;
|
|
217
|
+
}
|
|
218
|
+
/** `env` with the token the way the engine reads it (gzip + base64 when long). */
|
|
219
|
+
export function injectPersonaToken(env, token) {
|
|
220
|
+
const out = { ...env };
|
|
221
|
+
delete out[TOKEN_ENV];
|
|
222
|
+
delete out[TOKEN_GZ_ENV];
|
|
223
|
+
if (token.length > ENV_INLINE_LIMIT)
|
|
224
|
+
out[TOKEN_GZ_ENV] = gzipSync(Buffer.from(token, "ascii"), { level: 9 }).toString("base64");
|
|
225
|
+
else
|
|
226
|
+
out[TOKEN_ENV] = token;
|
|
227
|
+
return out;
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* Prepare a launch of `exe`: on an r51+ engine with a lease, fetch the persona token; `env()` then adds it to each
|
|
231
|
+
* attempt's environment (a retried launch rebuilds its env). Otherwise the args come back unchanged and `env()` is
|
|
232
|
+
* the identity.
|
|
233
|
+
*/
|
|
234
|
+
export async function preparePersonaLaunch(exe, args, lease, proxy = undefined, deps = {}) {
|
|
235
|
+
const l = lease?.token ? lease : leaseFromEnv(deps.env);
|
|
236
|
+
if (!l?.token || !engineWantsPersonaToken(exe, deps.supports))
|
|
237
|
+
return { args: [...args], env: (b) => b };
|
|
238
|
+
const { sel, profileJson, args: out } = selectorFromArgs(args);
|
|
239
|
+
const host = hostFacts(exe, out, l.token, deps.runner, deps.env);
|
|
240
|
+
const token = await personaTokenFor(l, sel, host, profileJson, proxy, deps.fetch);
|
|
241
|
+
return { args: out, env: (b) => injectPersonaToken(b ?? { ...process.env }, token) };
|
|
242
|
+
}
|
|
243
|
+
/**
|
|
244
|
+
* A lease-like view of a run token the CALLER put in the environment (CLEARCOTE_RUN_TOKEN, or _FILE): the hosted
|
|
245
|
+
* gateway mints its own run tokens and hands them to serve() this way with no SDK lease. The lease id is read from
|
|
246
|
+
* the token's payload without verifying it (the engine and the persona service verify; here it only keys the cache).
|
|
247
|
+
*/
|
|
248
|
+
export function leaseFromEnv(env) {
|
|
249
|
+
const e = env ?? process.env;
|
|
250
|
+
let token = (e.CLEARCOTE_RUN_TOKEN ?? "").trim();
|
|
251
|
+
if (!token && e.CLEARCOTE_RUN_TOKEN_FILE) {
|
|
252
|
+
try {
|
|
253
|
+
token = readFileSync(e.CLEARCOTE_RUN_TOKEN_FILE, "utf8").trim();
|
|
254
|
+
}
|
|
255
|
+
catch { /* no file: no lease */ }
|
|
256
|
+
}
|
|
257
|
+
if (!token)
|
|
258
|
+
return null;
|
|
259
|
+
let leaseId = null;
|
|
260
|
+
try {
|
|
261
|
+
const body = token.split(".")[0];
|
|
262
|
+
leaseId = JSON.parse(Buffer.from(body, "base64url").toString("utf8")).lease ?? null;
|
|
263
|
+
}
|
|
264
|
+
catch { /* junk token: still fetch, the service will refuse it */ }
|
|
265
|
+
return { token, leaseId };
|
|
266
|
+
}
|
|
267
|
+
export function clearPersonaCaches() {
|
|
268
|
+
tokens.clear();
|
|
269
|
+
facts.clear();
|
|
270
|
+
}
|
|
271
|
+
//# sourceMappingURL=persona.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"persona.js","sourceRoot":"","sources":["../src/persona.ts"],"names":[],"mappings":"AAAA,6GAA6G;AAC7G,EAAE;AACF,mHAAmH;AACnH,kHAAkH;AAClH,sGAAsG;AACtG,oHAAoH;AACpH,oHAAoH;AACpH,kHAAkH;AAClH,mEAAmE;AACnE,EAAE;AACF,gHAAgH;AAChH,yEAAyE;AACzE,EAAE;AACF,+GAA+G;AAC/G,6GAA6G;AAC7G,sEAAsE;AACtE,EAAE;AACF,iHAAiH;AACjH,+GAA+G;AAC/G,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACvF,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,WAAW,CAAC;AAClE,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,EAAE,oBAAoB,EAAE,MAAM,i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,CAAC,wBAAwB,EAAE,CAAC;QACzC,IAAI,CAAC;YAAC,KAAK,GAAG,YAAY,CAAC,CAAC,CAAC,wBAAwB,EAAE,MAAM,CAAC,CAAC,IAAI,EAAE,CAAC;QAAC,CAAC;QAAC,MAAM,CAAC,CAAC,uBAAuB,CAAC,CAAC;IAC5G,CAAC;IACD,IAAI,CAAC,KAAK;QAAE,OAAO,IAAI,CAAC;IACxB,IAAI,OAAO,GAAkB,IAAI,CAAC;IAClC,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;QACjC,OAAO,GAAI,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAyB,CAAC,KAAe,IAAI,IAAI,CAAC;IACzH,CAAC;IAAC,MAAM,CAAC,CAAC,yDAAyD,CAAC,CAAC;IACrE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC;AAC5B,CAAC;AAED,MAAM,UAAU,kBAAkB;IAChC,MAAM,CAAC,KAAK,EAAE,CAAC;IACf,KAAK,CAAC,KAAK,EAAE,CAAC;AAChB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "clearcote",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.63.1",
|
|
4
4
|
"description": "Playwright drop-in for the Clearcote anti-fingerprint Chromium build. launch() returns a standard Playwright Browser backed by the verified Clearcote binary, which is auto-downloaded and SHA-256 checked.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|