@seekrit/proxy 0.12.6 → 0.13.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/dist/index.js +50 -2
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -4,6 +4,54 @@ import { createHash } from "node:crypto";
|
|
|
4
4
|
import { chmodSync, existsSync, mkdirSync, renameSync, rmSync, writeFileSync } from "node:fs";
|
|
5
5
|
import { arch, homedir, platform } from "node:os";
|
|
6
6
|
import { dirname, join } from "node:path";
|
|
7
|
+
//#region ../../packages/crypto/src/shamir.ts
|
|
8
|
+
/**
|
|
9
|
+
* Shamir's Secret Sharing over GF(2^8) — the same field AES uses, with the
|
|
10
|
+
* reduction polynomial x^8 + x^4 + x^3 + x + 1 (0x11b). Splits a byte string
|
|
11
|
+
* into `shares` shares such that any `threshold` of them reconstruct the secret
|
|
12
|
+
* exactly and any fewer reveal nothing about it.
|
|
13
|
+
*
|
|
14
|
+
* This is the one hand-rolled primitive behind org recovery (P0-1): the org
|
|
15
|
+
* recovery private key is split into shares, each wrapped to a designated
|
|
16
|
+
* custodian's public key, so a quorum — never seekrit, never any single
|
|
17
|
+
* custodian below the threshold — can reconstruct it. See recovery.ts for the
|
|
18
|
+
* composition with key wrapping.
|
|
19
|
+
*
|
|
20
|
+
* Each secret byte gets its own degree-(threshold-1) polynomial whose constant
|
|
21
|
+
* term is that byte; a share is that polynomial family evaluated at one distinct
|
|
22
|
+
* nonzero x-coordinate. Reconstruction is Lagrange interpolation back to x = 0.
|
|
23
|
+
*
|
|
24
|
+
* Share wire format: a Uint8Array whose first byte is the share's distinct
|
|
25
|
+
* nonzero x-coordinate and whose remaining bytes are the evaluations p_j(x) for
|
|
26
|
+
* each secret byte j. Self-describing, so combineSecret() needs no external
|
|
27
|
+
* index — the x-coordinate survives being wrapped/unwrapped/re-wrapped intact.
|
|
28
|
+
*/
|
|
29
|
+
/** Russian-peasant multiply in GF(2^8) (mod 0x11b) — used only to seed tables. */
|
|
30
|
+
function peasantMul(a, b) {
|
|
31
|
+
let product = 0;
|
|
32
|
+
let x = a;
|
|
33
|
+
let y = b;
|
|
34
|
+
for (let i = 0; i < 8; i++) {
|
|
35
|
+
if (y & 1) product ^= x;
|
|
36
|
+
const carry = x & 128;
|
|
37
|
+
x = x << 1 & 255;
|
|
38
|
+
if (carry) x ^= 27;
|
|
39
|
+
y >>= 1;
|
|
40
|
+
}
|
|
41
|
+
return product;
|
|
42
|
+
}
|
|
43
|
+
const EXP = /* @__PURE__ */ new Uint8Array(512);
|
|
44
|
+
const LOG = /* @__PURE__ */ new Uint8Array(256);
|
|
45
|
+
{
|
|
46
|
+
let a = 1;
|
|
47
|
+
for (let i = 0; i < 255; i++) {
|
|
48
|
+
EXP[i] = a;
|
|
49
|
+
LOG[a] = i;
|
|
50
|
+
a = peasantMul(a, 3);
|
|
51
|
+
}
|
|
52
|
+
for (let i = 255; i < 512; i++) EXP[i] = EXP[i - 255];
|
|
53
|
+
}
|
|
54
|
+
//#endregion
|
|
7
55
|
//#region ../cli/src/cache.ts
|
|
8
56
|
/**
|
|
9
57
|
* `$XDG_CACHE_HOME/seekrit`, else `~/.cache/seekrit` — beside the config
|
|
@@ -47,7 +95,7 @@ function versionPrefix(version) {
|
|
|
47
95
|
return version.startsWith("v") ? version : `v${version}`;
|
|
48
96
|
}
|
|
49
97
|
function resolveVersion(explicit) {
|
|
50
|
-
return explicit ?? process.env.SEEKRIT_PROXY_VERSION ?? "0.
|
|
98
|
+
return explicit ?? process.env.SEEKRIT_PROXY_VERSION ?? "0.13.0";
|
|
51
99
|
}
|
|
52
100
|
function resolveBaseUrl(explicit) {
|
|
53
101
|
return (explicit ?? process.env.SEEKRIT_PROXY_BASE_URL ?? "https://proxy.seekrit.dev").replace(/\/+$/, "");
|
|
@@ -157,7 +205,7 @@ function signalNumber(signal) {
|
|
|
157
205
|
SIGTERM: 15
|
|
158
206
|
}[signal] ?? 0;
|
|
159
207
|
}
|
|
160
|
-
runProxyBinary(process.argv.slice(2), { version: "0.
|
|
208
|
+
runProxyBinary(process.argv.slice(2), { version: "0.13.0" }).then((code) => {
|
|
161
209
|
process.exitCode = code;
|
|
162
210
|
}).catch((err) => {
|
|
163
211
|
const message = err instanceof Error ? err.message : String(err);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@seekrit/proxy",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.0",
|
|
4
4
|
"description": "npx-able launcher for seekrit-proxy — swap {{seekrit:NAME}} placeholders in outbound requests for decrypted secrets, so an agent never holds the key.",
|
|
5
5
|
"homepage": "https://seekrit.dev/docs/guides/agent-proxy",
|
|
6
6
|
"repository": {
|
|
@@ -38,10 +38,10 @@
|
|
|
38
38
|
"node": ">=20"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"@types/node": "^26.6.
|
|
42
|
-
"tsdown": "^0.23.
|
|
43
|
-
"vitest": "^5.0.
|
|
44
|
-
"@seekrit/cli": "
|
|
41
|
+
"@types/node": "^26.6.5",
|
|
42
|
+
"tsdown": "^0.23.1",
|
|
43
|
+
"vitest": "^5.0.5",
|
|
44
|
+
"@seekrit/cli": "2.0.0"
|
|
45
45
|
},
|
|
46
46
|
"scripts": {
|
|
47
47
|
"build": "tsdown",
|