@skillrecordings/cli 0.2.2 → 0.3.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.
@@ -53,7 +53,7 @@ import {
53
53
  storeDraftSuccess,
54
54
  validate,
55
55
  validateSync
56
- } from "./chunk-SASXI5PZ.js";
56
+ } from "./chunk-MF3GI37W.js";
57
57
  import "./chunk-KEV3QKXP.js";
58
58
  import "./chunk-HK3PEWFD.js";
59
59
  import "./chunk-WYKL32C3.js";
@@ -117,4 +117,4 @@ export {
117
117
  validate,
118
118
  validateSync
119
119
  };
120
- //# sourceMappingURL=pipeline-W23TKSVR.js.map
120
+ //# sourceMappingURL=pipeline-F5FZCKB7.js.map
package/dist/preload.js CHANGED
@@ -1,6 +1,3 @@
1
- import {
2
- decrypt
3
- } from "./chunk-MNFDM56Q.js";
4
1
  import {
5
2
  init_esm_shims
6
3
  } from "./chunk-WFANXVQG.js";
@@ -11,12 +8,9 @@ import path2 from "path";
11
8
 
12
9
  // src/lib/env-loader.ts
13
10
  init_esm_shims();
14
- import { execSync } from "child_process";
15
11
  import fs from "fs/promises";
16
- import os from "os";
17
12
  import path from "path";
18
13
  import { config } from "dotenv-flow";
19
- var OP_AGE_KEY_REF = "op://Support/skill-cli-age-key/private_key";
20
14
  async function loadSecrets(cliDirOverride) {
21
15
  const cliDir2 = cliDirOverride ?? path.resolve(import.meta.dirname, "../..");
22
16
  const localEnvExists = await checkLocalEnv(cliDir2);
@@ -24,76 +18,10 @@ async function loadSecrets(cliDirOverride) {
24
18
  config({ path: cliDir2, silent: true });
25
19
  return;
26
20
  }
27
- const encryptedPath = path.join(cliDir2, ".env.encrypted");
28
- const encryptedExists = await fileExists(encryptedPath);
29
- if (encryptedExists) {
30
- let privateKey = process.env.AGE_SECRET_KEY;
31
- if (!privateKey) {
32
- privateKey = await tryLoadKeyFrom1Password();
33
- }
34
- if (!privateKey) {
35
- throw new Error(
36
- "Found .env.encrypted but cannot decrypt.\n\nOptions:\n1. Set AGE_SECRET_KEY env var with the private key\n2. Create ~/.op-token with 1Password service account token\n\nSee docs/CLI-AUTH.md for setup instructions."
37
- );
38
- }
39
- try {
40
- const encryptedData = await fs.readFile(encryptedPath);
41
- const decrypted = await decrypt(encryptedData, privateKey);
42
- parseAndInjectEnv(decrypted);
43
- return;
44
- } catch (error) {
45
- throw new Error(
46
- `Failed to decrypt .env.encrypted: ${error instanceof Error ? error.message : String(error)}
47
- Check that the decryption key matches the encryption key.`
48
- );
49
- }
50
- }
51
21
  throw new Error(
52
- "No environment configuration found.\n\nOptions:\n1. Create .env.local in packages/cli/ with your secrets\n2. Set AGE_SECRET_KEY and use encrypted .env.encrypted\n3. Create ~/.op-token for automatic 1Password-based decryption\n\nSee docs/CLI-AUTH.md for setup instructions."
22
+ "No environment configuration found.\n\nOptions:\n1. Create .env.local in packages/cli/ with your secrets\n\nSee docs/CLI-AUTH.md for setup instructions."
53
23
  );
54
24
  }
