@sohopay/agent-signer 0.3.1 → 0.4.0
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 +22 -0
- package/dist/cli/args.d.ts +2 -0
- package/dist/cli/args.js +10 -1
- package/dist/cli/commands.js +3 -1
- package/dist/cli/key-path.d.ts +10 -0
- package/dist/cli/key-path.js +35 -3
- package/dist/cli/run.js +34 -4
- package/dist/cli/signer-config.d.ts +1 -0
- package/dist/cli/signer-config.js +1 -1
- package/dist/errors.d.ts +1 -1
- package/dist/terminal.d.ts +13 -0
- package/dist/terminal.js +53 -1
- package/package.json +2 -7
package/README.md
CHANGED
|
@@ -174,6 +174,21 @@ material in the stdin JSON (`"key": { ... }`) is rejected with
|
|
|
174
174
|
`SOHOPAY_SIGNER_KEY_ROOTS` can only narrow it). The file must be mode `0600` and
|
|
175
175
|
may not be a symlink. Anything else fails with `KEY_PATH_INVALID`.
|
|
176
176
|
|
|
177
|
+
### One key per terminal (`workload-terminal/1`)
|
|
178
|
+
|
|
179
|
+
Two installs on one machine need two terminals and two keys. `terminal id --harness <name>`
|
|
180
|
+
returns a stable `<name>:<uuid>` for that harness (persisted at `~/.sohopay/<name>/terminal_id`,
|
|
181
|
+
file `0600`, folder `0700`). `--harness` accepts only `antigravity`, `claude-code`, `codex`,
|
|
182
|
+
`cursor` or `hermes`; anything else fails with `INVALID_HARNESS`. `SOHO_TERMINAL_ID` is not
|
|
183
|
+
consulted here.
|
|
184
|
+
|
|
185
|
+
`key generate`, `pop sign` and `voucher sign` accept `--terminal <id>` in place of
|
|
186
|
+
`--out` / `--key`. The signer picks the key file itself:
|
|
187
|
+
`~/.agents/sohopay-agent-workload/<sha256-hex(id)>/secret.json`, so the raw id never
|
|
188
|
+
reaches the filesystem. All the checks above still apply. `key generate --terminal`
|
|
189
|
+
also requires `terminal_id` in the input to equal the flag (`TERMINAL_MISMATCH` otherwise).
|
|
190
|
+
An existing `--key .../secret.json` install keeps working unchanged.
|
|
191
|
+
|
|
177
192
|
### Commands
|
|
178
193
|
|
|
179
194
|
`key generate`: creates a new Ed25519 workload key.
|
|
@@ -220,6 +235,13 @@ echo '{ "fields": { "borrowerId": "...", "terminalId": "...", "jkt": "...", "non
|
|
|
220
235
|
# "implementation_version":"0.x.y","pop_signature":"...","algorithm":"Ed25519"}
|
|
221
236
|
```
|
|
222
237
|
|
|
238
|
+
`terminal id`: the stable terminal id for one harness (see above).
|
|
239
|
+
|
|
240
|
+
```bash
|
|
241
|
+
sohopay-signer terminal id --harness claude-code --output json
|
|
242
|
+
# {"terminal_id":"claude-code:<uuid>"}
|
|
243
|
+
```
|
|
244
|
+
|
|
223
245
|
`verify-vectors`: runs the bundled known-answer vectors; exits `0` only if all pass.
|
|
224
246
|
|
|
225
247
|
```bash
|
package/dist/cli/args.d.ts
CHANGED
package/dist/cli/args.js
CHANGED
|
@@ -13,6 +13,7 @@ const KNOWN_COMMANDS = new Set([
|
|
|
13
13
|
"pop sign",
|
|
14
14
|
"verify-vectors",
|
|
15
15
|
"capabilities",
|
|
16
|
+
"terminal id",
|
|
16
17
|
]);
|
|
17
18
|
function requireValue(argv, index, flag) {
|
|
18
19
|
const value = argv[index];
|
|
@@ -27,6 +28,8 @@ export function parseArgs(argv) {
|
|
|
27
28
|
let input;
|
|
28
29
|
let key;
|
|
29
30
|
let out;
|
|
31
|
+
let terminal;
|
|
32
|
+
let harness;
|
|
30
33
|
let output = "human";
|
|
31
34
|
let envelope = false;
|
|
32
35
|
let writeHeader;
|
|
@@ -50,6 +53,12 @@ export function parseArgs(argv) {
|
|
|
50
53
|
else if (name === "--out") {
|
|
51
54
|
out = valueOf("--out");
|
|
52
55
|
}
|
|
56
|
+
else if (name === "--terminal") {
|
|
57
|
+
terminal = valueOf("--terminal");
|
|
58
|
+
}
|
|
59
|
+
else if (name === "--harness") {
|
|
60
|
+
harness = valueOf("--harness");
|
|
61
|
+
}
|
|
53
62
|
else if (name === "--output") {
|
|
54
63
|
const value = valueOf("--output");
|
|
55
64
|
if (value !== "json" && value !== "human") {
|
|
@@ -89,7 +98,7 @@ export function parseArgs(argv) {
|
|
|
89
98
|
if (positionals.length > commandTokens) {
|
|
90
99
|
throw new UsageError(`unexpected argument: ${positionals[commandTokens]}`);
|
|
91
100
|
}
|
|
92
|
-
return { command, input, key, out, output, envelope, writeHeader };
|
|
101
|
+
return { command, input, key, out, terminal, harness, output, envelope, writeHeader };
|
|
93
102
|
}
|
|
94
103
|
/** True when this invocation reads stdin — "-" is the stdin sentinel for --input/--key (space- or `=`-separated). */
|
|
95
104
|
export function needsStdin(argv) {
|
package/dist/cli/commands.js
CHANGED
|
@@ -25,10 +25,12 @@ export function implementationVersion() {
|
|
|
25
25
|
}
|
|
26
26
|
return pkg.version;
|
|
27
27
|
}
|
|
28
|
-
const COMMANDS = ["voucher sign", "payment-id", "key jkt", "key generate", "pop sign", "verify-vectors", "capabilities"];
|
|
28
|
+
const COMMANDS = ["voucher sign", "payment-id", "key jkt", "key generate", "pop sign", "verify-vectors", "capabilities", "terminal id"];
|
|
29
29
|
const COMMAND_CONTRACTS = {
|
|
30
30
|
"key generate": "workload-keygen/1",
|
|
31
31
|
"pop sign": "pop-sign/1",
|
|
32
|
+
// `terminal id --harness` plus `--terminal <id>` on key generate / pop sign / voucher sign.
|
|
33
|
+
"terminal id": "workload-terminal/1",
|
|
32
34
|
};
|
|
33
35
|
/** Static advertisement SP5 routing probes to confirm a usable signer. */
|
|
34
36
|
export function capabilitiesResult() {
|
package/dist/cli/key-path.d.ts
CHANGED
|
@@ -3,3 +3,13 @@ export declare function validateKeyPath(path: string, mode: "read" | "ensure", o
|
|
|
3
3
|
homeDir?: string;
|
|
4
4
|
env?: NodeJS.ProcessEnv;
|
|
5
5
|
}): string;
|
|
6
|
+
/**
|
|
7
|
+
* `--terminal <id>` -> `<default root>/<sha256-hex(id)>/secret.json`. The raw id
|
|
8
|
+
* (`:`, `@`, `..`) never reaches the filesystem; only its digest names the folder.
|
|
9
|
+
* Ensure mode creates that one 0700 folder (and an absent root); the returned path
|
|
10
|
+
* still goes through {@link validateKeyPath}, so every existing check applies.
|
|
11
|
+
*/
|
|
12
|
+
export declare function terminalKeyPath(terminalId: string, mode: "read" | "ensure", opts?: {
|
|
13
|
+
homeDir?: string;
|
|
14
|
+
env?: NodeJS.ProcessEnv;
|
|
15
|
+
}): string;
|
package/dist/cli/key-path.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
1
2
|
import { lstatSync, mkdirSync, realpathSync, statSync } from "node:fs";
|
|
2
|
-
import { platform, userInfo } from "node:os";
|
|
3
|
-
import { basename, dirname, resolve, sep } from "node:path";
|
|
3
|
+
import { homedir, platform, userInfo } from "node:os";
|
|
4
|
+
import { basename, dirname, join, resolve, sep } from "node:path";
|
|
4
5
|
import { SignerError } from "../errors.js";
|
|
5
|
-
import {
|
|
6
|
+
import { assertValidTerminalId } from "../terminal.js";
|
|
7
|
+
import { DEFAULT_SUBDIR, resolveKeyRoots } from "./signer-config.js";
|
|
6
8
|
function invalid(message) {
|
|
7
9
|
throw new SignerError("KEY_PATH_INVALID", message);
|
|
8
10
|
}
|
|
@@ -154,3 +156,33 @@ export function validateKeyPath(path, mode, opts = {}) {
|
|
|
154
156
|
}
|
|
155
157
|
return target;
|
|
156
158
|
}
|
|
159
|
+
/**
|
|
160
|
+
* `--terminal <id>` -> `<default root>/<sha256-hex(id)>/secret.json`. The raw id
|
|
161
|
+
* (`:`, `@`, `..`) never reaches the filesystem; only its digest names the folder.
|
|
162
|
+
* Ensure mode creates that one 0700 folder (and an absent root); the returned path
|
|
163
|
+
* still goes through {@link validateKeyPath}, so every existing check applies.
|
|
164
|
+
*/
|
|
165
|
+
export function terminalKeyPath(terminalId, mode, opts = {}) {
|
|
166
|
+
const id = assertValidTerminalId(terminalId);
|
|
167
|
+
// The digest already keeps `..` off disk; refuse it anyway so a traversal-shaped id fails loudly.
|
|
168
|
+
if (id.includes(".."))
|
|
169
|
+
invalid("terminal id must not contain ..");
|
|
170
|
+
const digest = createHash("sha256").update(id, "utf8").digest("hex");
|
|
171
|
+
const file = join(opts.homeDir ?? homedir(), ...DEFAULT_SUBDIR, digest, "secret.json");
|
|
172
|
+
if (mode === "ensure") {
|
|
173
|
+
const found = locateRoot(file, resolveKeyRoots(opts));
|
|
174
|
+
if (!found)
|
|
175
|
+
invalid(`${file} is not under an allowed key root`);
|
|
176
|
+
ensureRootExists(found.root);
|
|
177
|
+
const dir = dirname(found.canonical);
|
|
178
|
+
assertNoSymlinkBelow(found.root, dir);
|
|
179
|
+
try {
|
|
180
|
+
mkdirSync(dir, { mode: 0o700 });
|
|
181
|
+
}
|
|
182
|
+
catch (err) {
|
|
183
|
+
if (err.code !== "EEXIST")
|
|
184
|
+
invalid(`cannot create ${dir}`);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
return file;
|
|
188
|
+
}
|
package/dist/cli/run.js
CHANGED
|
@@ -4,7 +4,10 @@ import { capabilitiesResult, keyJktResult, paymentIdResult, popSignResult, verif
|
|
|
4
4
|
import { readInput } from "./io.js";
|
|
5
5
|
import { assertInputSchema, assertOutputSchema } from "./io-schema.js";
|
|
6
6
|
import { keyGenerateResult } from "./key-generate.js";
|
|
7
|
+
import { terminalKeyPath } from "./key-path.js";
|
|
7
8
|
import { SignerError } from "../errors.js";
|
|
9
|
+
import { resolveHarnessTerminalId } from "../terminal.js";
|
|
10
|
+
const TERMINAL_COMMANDS = new Set(["key generate", "pop sign", "voucher sign"]);
|
|
8
11
|
/** Renders a result object as human-readable `key: value` lines (never secrets). */
|
|
9
12
|
function toHuman(result) {
|
|
10
13
|
return (Object.entries(result)
|
|
@@ -31,11 +34,30 @@ export function run(argv, stdin) {
|
|
|
31
34
|
if (parsed.writeHeader !== undefined && !parsed.envelope) {
|
|
32
35
|
throw new UsageError("--write-header requires --envelope");
|
|
33
36
|
}
|
|
37
|
+
if (parsed.harness !== undefined && parsed.command !== "terminal id") {
|
|
38
|
+
throw new UsageError("--harness is only valid for `terminal id`");
|
|
39
|
+
}
|
|
40
|
+
if (parsed.terminal !== undefined) {
|
|
41
|
+
if (!TERMINAL_COMMANDS.has(parsed.command)) {
|
|
42
|
+
throw new UsageError("--terminal is only valid for `key generate`, `pop sign` and `voucher sign`");
|
|
43
|
+
}
|
|
44
|
+
if (parsed.key !== undefined || parsed.out !== undefined) {
|
|
45
|
+
throw new UsageError("--terminal replaces --key / --out; pass only one");
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
const terminalKey = parsed.terminal !== undefined && parsed.command !== "key generate"
|
|
49
|
+
? terminalKeyPath(parsed.terminal, "read")
|
|
50
|
+
: undefined;
|
|
34
51
|
let result;
|
|
35
52
|
switch (parsed.command) {
|
|
36
53
|
case "capabilities":
|
|
37
54
|
result = capabilitiesResult();
|
|
38
55
|
break;
|
|
56
|
+
case "terminal id":
|
|
57
|
+
if (parsed.harness === undefined)
|
|
58
|
+
throw new UsageError("terminal id requires --harness <name>");
|
|
59
|
+
result = { terminal_id: resolveHarnessTerminalId(parsed.harness) };
|
|
60
|
+
break;
|
|
39
61
|
case "payment-id":
|
|
40
62
|
result = paymentIdResult(readInput(parsed.input, stdin));
|
|
41
63
|
break;
|
|
@@ -44,7 +66,7 @@ export function run(argv, stdin) {
|
|
|
44
66
|
break;
|
|
45
67
|
case "voucher sign":
|
|
46
68
|
if (parsed.envelope) {
|
|
47
|
-
result = voucherSignEnvelopeResult(readInput(parsed.input, stdin), parsed.key, stdin);
|
|
69
|
+
result = voucherSignEnvelopeResult(readInput(parsed.input, stdin), terminalKey ?? parsed.key, stdin);
|
|
48
70
|
if (parsed.writeHeader !== undefined) {
|
|
49
71
|
const headerName = result.header_name;
|
|
50
72
|
const headerValue = result.header_value;
|
|
@@ -76,20 +98,28 @@ export function run(argv, stdin) {
|
|
|
76
98
|
}
|
|
77
99
|
}
|
|
78
100
|
else {
|
|
79
|
-
result = voucherSignResult(readInput(parsed.input, stdin), parsed.key, stdin);
|
|
101
|
+
result = voucherSignResult(readInput(parsed.input, stdin), terminalKey ?? parsed.key, stdin);
|
|
80
102
|
}
|
|
81
103
|
break;
|
|
82
104
|
case "key generate": {
|
|
83
105
|
const input = readInput(parsed.input, stdin);
|
|
84
106
|
assertInputSchema("key generate", input);
|
|
85
|
-
|
|
107
|
+
let out = parsed.out;
|
|
108
|
+
if (parsed.terminal !== undefined) {
|
|
109
|
+
// The key file is named by --terminal, so the key inside must be bound to it too.
|
|
110
|
+
if (input.terminal_id !== parsed.terminal) {
|
|
111
|
+
throw new SignerError("TERMINAL_MISMATCH", "input terminal_id does not match --terminal");
|
|
112
|
+
}
|
|
113
|
+
out = terminalKeyPath(parsed.terminal, "ensure");
|
|
114
|
+
}
|
|
115
|
+
result = keyGenerateResult(input, out);
|
|
86
116
|
assertOutputSchema("key generate", result);
|
|
87
117
|
break;
|
|
88
118
|
}
|
|
89
119
|
case "pop sign": {
|
|
90
120
|
const input = readInput(parsed.input, stdin);
|
|
91
121
|
assertInputSchema("pop sign", input);
|
|
92
|
-
result = popSignResult(input, parsed.key, stdin);
|
|
122
|
+
result = popSignResult(input, terminalKey ?? parsed.key, stdin);
|
|
93
123
|
assertOutputSchema("pop sign", result);
|
|
94
124
|
break;
|
|
95
125
|
}
|
|
@@ -2,7 +2,7 @@ import { lstatSync, readFileSync, realpathSync, statSync } from "node:fs";
|
|
|
2
2
|
import { homedir, platform, userInfo } from "node:os";
|
|
3
3
|
import { isAbsolute, join, resolve, sep } from "node:path";
|
|
4
4
|
import { SignerError } from "../errors.js";
|
|
5
|
-
const DEFAULT_SUBDIR = [".agents", "sohopay-agent-workload"];
|
|
5
|
+
export const DEFAULT_SUBDIR = [".agents", "sohopay-agent-workload"];
|
|
6
6
|
const CONFIG_REL = [".config", "sohopay-signer", "config.json"];
|
|
7
7
|
function invalid(message) {
|
|
8
8
|
throw new SignerError("KEY_PATH_INVALID", message);
|
package/dist/errors.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** Typed error taxonomy. Hosts (S12) use `code` to tell terminal from retryable. */
|
|
2
|
-
export type SignerErrorCode = "VOUCHER_FIELD_NOT_STRING" | "POP_IAT_NOT_INTEGER" | "SIGNING_SCHEME_NOT_ALLOWED" | "PRIVATE_KEY_MATERIAL_REJECTED" | "INVALID_PRIVATE_KEY" | "INVALID_PUBLIC_JWK" | "PAYMENT_ID_MISMATCH" | "AGENT_KEY_JKT_MISMATCH" | "MALFORMED_ENVELOPE" | "INVALID_TERMINAL_ID" | "INVALID_BORROWER_ID" | "INSECURE_KEY_PERMISSIONS" | "STORED_KEY_CORRUPT" | "IDEMPOTENCY_PAYLOAD_MISMATCH" | "OPERATION_NOT_FOUND" | "KEY_PATH_INVALID" | "CROSS_BORROWER_KEY" | "TERMINAL_MISMATCH" | "KEY_INTEGRITY_FAILED" | "KEY_PERSIST_FAILED" | "INLINE_KEY_REJECTED" | "MALFORMED_INPUT";
|
|
2
|
+
export type SignerErrorCode = "VOUCHER_FIELD_NOT_STRING" | "POP_IAT_NOT_INTEGER" | "SIGNING_SCHEME_NOT_ALLOWED" | "PRIVATE_KEY_MATERIAL_REJECTED" | "INVALID_PRIVATE_KEY" | "INVALID_PUBLIC_JWK" | "PAYMENT_ID_MISMATCH" | "AGENT_KEY_JKT_MISMATCH" | "MALFORMED_ENVELOPE" | "INVALID_TERMINAL_ID" | "INVALID_HARNESS" | "INVALID_BORROWER_ID" | "INSECURE_KEY_PERMISSIONS" | "STORED_KEY_CORRUPT" | "IDEMPOTENCY_PAYLOAD_MISMATCH" | "OPERATION_NOT_FOUND" | "KEY_PATH_INVALID" | "CROSS_BORROWER_KEY" | "TERMINAL_MISMATCH" | "KEY_INTEGRITY_FAILED" | "KEY_PERSIST_FAILED" | "INLINE_KEY_REJECTED" | "MALFORMED_INPUT";
|
|
3
3
|
/** All SDK-raised failures carry a stable `code` from {@link SignerErrorCode}. */
|
|
4
4
|
export declare class SignerError extends Error {
|
|
5
5
|
readonly code: SignerErrorCode;
|
package/dist/terminal.d.ts
CHANGED
|
@@ -16,3 +16,16 @@ export interface ResolveTerminalIdOptions {
|
|
|
16
16
|
* under the data dir (minted + persisted on first use).
|
|
17
17
|
*/
|
|
18
18
|
export declare function resolveTerminalId(options?: ResolveTerminalIdOptions): string;
|
|
19
|
+
/**
|
|
20
|
+
* Harnesses that may hold their own terminal id. A fixed list, so the slug is a safe
|
|
21
|
+
* single path segment and no caller-chosen string ever names a directory.
|
|
22
|
+
*/
|
|
23
|
+
export declare const HARNESSES: readonly ["antigravity", "claude-code", "codex", "cursor", "hermes"];
|
|
24
|
+
export type Harness = (typeof HARNESSES)[number];
|
|
25
|
+
/**
|
|
26
|
+
* Per-harness terminal id: `{harness}:{uuid}` persisted at `<dataDir>/<harness>/terminal_id`
|
|
27
|
+
* (dir 0700, file 0600), minted on first use and stable afterwards. Unlike
|
|
28
|
+
* {@link resolveTerminalId} it ignores `SOHO_TERMINAL_ID`: a host-wide override would
|
|
29
|
+
* collapse every harness back onto one terminal.
|
|
30
|
+
*/
|
|
31
|
+
export declare function resolveHarnessTerminalId(harness: string, dataDir?: string): string;
|
package/dist/terminal.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { randomUUID } from "node:crypto";
|
|
2
|
-
import { mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
2
|
+
import { chmodSync, linkSync, mkdirSync, readFileSync, unlinkSync, writeFileSync } from "node:fs";
|
|
3
3
|
import { homedir, hostname } from "node:os";
|
|
4
4
|
import { dirname, join } from "node:path";
|
|
5
5
|
import { SignerError } from "./errors.js";
|
|
@@ -88,3 +88,55 @@ export function resolveTerminalId(options = {}) {
|
|
|
88
88
|
persistTerminalId(filePath, minted);
|
|
89
89
|
return minted;
|
|
90
90
|
}
|
|
91
|
+
/**
|
|
92
|
+
* Harnesses that may hold their own terminal id. A fixed list, so the slug is a safe
|
|
93
|
+
* single path segment and no caller-chosen string ever names a directory.
|
|
94
|
+
*/
|
|
95
|
+
export const HARNESSES = ["antigravity", "claude-code", "codex", "cursor", "hermes"];
|
|
96
|
+
/**
|
|
97
|
+
* Per-harness terminal id: `{harness}:{uuid}` persisted at `<dataDir>/<harness>/terminal_id`
|
|
98
|
+
* (dir 0700, file 0600), minted on first use and stable afterwards. Unlike
|
|
99
|
+
* {@link resolveTerminalId} it ignores `SOHO_TERMINAL_ID`: a host-wide override would
|
|
100
|
+
* collapse every harness back onto one terminal.
|
|
101
|
+
*/
|
|
102
|
+
export function resolveHarnessTerminalId(harness, dataDir) {
|
|
103
|
+
if (!HARNESSES.includes(harness)) {
|
|
104
|
+
throw new SignerError("INVALID_HARNESS", `--harness must be one of: ${HARNESSES.join(", ")}`);
|
|
105
|
+
}
|
|
106
|
+
const dir = join(resolveDataDir(dataDir), harness);
|
|
107
|
+
const filePath = join(dir, "terminal_id");
|
|
108
|
+
const persisted = readHarnessTerminalId(filePath, harness);
|
|
109
|
+
if (persisted)
|
|
110
|
+
return persisted;
|
|
111
|
+
mkdirSync(dir, { recursive: true, mode: 0o700 });
|
|
112
|
+
chmodSync(dir, 0o700);
|
|
113
|
+
const minted = `${harness}:${randomUUID()}`;
|
|
114
|
+
// Write a private temp file, then publish it with link(2): the id appears complete or
|
|
115
|
+
// not at all, so a racing first call can never read a half-written file, and EEXIST
|
|
116
|
+
// means someone else won and their id is already whole.
|
|
117
|
+
const tmp = join(dir, `.terminal_id.${process.pid}.${randomUUID()}`);
|
|
118
|
+
writeFileSync(tmp, `${minted}\n`, { encoding: "utf8", mode: 0o600, flag: "wx" });
|
|
119
|
+
try {
|
|
120
|
+
linkSync(tmp, filePath);
|
|
121
|
+
return minted;
|
|
122
|
+
}
|
|
123
|
+
catch (error) {
|
|
124
|
+
if (error.code !== "EEXIST")
|
|
125
|
+
throw error;
|
|
126
|
+
const winner = readHarnessTerminalId(filePath, harness);
|
|
127
|
+
if (!winner)
|
|
128
|
+
throw new SignerError("INVALID_TERMINAL_ID", `${filePath} holds no valid terminal id`);
|
|
129
|
+
return winner;
|
|
130
|
+
}
|
|
131
|
+
finally {
|
|
132
|
+
unlinkSync(tmp);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
/** Reads the persisted id and refuses one minted for another harness (a copied or edited file). */
|
|
136
|
+
function readHarnessTerminalId(filePath, harness) {
|
|
137
|
+
const id = readPersistedTerminalId(filePath);
|
|
138
|
+
if (id !== undefined && !id.startsWith(`${harness}:`)) {
|
|
139
|
+
throw new SignerError("INVALID_TERMINAL_ID", `${filePath} holds an id that does not belong to ${harness}`);
|
|
140
|
+
}
|
|
141
|
+
return id;
|
|
142
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sohopay/agent-signer",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "Deterministic client-side signer for SohoPay Protocol V2 agent payments: Ed25519 vouchers, PoP challenges, RFC 7638 jkt. Holds agent workload keys only — never borrower keys.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -35,10 +35,5 @@
|
|
|
35
35
|
},
|
|
36
36
|
"engines": {
|
|
37
37
|
"node": ">=18"
|
|
38
|
-
}
|
|
39
|
-
"publishConfig": {
|
|
40
|
-
"registry": "https://registry.npmjs.org",
|
|
41
|
-
"access": "public"
|
|
42
|
-
},
|
|
43
|
-
"license": "Apache-2.0"
|
|
38
|
+
}
|
|
44
39
|
}
|