@seekrit/proxy 0.12.7 → 0.14.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.
Files changed (2) hide show
  1. package/dist/index.js +50 -4
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -4,7 +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 ../cli/src/cache.ts
7
+ // ../../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
+ // ../cli/src/cache.ts
8
55
  /**
9
56
  * `$XDG_CACHE_HOME/seekrit`, else `~/.cache/seekrit` — beside the config
10
57
  * directory holding the credential, never a shared temp directory.
@@ -47,7 +94,7 @@ function versionPrefix(version) {
47
94
  return version.startsWith("v") ? version : `v${version}`;
48
95
  }
49
96
  function resolveVersion(explicit) {
50
- return explicit ?? process.env.SEEKRIT_PROXY_VERSION ?? "0.12.7";
97
+ return explicit ?? process.env.SEEKRIT_PROXY_VERSION ?? "0.14.0";
51
98
  }
52
99
  function resolveBaseUrl(explicit) {
53
100
  return (explicit ?? process.env.SEEKRIT_PROXY_BASE_URL ?? "https://proxy.seekrit.dev").replace(/\/+$/, "");
@@ -157,12 +204,11 @@ function signalNumber(signal) {
157
204
  SIGTERM: 15
158
205
  }[signal] ?? 0;
159
206
  }
160
- runProxyBinary(process.argv.slice(2), { version: "0.12.7" }).then((code) => {
207
+ runProxyBinary(process.argv.slice(2), { version: "0.14.0" }).then((code) => {
161
208
  process.exitCode = code;
162
209
  }).catch((err) => {
163
210
  const message = err instanceof Error ? err.message : String(err);
164
211
  process.stderr.write(`seekrit-proxy: ${message}\n`);
165
212
  process.exit(1);
166
213
  });
167
- //#endregion
168
214
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seekrit/proxy",
3
- "version": "0.12.7",
3
+ "version": "0.14.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": {
@@ -39,9 +39,9 @@
39
39
  },
40
40
  "devDependencies": {
41
41
  "@types/node": "^26.6.5",
42
- "tsdown": "^0.23.1",
42
+ "tsdown": "^0.23.3",
43
43
  "vitest": "^5.0.5",
44
- "@seekrit/cli": "1.9.5"
44
+ "@seekrit/cli": "2.2.0"
45
45
  },
46
46
  "scripts": {
47
47
  "build": "tsdown",