55
- async function tryLoadKeyFrom1Password() {
56
- const opTokenPath = path.join(os.homedir(), ".op-token");
57
- if (!await fileExists(opTokenPath)) {
58
- return void 0;
59
- }
60
- try {
61
- const tokenFileContent = await fs.readFile(opTokenPath, "utf-8");
62
- const token = parseOpTokenFile(tokenFileContent);
63
- if (!token) {
64
- return void 0;
65
- }
66
- process.env.OP_SERVICE_ACCOUNT_TOKEN = token;
67
- const privateKey = execSync(`op read "${OP_AGE_KEY_REF}"`, {
68
- encoding: "utf-8",
69
- stdio: ["ignore", "pipe", "pipe"],
70
- env: process.env
71
- // Explicit env pass required for token to be visible
72
- }).trim();
73
- return privateKey || void 0;
74
- } catch {
75
- return void 0;
76
- }
77
- }
78
- function parseOpTokenFile(content) {
79
- const lines = content.split("\n");
80
- for (const line of lines) {
81
- const trimmed = line.trim();
82
- const match = trimmed.match(
83
- /^export\s+OP_SERVICE_ACCOUNT_TOKEN\s*=\s*["']?([^"'\s]+)["']?/
84
- );
85
- if (match?.[1]) {
86
- return match[1];
87
- }
88
- const bareMatch = trimmed.match(
89
- /^OP_SERVICE_ACCOUNT_TOKEN\s*=\s*["']?([^"'\s]+)["']?/
90
- );
91
- if (bareMatch?.[1]) {
92
- return bareMatch[1];
93
- }
94
- }
95
- return void 0;
96
- }
97
25
  async function checkLocalEnv(dir) {
98
26
  const candidates = [".env.local", ".env"];
99
27
  for (const file of candidates) {
@@ -111,27 +39,6 @@ async function fileExists(filePath) {
111
39
  return false;
112
40
  }
113
41
  }
114
- function parseAndInjectEnv(content) {
115
- const lines = content.split("\n");
116
- for (const line of lines) {
117
- const trimmed = line.trim();
118
- if (!trimmed || trimmed.startsWith("#")) {
119
- continue;
120
- }
121
- const eqIndex = trimmed.indexOf("=");
122
- if (eqIndex === -1) {
123
- continue;
124
- }
125
- const key = trimmed.slice(0, eqIndex).trim();
126
- let value = trimmed.slice(eqIndex + 1).trim();
127
- if (value.startsWith('"') && value.endsWith('"') || value.startsWith("'") && value.endsWith("'")) {
128
- value = value.slice(1, -1);
129
- }
130
- if (key && process.env[key] === void 0) {
131
- process.env[key] = value;
132
- }
133
- }
134
- }
135
42
 
136
43
  // preload.ts
137
44
  var dirname = import.meta.dirname;
@@ -1 +1 @@
1
- {"version":3,"sources":["../preload.ts","../src/lib/env-loader.ts"],"sourcesContent":["import path from 'node:path'\nimport { loadSecrets } from './src/lib/env-loader.js'\n\n// Calculate CLI package root - works for both dev (preload.ts) and bundled (dist/preload.js)\n// In dev: dirname is packages/cli, so '..' goes to packages, '../..' to root - wrong, we want '.'\n// In bundle: dirname is packages/cli/dist, so '..' goes to packages/cli - correct\n// Solution: check if we're in dist/ and adjust accordingly\nconst dirname = import.meta.dirname\nconst cliDir =\n dirname.endsWith('/dist') || dirname.endsWith('\\\\dist')\n ? path.resolve(dirname, '..')\n : dirname\n\n// Don't crash for commands that don't need secrets (--help, auth, etc.)\nconst noSecretsNeeded =\n process.argv.length <= 2 ||\n process.argv.some((a) =>\n ['--help', '-h', '--version', '-V', 'auth'].includes(a)\n )\n\ntry {\n await loadSecrets(cliDir)\n} catch (err) {\n if (noSecretsNeeded) {\n // Skip env validation so index.js can load without DATABASE_URL\n process.env.SKIP_ENV_VALIDATION = '1'\n } else {\n console.error(err instanceof Error ? err.message : String(err))\n process.exit(1)\n }\n}\n","import { execSync } from 'node:child_process'\nimport fs from 'node:fs/promises'\nimport os from 'node:os'\nimport path from 'node:path'\nimport { config } from 'dotenv-flow'\nimport { decrypt } from './crypto.js'\n\n/** 1Password reference for the age private key */\nconst OP_AGE_KEY_REF = 'op://Support/skill-cli-age-key/private_key'\n\n/**\n * Load secrets from layered fallback:\n * 1. Local .env/.env.local files\n * 2. Encrypted .env.encrypted file (auto-fetches key from 1Password if ~/.op-token exists)\n * 3. Fail with clear instructions\n *\n * Injects secrets into process.env\n *\n * @param cliDirOverride - Optional path to CLI package root (use when calling from bundled code)\n */\nexport async function loadSecrets(cliDirOverride?: string): Promise<void> {\n const cliDir = cliDirOverride ?? path.resolve(import.meta.dirname, '../..')\n\n // Layer 1: Check for local .env files\n const localEnvExists = await checkLocalEnv(cliDir)\n if (localEnvExists) {\n config({ path: cliDir, silent: true })\n return\n }\n\n // Layer 2: Try encrypted fallback\n const encryptedPath = path.join(cliDir, '.env.encrypted')\n const encryptedExists = await fileExists(encryptedPath)\n\n if (encryptedExists) {\n // Try to get the private key - either from env or via 1Password\n let privateKey = process.env.AGE_SECRET_KEY\n\n if (!privateKey) {\n // Attempt to load from 1Password via ~/.op-token\n privateKey = await tryLoadKeyFrom1Password()\n }\n\n if (!privateKey) {\n throw new Error(\n 'Found .env.encrypted but cannot decrypt.\\n\\n' +\n 'Options:\\n' +\n '1. Set AGE_SECRET_KEY env var with the private key\\n' +\n '2. Create ~/.op-token with 1Password service account token\\n\\n' +\n 'See docs/CLI-AUTH.md for setup instructions.'\n )\n }\n\n try {\n const encryptedData = await fs.readFile(encryptedPath)\n const decrypted = await decrypt(encryptedData, privateKey)\n\n // Parse decrypted env file format (KEY=VALUE lines)\n parseAndInjectEnv(decrypted)\n return\n } catch (error) {\n throw new Error(\n `Failed to decrypt .env.encrypted: ${error instanceof Error ? error.message : String(error)}\\n` +\n 'Check that the decryption key matches the encryption key.'\n )\n }\n }\n\n // Layer 3: Nothing found - fail with instructions\n throw new Error(\n 'No environment configuration found.\\n\\n' +\n 'Options:\\n' +\n '1. Create .env.local in packages/cli/ with your secrets\\n' +\n '2. Set AGE_SECRET_KEY and use encrypted .env.encrypted\\n' +\n '3. Create ~/.op-token for automatic 1Password-based decryption\\n\\n' +\n 'See docs/CLI-AUTH.md for setup instructions.'\n )\n}\n\n/**\n * Try to load the age private key from 1Password using ~/.op-token\n * Returns the key if successful, undefined otherwise\n */\nasync function tryLoadKeyFrom1Password(): Promise<string | undefined> {\n const opTokenPath = path.join(os.homedir(), '.op-token')\n\n // Check if ~/.op-token exists\n if (!(await fileExists(opTokenPath))) {\n return undefined\n }\n\n try {\n // Read and parse ~/.op-token (format: export VAR=\"value\")\n const tokenFileContent = await fs.readFile(opTokenPath, 'utf-8')\n const token = parseOpTokenFile(tokenFileContent)\n\n if (!token) {\n return undefined\n }\n\n // Set the token in env for op CLI to use\n process.env.OP_SERVICE_ACCOUNT_TOKEN = token\n\n // Fetch the age private key from 1Password\n const privateKey = execSync(`op read \"${OP_AGE_KEY_REF}\"`, {\n encoding: 'utf-8',\n stdio: ['ignore', 'pipe', 'pipe'],\n env: process.env, // Explicit env pass required for token to be visible\n }).trim()\n\n return privateKey || undefined\n } catch {\n // Silently fail - caller will show appropriate error\n return undefined\n }\n}\n\n/**\n * Parse ~/.op-token file format: export OP_SERVICE_ACCOUNT_TOKEN=\"value\"\n */\nfunction parseOpTokenFile(content: string): string | undefined {\n const lines = content.split('\\n')\n\n for (const line of lines) {\n const trimmed = line.trim()\n\n // Match: export OP_SERVICE_ACCOUNT_TOKEN=\"value\" or =value\n const match = trimmed.match(\n /^export\\s+OP_SERVICE_ACCOUNT_TOKEN\\s*=\\s*[\"']?([^\"'\\s]+)[\"']?/\n )\n if (match?.[1]) {\n return match[1]\n }\n\n // Also support bare assignment: OP_SERVICE_ACCOUNT_TOKEN=value\n const bareMatch = trimmed.match(\n /^OP_SERVICE_ACCOUNT_TOKEN\\s*=\\s*[\"']?([^\"'\\s]+)[\"']?/\n )\n if (bareMatch?.[1]) {\n return bareMatch[1]\n }\n }\n\n return undefined\n}\n\n/**\n * Check if any local .env files exist\n */\nasync function checkLocalEnv(dir: string): Promise<boolean> {\n const candidates = ['.env.local', '.env']\n for (const file of candidates) {\n if (await fileExists(path.join(dir, file))) {\n return true\n }\n }\n return false\n}\n\n/**\n * Check if a file exists\n */\nasync function fileExists(filePath: string): Promise<boolean> {\n try {\n await fs.access(filePath)\n return true\n } catch {\n return false\n }\n}\n\n/**\n * Parse env file format (KEY=VALUE) and inject into process.env\n * Handles quoted values, comments, and empty lines\n */\nfunction parseAndInjectEnv(content: string): void {\n const lines = content.split('\\n')\n\n for (const line of lines) {\n const trimmed = line.trim()\n\n // Skip comments and empty lines\n if (!trimmed || trimmed.startsWith('#')) {\n continue\n }\n\n const eqIndex = trimmed.indexOf('=')\n if (eqIndex === -1) {\n continue\n }\n\n const key = trimmed.slice(0, eqIndex).trim()\n let value = trimmed.slice(eqIndex + 1).trim()\n\n // Remove quotes if present\n if (\n (value.startsWith('\"') && value.endsWith('\"')) ||\n (value.startsWith(\"'\") && value.endsWith(\"'\"))\n ) {\n value = value.slice(1, -1)\n }\n\n // Only set if not already defined (respect existing env vars)\n if (key && process.env[key] === undefined) {\n process.env[key] = value\n }\n }\n}\n"],"mappings":";;;;;;;;AAAA;AAAA,OAAOA,WAAU;;;ACAjB;AAAA,SAAS,gBAAgB;AACzB,OAAO,QAAQ;AACf,OAAO,QAAQ;AACf,OAAO,UAAU;AACjB,SAAS,cAAc;AAIvB,IAAM,iBAAiB;AAYvB,eAAsB,YAAY,gBAAwC;AACxE,QAAMC,UAAS,kBAAkB,KAAK,QAAQ,YAAY,SAAS,OAAO;AAG1E,QAAM,iBAAiB,MAAM,cAAcA,OAAM;A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AE;AAAA,IAC3B;AAGA,QAAI,OAAO,QAAQ,IAAI,GAAG,MAAM,QAAW;AACzC,cAAQ,IAAI,GAAG,IAAI;AAAA,IACrB;AAAA,EACF;AACF;;;ADxMA,IAAM,UAAU,YAAY;AAC5B,IAAM,SACJ,QAAQ,SAAS,OAAO,KAAK,QAAQ,SAAS,QAAQ,IAClDC,MAAK,QAAQ,SAAS,IAAI,IAC1B;AAGN,IAAM,kBACJ,QAAQ,KAAK,UAAU,KACvB,QAAQ,KAAK;AAAA,EAAK,CAAC,MACjB,CAAC,UAAU,MAAM,aAAa,MAAM,MAAM,EAAE,SAAS,CAAC;AACxD;AAEF,IAAI;AACF,QAAM,YAAY,MAAM;AAC1B,SAAS,KAAK;AACZ,MAAI,iBAAiB;AAEnB,YAAQ,IAAI,sBAAsB;AAAA,EACpC,OAAO;AACL,YAAQ,MAAM,eAAe,QAAQ,IAAI,UAAU,OAAO,GAAG,CAAC;AAC9D,YAAQ,KAAK,CAAC;AAAA,EAChB;AACF;","names":["path","cliDir","path"]}
1
+ {"version":3,"sources":["../preload.ts","../src/lib/env-loader.ts"],"sourcesContent":["import path from 'node:path'\nimport { loadSecrets } from './src/lib/env-loader.js'\n\n// Calculate CLI package root - works for both dev (preload.ts) and bundled (dist/preload.js)\n// In dev: dirname is packages/cli, so '..' goes to packages, '../..' to root - wrong, we want '.'\n// In bundle: dirname is packages/cli/dist, so '..' goes to packages/cli - correct\n// Solution: check if we're in dist/ and adjust accordingly\nconst dirname = import.meta.dirname\nconst cliDir =\n dirname.endsWith('/dist') || dirname.endsWith('\\\\dist')\n ? path.resolve(dirname, '..')\n : dirname\n\n// Don't crash for commands that don't need secrets (--help, auth, etc.)\nconst noSecretsNeeded =\n process.argv.length <= 2 ||\n process.argv.some((a) =>\n ['--help', '-h', '--version', '-V', 'auth'].includes(a)\n )\n\ntry {\n await loadSecrets(cliDir)\n} catch (err) {\n if (noSecretsNeeded) {\n // Skip env validation so index.js can load without DATABASE_URL\n process.env.SKIP_ENV_VALIDATION = '1'\n } else {\n console.error(err instanceof Error ? err.message : String(err))\n process.exit(1)\n }\n}\n","import fs from 'node:fs/promises'\nimport path from 'node:path'\nimport { config } from 'dotenv-flow'\n\n/**\n * Load secrets from layered fallback:\n * 1. Local .env/.env.local files\n * 2. Fail with clear instructions\n *\n * Injects secrets into process.env\n *\n * @param cliDirOverride - Optional path to CLI package root (use when calling from bundled code)\n */\nexport async function loadSecrets(cliDirOverride?: string): Promise<void> {\n const cliDir = cliDirOverride ?? path.resolve(import.meta.dirname, '../..')\n\n // Layer 1: Check for local .env files\n const localEnvExists = await checkLocalEnv(cliDir)\n if (localEnvExists) {\n config({ path: cliDir, silent: true })\n return\n }\n\n // Layer 2: Nothing found - fail with instructions\n throw new Error(\n 'No environment configuration found.\\n\\n' +\n 'Options:\\n' +\n '1. Create .env.local in packages/cli/ with your secrets\\n\\n' +\n 'See docs/CLI-AUTH.md for setup instructions.'\n )\n}\n\n/**\n * Check if any local .env files exist\n */\nasync function checkLocalEnv(dir: string): Promise<boolean> {\n const candidates = ['.env.local', '.env']\n for (const file of candidates) {\n if (await fileExists(path.join(dir, file))) {\n return true\n }\n }\n return false\n}\n\n/**\n * Check if a file exists\n */\nasync function fileExists(filePath: string): Promise<boolean> {\n try {\n await fs.access(filePath)\n return true\n } catch {\n return false\n }\n}\n"],"mappings":";;;;;AAAA;AAAA,OAAOA,WAAU;;;ACAjB;AAAA,OAAO,QAAQ;AACf,OAAO,UAAU;AACjB,SAAS,cAAc;AAWvB,eAAsB,YAAY,gBAAwC;AACxE,QAAMC,UAAS,kBAAkB,KAAK,QAAQ,YAAY,SAAS,OAAO;AAG1E,QAAM,iBAAiB,MAAM,cAAcA,OAAM;AACjD,MAAI,gBAAgB;AAClB,WAAO,EAAE,MAAMA,SAAQ,QAAQ,KAAK,CAAC;AACrC;AAAA,EACF;AAGA,QAAM,IAAI;AAAA,IACR;AAAA,EAIF;AACF;AAKA,eAAe,cAAc,KAA+B;AAC1D,QAAM,aAAa,CAAC,cAAc,MAAM;AACxC,aAAW,QAAQ,YAAY;AAC7B,QAAI,MAAM,WAAW,KAAK,KAAK,KAAK,IAAI,CAAC,GAAG;AAC1C,aAAO;AAAA,IACT;AAAA,EACF;AACA,SAAO;AACT;AAKA,eAAe,WAAW,UAAoC;AAC5D,MAAI;AACF,UAAM,GAAG,OAAO,QAAQ;AACxB,WAAO;AAAA,EACT,QAAQ;AACN,WAAO;AAAA,EACT;AACF;;;ADhDA,IAAM,UAAU,YAAY;AAC5B,IAAM,SACJ,QAAQ,SAAS,OAAO,KAAK,QAAQ,SAAS,QAAQ,IAClDC,MAAK,QAAQ,SAAS,IAAI,IAC1B;AAGN,IAAM,kBACJ,QAAQ,KAAK,UAAU,KACvB,QAAQ,KAAK;AAAA,EAAK,CAAC,MACjB,CAAC,UAAU,MAAM,aAAa,MAAM,MAAM,EAAE,SAAS,CAAC;AACxD;AAEF,IAAI;AACF,QAAM,YAAY,MAAM;AAC1B,SAAS,KAAK;AACZ,MAAI,iBAAiB;AAEnB,YAAQ,IAAI,sBAAsB;AAAA,EACpC,OAAO;AACL,YAAQ,MAAM,eAAe,QAAQ,IAAI,UAAU,OAAO,GAAG,CAAC;AAC9D,YAAQ,KAAK,CAAC;AAAA,EAChB;AACF;","names":["path","cliDir","path"]}
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@skillrecordings/cli",
3
- "version": "0.2.2",
3
+ "version": "0.3.0",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "skill": "./bin/skill.mjs"
7
7
  },
8
- "files": ["dist", "bin"],
8
+ "files": ["dist", "bin", ".env.encrypted"],
9
9
  "scripts": {
10
10
  "dev": "bun src/index.ts",
11
11
  "build": "tsup",
@@ -26,7 +26,6 @@
26
26
  "dependencies": {
27
27
  "@axiomhq/js": "^1.3.1",
28
28
  "@inquirer/prompts": "^8.2.0",
29
- "age-encryption": "^0.3.0",
30
29
  "ai": "^6.0.49",
31
30
  "commander": "^12.1.0",
32
31
  "dotenv-flow": "^4.1.0",
@@ -1,36 +0,0 @@
1
- import {
2
- init_esm_shims
3
- } from "./chunk-WFANXVQG.js";
4
-
5
- // src/lib/crypto.ts
6
- init_esm_shims();
7
- import {
8
- Decrypter,
9
- Encrypter,
10
- generateIdentity,
11
- identityToRecipient
12
- } from "age-encryption";
13
- async function generateKeypair() {
14
- const privateKey = await generateIdentity();
15
- const publicKey = await identityToRecipient(privateKey);
16
- return { publicKey, privateKey };
17
- }
18
- async function encrypt(data, recipientPublicKey) {
19
- const encrypter = new Encrypter();
20
- encrypter.addRecipient(recipientPublicKey);
21
- const input = typeof data === "string" ? data : new TextDecoder().decode(data);
22
- return encrypter.encrypt(input);
23
- }
24
- async function decrypt(encrypted, privateKey) {
25
- const decrypter = new Decrypter();
26
- decrypter.addIdentity(privateKey);
27
- const input = encrypted instanceof Buffer ? new Uint8Array(encrypted) : encrypted;
28
- return decrypter.decrypt(input, "text");
29
- }
30
-
31
- export {
32
- generateKeypair,
33
- encrypt,
34
- decrypt
35
- };
36
- //# sourceMappingURL=chunk-MNFDM56Q.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/lib/crypto.ts"],"sourcesContent":["import {\n Decrypter,\n Encrypter,\n generateIdentity,\n identityToRecipient,\n} from 'age-encryption'\n\nexport interface Keypair {\n publicKey: string\n privateKey: string\n}\n\n/**\n * Generate an age keypair\n * @returns Keypair with publicKey (age1...) and privateKey (AGE-SECRET-KEY-1...)\n */\nexport async function generateKeypair(): Promise<Keypair> {\n const privateKey = await generateIdentity()\n const publicKey = await identityToRecipient(privateKey)\n return { publicKey, privateKey }\n}\n\n/**\n * Encrypt data with an age public key\n * @param data - String or Buffer to encrypt\n * @param recipientPublicKey - age public key (age1...)\n * @returns Encrypted data as Uint8Array\n */\nexport async function encrypt(\n data: string | Buffer,\n recipientPublicKey: string\n): Promise<Uint8Array> {\n const encrypter = new Encrypter()\n encrypter.addRecipient(recipientPublicKey)\n\n const input = typeof data === 'string' ? data : new TextDecoder().decode(data)\n return encrypter.encrypt(input)\n}\n\n/**\n * Decrypt data with an age private key\n * @param encrypted - Encrypted data as Uint8Array or Buffer\n * @param privateKey - age private key (AGE-SECRET-KEY-1...)\n * @returns Decrypted data as string\n */\nexport async function decrypt(\n encrypted: Uint8Array | Buffer,\n privateKey: string\n): Promise<string> {\n const decrypter = new Decrypter()\n decrypter.addIdentity(privateKey)\n\n const input =\n encrypted instanceof Buffer ? new Uint8Array(encrypted) : encrypted\n return decrypter.decrypt(input, 'text')\n}\n"],"mappings":";;;;;AAAA;AAAA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAWP,eAAsB,kBAAoC;AACxD,QAAM,aAAa,MAAM,iBAAiB;AAC1C,QAAM,YAAY,MAAM,oBAAoB,UAAU;AACtD,SAAO,EAAE,WAAW,WAAW;AACjC;AAQA,eAAsB,QACpB,MACA,oBACqB;AACrB,QAAM,YAAY,IAAI,UAAU;AAChC,YAAU,aAAa,kBAAkB;AAEzC,QAAM,QAAQ,OAAO,SAAS,WAAW,OAAO,IAAI,YAAY,EAAE,OAAO,IAAI;AAC7E,SAAO,UAAU,QAAQ,KAAK;AAChC;AAQA,eAAsB,QACpB,WACA,YACiB;AACjB,QAAM,YAAY,IAAI,UAAU;AAChC,YAAU,YAAY,UAAU;AAEhC,QAAM,QACJ,qBAAqB,SAAS,IAAI,WAAW,SAAS,IAAI;AAC5D,SAAO,UAAU,QAAQ,OAAO,MAAM;AACxC;","names":[]}