@daski/pay 0.3.0 → 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 +18 -11
- package/dist/bin/daski.js +26 -11
- package/dist/bin/daski.js.map +1 -1
- package/dist/chain/reader.d.ts +92 -0
- package/dist/chain/reader.d.ts.map +1 -0
- package/dist/chain/reader.js +130 -0
- package/dist/chain/reader.js.map +1 -0
- package/dist/commands/approval.js +2 -2
- package/dist/commands/approval.js.map +1 -1
- package/dist/commands/buy.d.ts +0 -1
- package/dist/commands/buy.d.ts.map +1 -1
- package/dist/commands/buy.js +15 -22
- package/dist/commands/buy.js.map +1 -1
- package/dist/commands/confirmation.d.ts +322 -4
- package/dist/commands/confirmation.d.ts.map +1 -1
- package/dist/commands/confirmation.js +771 -60
- package/dist/commands/confirmation.js.map +1 -1
- package/dist/commands/doctor.d.ts +20 -0
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/doctor.js +204 -59
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/order.d.ts +37 -6
- package/dist/commands/order.d.ts.map +1 -1
- package/dist/commands/order.js +181 -103
- package/dist/commands/order.js.map +1 -1
- package/dist/commands/signPayment.d.ts +2 -2
- package/dist/commands/signPayment.d.ts.map +1 -1
- package/dist/commands/signPayment.js +10 -5
- package/dist/commands/signPayment.js.map +1 -1
- package/dist/commands/wallet.d.ts +3 -0
- package/dist/commands/wallet.d.ts.map +1 -1
- package/dist/commands/wallet.js +72 -16
- package/dist/commands/wallet.js.map +1 -1
- package/dist/config.d.ts +10 -2
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +41 -1
- package/dist/config.js.map +1 -1
- package/dist/context.d.ts +28 -3
- package/dist/context.d.ts.map +1 -1
- package/dist/context.js +72 -3
- package/dist/context.js.map +1 -1
- package/dist/gateway/client.d.ts +20 -17
- package/dist/gateway/client.d.ts.map +1 -1
- package/dist/gateway/client.js +62 -43
- package/dist/gateway/client.js.map +1 -1
- package/dist/gateway/lifecycle.d.ts +4 -1
- package/dist/gateway/lifecycle.d.ts.map +1 -1
- package/dist/gateway/lifecycle.js +10 -5
- package/dist/gateway/lifecycle.js.map +1 -1
- package/dist/gateway/metadata.d.ts +66 -0
- package/dist/gateway/metadata.d.ts.map +1 -0
- package/dist/gateway/metadata.js +152 -0
- package/dist/gateway/metadata.js.map +1 -0
- package/dist/gateway/purchase.d.ts +51 -67
- package/dist/gateway/purchase.d.ts.map +1 -1
- package/dist/gateway/purchase.js +153 -125
- package/dist/gateway/purchase.js.map +1 -1
- package/dist/host.d.ts +41 -0
- package/dist/host.d.ts.map +1 -0
- package/dist/host.js +112 -0
- package/dist/host.js.map +1 -0
- package/dist/index.d.ts +12 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -4
- package/dist/index.js.map +1 -1
- package/dist/signers/circleAgent.d.ts +37 -0
- package/dist/signers/circleAgent.d.ts.map +1 -0
- package/dist/signers/circleAgent.js +244 -0
- package/dist/signers/circleAgent.js.map +1 -0
- package/dist/signers/contract.d.ts +34 -0
- package/dist/signers/contract.d.ts.map +1 -0
- package/dist/signers/contract.js +47 -0
- package/dist/signers/contract.js.map +1 -0
- package/dist/signers/index.d.ts +16 -7
- package/dist/signers/index.d.ts.map +1 -1
- package/dist/signers/index.js +7 -3
- package/dist/signers/index.js.map +1 -1
- package/dist/signers/local.d.ts +5 -1
- package/dist/signers/local.d.ts.map +1 -1
- package/dist/signers/local.js +16 -3
- package/dist/signers/local.js.map +1 -1
- package/dist/signers/selfTest.d.ts +32 -12
- package/dist/signers/selfTest.d.ts.map +1 -1
- package/dist/signers/selfTest.js +85 -12
- package/dist/signers/selfTest.js.map +1 -1
- package/dist/signers/signature.d.ts +10 -0
- package/dist/signers/signature.d.ts.map +1 -0
- package/dist/signers/signature.js +11 -0
- package/dist/signers/signature.js.map +1 -0
- package/dist/store/keystore.d.ts +48 -6
- package/dist/store/keystore.d.ts.map +1 -1
- package/dist/store/keystore.js +414 -110
- package/dist/store/keystore.js.map +1 -1
- package/dist/store/lock.d.ts +59 -0
- package/dist/store/lock.d.ts.map +1 -0
- package/dist/store/lock.js +269 -0
- package/dist/store/lock.js.map +1 -0
- package/dist/store/orders.d.ts +49 -9
- package/dist/store/orders.d.ts.map +1 -1
- package/dist/store/orders.js +173 -37
- package/dist/store/orders.js.map +1 -1
- package/package.json +2 -2
package/dist/store/keystore.js
CHANGED
|
@@ -1,26 +1,57 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* §5 — key storage.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
4
|
+
* A local key is written only to a store whose persistence is known by
|
|
5
|
+
* construction: the macOS keychain or Windows Credential Manager (backend
|
|
6
|
+
* `keychain`), or the scrypt+AES-GCM file guarded by a passphrase (backend
|
|
7
|
+
* `file`). On Linux the keyring wrapper is never loaded: without a Secret
|
|
8
|
+
* Service it silently fell back to the kernel session keyring and a key was
|
|
9
|
+
* lost with the session, so `keychain` is refused there and the file backend
|
|
10
|
+
* is named instead. For sandbox development only, `DASKI_PAYER_PRIVATE_KEY`
|
|
11
|
+
* supplies a key from the environment.
|
|
12
|
+
*
|
|
13
|
+
* The file store distinguishes a missing file (an empty store) from one it
|
|
14
|
+
* cannot read, parse, or trust (`DASKI_KEYSTORE_UNREADABLE`), and it refuses
|
|
15
|
+
* to create or use a key on the latter. Every update holds an exclusive lock
|
|
16
|
+
* file, writes a temporary file beside the target with owner-only mode,
|
|
17
|
+
* flushes it, atomically renames it over the target, flushes the directory,
|
|
18
|
+
* then reads the file back and decrypts the new entry to the expected address
|
|
19
|
+
* before reporting success.
|
|
8
20
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
21
|
+
* Sandbox and mainnet never share a keychain entry or a file slot, so a
|
|
22
|
+
* profile mix-up cannot reach a mainnet key. Nothing in this file logs,
|
|
23
|
+
* prints, or returns key material except to the single caller that is about
|
|
24
|
+
* to construct a signer.
|
|
11
25
|
*/
|
|
12
|
-
import { createCipheriv, createDecipheriv, randomBytes, scrypt as scryptCallback } from "node:crypto";
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
26
|
+
import { createCipheriv, createDecipheriv, randomBytes, scrypt as scryptCallback, } from "node:crypto";
|
|
27
|
+
import { closeSync, fsyncSync, mkdirSync, openSync, readFileSync, renameSync, rmSync, statSync, writeSync, } from "node:fs";
|
|
28
|
+
import { tmpdir } from "node:os";
|
|
29
|
+
import { dirname, join } from "node:path";
|
|
15
30
|
import { promisify } from "node:util";
|
|
31
|
+
import { privateKeyToAccount } from "viem/accounts";
|
|
32
|
+
import { getAddress } from "viem";
|
|
16
33
|
import { CliError } from "../cli/errors.js";
|
|
17
|
-
import { readPassphrase } from "../cli/prompt.js";
|
|
34
|
+
import { isInteractive, readPassphrase } from "../cli/prompt.js";
|
|
35
|
+
import { HOSTED_BACKENDS, } from "../host.js";
|
|
18
36
|
import { keystorePath } from "../paths.js";
|
|
37
|
+
import { withFileLock } from "./lock.js";
|
|
19
38
|
const scrypt = promisify(scryptCallback);
|
|
20
39
|
const SERVICE = "io.daski.pay";
|
|
21
40
|
const DOC = "https://github.com/daski-io/buyer/blob/main/docs/keys.md";
|
|
22
41
|
/** Interactive-grade scrypt parameters. */
|
|
23
42
|
const SCRYPT = { N: 1 << 17, r: 8, p: 1 };
|
|
43
|
+
/**
|
|
44
|
+
* The largest parameters an entry may ask for on decryption: twice the
|
|
45
|
+
* interactive cost. scrypt needs 128·N·r bytes, and Node's default 32 MiB
|
|
46
|
+
* ceiling is below even the interactive cost, so the ceiling is derived from
|
|
47
|
+
* the parameters instead of trusted to a default; a file that asks for more
|
|
48
|
+
* is malformed, not a reason to allocate gigabytes.
|
|
49
|
+
*/
|
|
50
|
+
const SCRYPT_MAX = { N: 1 << 18, r: 8, p: 2 };
|
|
51
|
+
const scryptMemory = (N, r) => 2 * 128 * N * r;
|
|
52
|
+
const MIN_PASSPHRASE_LENGTH = 8;
|
|
53
|
+
/** How long a store update waits for another live process's lock before giving up. */
|
|
54
|
+
const LOCK_WAIT_MS = 30_000;
|
|
24
55
|
/** Keychain and file entries are namespaced by profile, never shared. */
|
|
25
56
|
function accountFor(profile) {
|
|
26
57
|
return `payer:${profile}`;
|
|
@@ -35,8 +66,8 @@ function environmentKey(profile) {
|
|
|
35
66
|
code: "DASKI_ENV_KEY_REFUSED_OFF_SANDBOX",
|
|
36
67
|
message: `DASKI_PAYER_PRIVATE_KEY is set, but the active profile is "${profile}". ` +
|
|
37
68
|
"The environment-variable signer is sandbox-only.",
|
|
38
|
-
remediation: `Unset DASKI_PAYER_PRIVATE_KEY, and store the ${profile} key in
|
|
39
|
-
`
|
|
69
|
+
remediation: `Unset DASKI_PAYER_PRIVATE_KEY, and store the ${profile} key in a durable ` +
|
|
70
|
+
`backend instead: run \`daski wallet create --profile ${profile}\`. See ${DOC}`,
|
|
40
71
|
});
|
|
41
72
|
}
|
|
42
73
|
if (!/^0x[0-9a-fA-F]{64}$/.test(raw)) {
|
|
@@ -48,43 +79,170 @@ function environmentKey(profile) {
|
|
|
48
79
|
}
|
|
49
80
|
return raw;
|
|
50
81
|
}
|
|
82
|
+
const ENVIRONMENT_LOCATION = {
|
|
83
|
+
source: "environment",
|
|
84
|
+
description: "DASKI_PAYER_PRIVATE_KEY (developer/sandbox only)",
|
|
85
|
+
durability: "environment",
|
|
86
|
+
};
|
|
87
|
+
function keychainLocation(profile) {
|
|
88
|
+
return {
|
|
89
|
+
source: "keychain",
|
|
90
|
+
description: `OS keychain (${SERVICE}/${accountFor(profile)})`,
|
|
91
|
+
durability: "persistent",
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
function fileLocation() {
|
|
95
|
+
return {
|
|
96
|
+
source: "encrypted-file",
|
|
97
|
+
description: `${keystorePath()} (scrypt + AES-256-GCM)`,
|
|
98
|
+
durability: "encrypted-file",
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
export function keychainUnsupportedOnLinux(profile) {
|
|
102
|
+
return new CliError({
|
|
103
|
+
code: "DASKI_KEYCHAIN_UNSUPPORTED_ON_LINUX",
|
|
104
|
+
message: "The OS keychain backend is not used on Linux: without a Secret Service the keyring " +
|
|
105
|
+
"wrapper falls back to the kernel session keyring, which does not survive the session.",
|
|
106
|
+
remediation: `Use the encrypted file backend: DASKI_KEY_BACKEND=file daski wallet create --profile ${profile}. ` +
|
|
107
|
+
`Without a terminal, also set DASKI_KEYSTORE_PASSPHRASE_FILE. See ${DOC}`,
|
|
108
|
+
});
|
|
109
|
+
}
|
|
51
110
|
/**
|
|
52
|
-
* Loads `@napi-rs/keyring`
|
|
53
|
-
*
|
|
54
|
-
* normal rather than exceptional — we fall through to the file keystore.
|
|
111
|
+
* Loads `@napi-rs/keyring` on the platforms whose native stores are persistent
|
|
112
|
+
* by construction. On Linux this function never reaches the import.
|
|
55
113
|
*/
|
|
56
|
-
async function keyring(profile) {
|
|
57
|
-
if (
|
|
58
|
-
|
|
114
|
+
async function keyring(profile, host) {
|
|
115
|
+
if (host.platform === "linux")
|
|
116
|
+
throw keychainUnsupportedOnLinux(profile);
|
|
117
|
+
let Entry;
|
|
59
118
|
try {
|
|
60
119
|
const module = await import("@napi-rs/keyring");
|
|
61
|
-
|
|
62
|
-
return new Entry(SERVICE, accountFor(profile));
|
|
120
|
+
Entry = module.Entry;
|
|
63
121
|
}
|
|
64
122
|
catch {
|
|
65
|
-
|
|
123
|
+
throw new CliError({
|
|
124
|
+
code: "DASKI_KEYCHAIN_UNAVAILABLE",
|
|
125
|
+
message: "The OS keychain backend could not be loaded on this machine.",
|
|
126
|
+
remediation: `Reinstall @daski/pay so its optional @napi-rs/keyring binary is present, or use ` +
|
|
127
|
+
`the encrypted file backend with DASKI_KEY_BACKEND=file. See ${DOC}`,
|
|
128
|
+
});
|
|
66
129
|
}
|
|
130
|
+
return new Entry(SERVICE, accountFor(profile));
|
|
131
|
+
}
|
|
132
|
+
// -- file backend ----------------------------------------------------------------
|
|
133
|
+
function keystoreUnreadable(path, reason) {
|
|
134
|
+
return new CliError({
|
|
135
|
+
code: "DASKI_KEYSTORE_UNREADABLE",
|
|
136
|
+
message: `The keystore ${path} exists but cannot be used: ${reason}.`,
|
|
137
|
+
remediation: "An unreadable or malformed keystore is never treated as empty, because creating a " +
|
|
138
|
+
"key over it could hide the one already there. Restore the file from a backup or fix " +
|
|
139
|
+
`its permissions, then re-run. See ${DOC}`,
|
|
140
|
+
});
|
|
67
141
|
}
|
|
68
|
-
function
|
|
142
|
+
function isEncryptedEntry(value) {
|
|
143
|
+
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
144
|
+
return false;
|
|
145
|
+
const entry = value;
|
|
146
|
+
const { N, r, p } = entry;
|
|
147
|
+
return entry.kdf === "scrypt" &&
|
|
148
|
+
typeof N === "number" && Number.isSafeInteger(N) && N >= 1 << 14 && N <= SCRYPT_MAX.N && (N & (N - 1)) === 0 &&
|
|
149
|
+
typeof r === "number" && Number.isSafeInteger(r) && r >= 1 && r <= SCRYPT_MAX.r &&
|
|
150
|
+
typeof p === "number" && Number.isSafeInteger(p) && p >= 1 && p <= SCRYPT_MAX.p &&
|
|
151
|
+
[entry.salt, entry.iv, entry.tag, entry.ciphertext].every((s) => typeof s === "string" && s.length > 0);
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Reads the store. A missing file is an empty store; anything else that stops
|
|
155
|
+
* the file being read, parsed, or trusted is `DASKI_KEYSTORE_UNREADABLE`.
|
|
156
|
+
*/
|
|
157
|
+
function readKeystoreFile(path = keystorePath()) {
|
|
158
|
+
let raw;
|
|
69
159
|
try {
|
|
70
|
-
|
|
71
|
-
if (parsed.version !== 1 || typeof parsed.entries !== "object")
|
|
72
|
-
throw new Error("shape");
|
|
73
|
-
return parsed;
|
|
160
|
+
raw = readFileSync(path, "utf8");
|
|
74
161
|
}
|
|
75
|
-
catch {
|
|
76
|
-
|
|
162
|
+
catch (error) {
|
|
163
|
+
if (error.code === "ENOENT")
|
|
164
|
+
return { version: 1, entries: {} };
|
|
165
|
+
throw keystoreUnreadable(path, error.message);
|
|
166
|
+
}
|
|
167
|
+
let parsed;
|
|
168
|
+
try {
|
|
169
|
+
parsed = JSON.parse(raw);
|
|
170
|
+
}
|
|
171
|
+
catch (error) {
|
|
172
|
+
throw keystoreUnreadable(path, `not valid JSON (${error.message})`);
|
|
173
|
+
}
|
|
174
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
175
|
+
throw keystoreUnreadable(path, "the document is not an object");
|
|
176
|
+
}
|
|
177
|
+
const file = parsed;
|
|
178
|
+
if (file.version !== 1 || !file.entries || typeof file.entries !== "object" || Array.isArray(file.entries)) {
|
|
179
|
+
throw keystoreUnreadable(path, "unexpected document shape");
|
|
180
|
+
}
|
|
181
|
+
for (const [account, entry] of Object.entries(file.entries)) {
|
|
182
|
+
if (!isEncryptedEntry(entry))
|
|
183
|
+
throw keystoreUnreadable(path, `entry "${account}" is malformed`);
|
|
77
184
|
}
|
|
185
|
+
return file;
|
|
78
186
|
}
|
|
79
|
-
function
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
187
|
+
function fsyncDirectory(directory) {
|
|
188
|
+
// Windows cannot open a directory handle for fsync; the rename is still atomic there.
|
|
189
|
+
if (process.platform === "win32")
|
|
190
|
+
return;
|
|
191
|
+
const fd = openSync(directory, "r");
|
|
192
|
+
try {
|
|
193
|
+
fsyncSync(fd);
|
|
194
|
+
}
|
|
195
|
+
finally {
|
|
196
|
+
closeSync(fd);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* Replaces the store atomically: an owner-only temporary file beside the
|
|
201
|
+
* target, flushed, renamed over the target, then the directory flushed. A
|
|
202
|
+
* crash at any point leaves either the previous file or the new one, never a
|
|
203
|
+
* truncated mixture.
|
|
204
|
+
*/
|
|
205
|
+
function replaceKeystoreFile(path, file) {
|
|
206
|
+
const directory = dirname(path);
|
|
207
|
+
mkdirSync(directory, { recursive: true, mode: 0o700 });
|
|
208
|
+
const temporary = `${path}.${process.pid}.${randomBytes(4).toString("hex")}.tmp`;
|
|
209
|
+
const fd = openSync(temporary, "wx", 0o600);
|
|
210
|
+
try {
|
|
211
|
+
writeSync(fd, `${JSON.stringify(file, null, 2)}\n`);
|
|
212
|
+
fsyncSync(fd);
|
|
213
|
+
}
|
|
214
|
+
finally {
|
|
215
|
+
closeSync(fd);
|
|
216
|
+
}
|
|
217
|
+
try {
|
|
218
|
+
renameSync(temporary, path);
|
|
219
|
+
}
|
|
220
|
+
catch (error) {
|
|
221
|
+
rmSync(temporary, { force: true });
|
|
222
|
+
throw error;
|
|
223
|
+
}
|
|
224
|
+
fsyncDirectory(directory);
|
|
225
|
+
}
|
|
226
|
+
/** Serializes store updates across processes with an exclusive lock file. */
|
|
227
|
+
function withKeystoreLock(path, run) {
|
|
228
|
+
const lock = `${path}.lock`;
|
|
229
|
+
return withFileLock(lock, {
|
|
230
|
+
waitMs: LOCK_WAIT_MS,
|
|
231
|
+
locked: (reason) => new CliError({
|
|
232
|
+
code: "DASKI_KEYSTORE_LOCKED",
|
|
233
|
+
message: reason === "orphaned"
|
|
234
|
+
? `A daski process died while recovering the keystore lock ${lock}.`
|
|
235
|
+
: `Another process holds the keystore lock ${lock}.`,
|
|
236
|
+
remediation: reason === "orphaned"
|
|
237
|
+
? `If no daski process is running, remove ${lock} and ${lock}.reclaim, then re-run. See ${DOC}`
|
|
238
|
+
: "Wait for the other daski command to finish, then re-run. If no daski process " +
|
|
239
|
+
`is running, remove the stale lock file. See ${DOC}`,
|
|
240
|
+
}),
|
|
241
|
+
}, run);
|
|
84
242
|
}
|
|
85
243
|
async function encrypt(privateKey, passphrase) {
|
|
86
244
|
const salt = randomBytes(32);
|
|
87
|
-
const key = await scrypt(passphrase, salt, 32, SCRYPT);
|
|
245
|
+
const key = await scrypt(passphrase, salt, 32, { ...SCRYPT, maxmem: scryptMemory(SCRYPT.N, SCRYPT.r) });
|
|
88
246
|
const iv = randomBytes(12);
|
|
89
247
|
const cipher = createCipheriv("aes-256-gcm", key, iv);
|
|
90
248
|
const ciphertext = Buffer.concat([
|
|
@@ -102,7 +260,7 @@ async function encrypt(privateKey, passphrase) {
|
|
|
102
260
|
}
|
|
103
261
|
async function decrypt(entry, passphrase) {
|
|
104
262
|
const key = await scrypt(passphrase, Buffer.from(entry.salt, "base64"), 32, {
|
|
105
|
-
N: entry.N, r: entry.r, p: entry.p,
|
|
263
|
+
N: entry.N, r: entry.r, p: entry.p, maxmem: scryptMemory(entry.N, entry.r),
|
|
106
264
|
});
|
|
107
265
|
const decipher = createDecipheriv("aes-256-gcm", key, Buffer.from(entry.iv, "base64"));
|
|
108
266
|
decipher.setAuthTag(Buffer.from(entry.tag, "base64"));
|
|
@@ -123,104 +281,250 @@ async function decrypt(entry, passphrase) {
|
|
|
123
281
|
});
|
|
124
282
|
}
|
|
125
283
|
}
|
|
284
|
+
// -- passphrase ------------------------------------------------------------------
|
|
285
|
+
function passphraseFileInvalid(path, reason, remediation) {
|
|
286
|
+
return new CliError({
|
|
287
|
+
code: "DASKI_PASSPHRASE_FILE_INVALID",
|
|
288
|
+
message: `DASKI_KEYSTORE_PASSPHRASE_FILE (${path}) cannot be used: ${reason}.`,
|
|
289
|
+
remediation: `${remediation} See ${DOC}`,
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
/**
|
|
293
|
+
* Reads the passphrase from the file `DASKI_KEYSTORE_PASSPHRASE_FILE` names.
|
|
294
|
+
* The file must be a regular file with owner-only permissions; a passphrase
|
|
295
|
+
* never travels on a command line.
|
|
296
|
+
*/
|
|
297
|
+
export function readPassphraseFile(path, platform) {
|
|
298
|
+
let stat;
|
|
299
|
+
try {
|
|
300
|
+
stat = statSync(path);
|
|
301
|
+
}
|
|
302
|
+
catch (error) {
|
|
303
|
+
throw passphraseFileInvalid(path, error.message, "Point it at a regular file containing only the passphrase.");
|
|
304
|
+
}
|
|
305
|
+
if (!stat.isFile()) {
|
|
306
|
+
throw passphraseFileInvalid(path, "it is not a regular file", "Point it at a regular file containing only the passphrase.");
|
|
307
|
+
}
|
|
308
|
+
// Windows permissions are ACLs that Node cannot express as a mode.
|
|
309
|
+
if (platform !== "win32" && (stat.mode & 0o077) !== 0) {
|
|
310
|
+
throw passphraseFileInvalid(path, "it is readable or writable by other users", `Run: chmod 600 ${path}`);
|
|
311
|
+
}
|
|
312
|
+
let content;
|
|
313
|
+
try {
|
|
314
|
+
content = readFileSync(path, "utf8");
|
|
315
|
+
}
|
|
316
|
+
catch (error) {
|
|
317
|
+
throw passphraseFileInvalid(path, error.message, "Fix the file's permissions.");
|
|
318
|
+
}
|
|
319
|
+
const passphrase = content.replace(/\r?\n$/, "");
|
|
320
|
+
if (passphrase.length === 0) {
|
|
321
|
+
throw passphraseFileInvalid(path, "it is empty", "Write the passphrase into the file.");
|
|
322
|
+
}
|
|
323
|
+
return passphrase;
|
|
324
|
+
}
|
|
325
|
+
function passphraseTooShort() {
|
|
326
|
+
return new CliError({
|
|
327
|
+
code: "DASKI_PASSPHRASE_TOO_SHORT",
|
|
328
|
+
message: `The keystore passphrase must be at least ${MIN_PASSPHRASE_LENGTH} characters.`,
|
|
329
|
+
remediation: "Re-run and choose a longer passphrase.",
|
|
330
|
+
});
|
|
331
|
+
}
|
|
332
|
+
/**
|
|
333
|
+
* The passphrase for the file store: from `DASKI_KEYSTORE_PASSPHRASE_FILE`
|
|
334
|
+
* when set, otherwise from the terminal. With neither, the command refuses.
|
|
335
|
+
*/
|
|
336
|
+
export async function keystorePassphrase(host, purpose, profile) {
|
|
337
|
+
if (host.passphraseFile) {
|
|
338
|
+
const passphrase = readPassphraseFile(host.passphraseFile, host.platform);
|
|
339
|
+
if (purpose === "create" && passphrase.length < MIN_PASSPHRASE_LENGTH)
|
|
340
|
+
throw passphraseTooShort();
|
|
341
|
+
return passphrase;
|
|
342
|
+
}
|
|
343
|
+
if (!isInteractive()) {
|
|
344
|
+
throw new CliError({
|
|
345
|
+
code: "DASKI_PASSPHRASE_REQUIRES_TTY",
|
|
346
|
+
message: "The encrypted keystore needs a passphrase, and this session has no terminal.",
|
|
347
|
+
remediation: "Run the command from an interactive terminal, or set DASKI_KEYSTORE_PASSPHRASE_FILE " +
|
|
348
|
+
"to a regular file (mode 600) containing the passphrase. The passphrase is never " +
|
|
349
|
+
`taken from a flag. See ${DOC}`,
|
|
350
|
+
});
|
|
351
|
+
}
|
|
352
|
+
if (purpose === "unlock")
|
|
353
|
+
return readPassphrase(`Passphrase for the ${profile} keystore: `);
|
|
354
|
+
const passphrase = await readPassphrase(`Choose a passphrase for ${keystorePath()}: `);
|
|
355
|
+
if (passphrase.length < MIN_PASSPHRASE_LENGTH)
|
|
356
|
+
throw passphraseTooShort();
|
|
357
|
+
const again = await readPassphrase("Confirm passphrase: ");
|
|
358
|
+
if (again !== passphrase) {
|
|
359
|
+
throw new CliError({
|
|
360
|
+
code: "DASKI_PASSPHRASE_MISMATCH",
|
|
361
|
+
message: "The passphrases did not match.",
|
|
362
|
+
remediation: "Re-run and enter the same passphrase twice.",
|
|
363
|
+
});
|
|
364
|
+
}
|
|
365
|
+
return passphrase;
|
|
366
|
+
}
|
|
367
|
+
// -- the store API -----------------------------------------------------------------
|
|
368
|
+
/** The refusal for a host whose backend holds no local key. */
|
|
369
|
+
export function localKeyRefusedOnHost(profile, backend) {
|
|
370
|
+
const named = backend === "none" ? "no local key store (DASKI_KEY_BACKEND=none)" : `the hosted ${backend} wallet`;
|
|
371
|
+
return new CliError({
|
|
372
|
+
code: "DASKI_LOCAL_KEY_REFUSED_ON_HOST",
|
|
373
|
+
message: `This host selects ${named}, so no local key is created or read for "${profile}".`,
|
|
374
|
+
remediation: backend === "none"
|
|
375
|
+
? "Set DASKI_KEY_BACKEND=file (or keychain on macOS and Windows) to keep a local key, " +
|
|
376
|
+
`or configure a hosted signer. See ${DOC}`
|
|
377
|
+
: `Set the profile signer to ${backend} and run daski doctor --json --signer ${backend}. ` +
|
|
378
|
+
`To keep a local key instead, set DASKI_KEY_BACKEND=file. See ${DOC}`,
|
|
379
|
+
});
|
|
380
|
+
}
|
|
126
381
|
/** Where a key for this profile lives, without loading it. */
|
|
127
|
-
export async function locateKey(profile) {
|
|
128
|
-
if (process.env.DASKI_PAYER_PRIVATE_KEY)
|
|
129
|
-
return
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
const entry = await keyring(profile);
|
|
135
|
-
if (entry) {
|
|
382
|
+
export async function locateKey(profile, store) {
|
|
383
|
+
if (process.env.DASKI_PAYER_PRIVATE_KEY)
|
|
384
|
+
return ENVIRONMENT_LOCATION;
|
|
385
|
+
if (HOSTED_BACKENDS.has(store.backend))
|
|
386
|
+
return undefined;
|
|
387
|
+
if (store.backend === "keychain") {
|
|
388
|
+
const entry = await keyring(profile, store.host);
|
|
136
389
|
try {
|
|
137
|
-
|
|
138
|
-
return { source: "keychain", description: `OS keychain (${SERVICE}/${accountFor(profile)})` };
|
|
139
|
-
}
|
|
390
|
+
return entry.getPassword() ? keychainLocation(profile) : undefined;
|
|
140
391
|
}
|
|
141
392
|
catch {
|
|
142
|
-
|
|
393
|
+
return undefined;
|
|
143
394
|
}
|
|
144
395
|
}
|
|
145
|
-
|
|
146
|
-
return { source: "encrypted-file", description: `${keystorePath()} (scrypt + AES-256-GCM)` };
|
|
147
|
-
}
|
|
148
|
-
return undefined;
|
|
396
|
+
return readKeystoreFile().entries[accountFor(profile)] ? fileLocation() : undefined;
|
|
149
397
|
}
|
|
150
398
|
/** Loads the private key for a profile, prompting for a passphrase if needed. */
|
|
151
|
-
export async function loadKey(profile) {
|
|
399
|
+
export async function loadKey(profile, store) {
|
|
152
400
|
const fromEnvironment = environmentKey(profile);
|
|
153
401
|
if (fromEnvironment)
|
|
154
402
|
return fromEnvironment;
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
catch (error) {
|
|
171
|
-
if (error instanceof CliError)
|
|
172
|
-
throw error;
|
|
403
|
+
if (HOSTED_BACKENDS.has(store.backend))
|
|
404
|
+
throw localKeyRefusedOnHost(profile, store.backend);
|
|
405
|
+
if (store.backend === "keychain") {
|
|
406
|
+
const entry = await keyring(profile, store.host);
|
|
407
|
+
const stored = entry.getPassword();
|
|
408
|
+
if (!stored)
|
|
409
|
+
throw noKey(profile);
|
|
410
|
+
if (!/^0x[0-9a-fA-F]{64}$/.test(stored)) {
|
|
411
|
+
throw new CliError({
|
|
412
|
+
code: "DASKI_KEYCHAIN_ENTRY_MALFORMED",
|
|
413
|
+
message: `The keychain entry for "${profile}" is not a valid private key.`,
|
|
414
|
+
remediation: `Delete it and re-run \`daski wallet create --profile ${profile}\`. See ${DOC}`,
|
|
415
|
+
});
|
|
173
416
|
}
|
|
417
|
+
return stored;
|
|
174
418
|
}
|
|
175
419
|
const stored = readKeystoreFile().entries[accountFor(profile)];
|
|
176
|
-
if (!stored)
|
|
177
|
-
throw
|
|
178
|
-
|
|
179
|
-
message: `No signing key is configured for the "${profile}" profile.`,
|
|
180
|
-
remediation: `Run: daski wallet create --profile ${profile}`,
|
|
181
|
-
});
|
|
182
|
-
}
|
|
183
|
-
const passphrase = await readPassphrase(`Passphrase for the ${profile} keystore: `);
|
|
420
|
+
if (!stored)
|
|
421
|
+
throw noKey(profile);
|
|
422
|
+
const passphrase = await keystorePassphrase(store.host, "unlock", profile);
|
|
184
423
|
return decrypt(stored, passphrase);
|
|
185
424
|
}
|
|
425
|
+
function noKey(profile) {
|
|
426
|
+
return new CliError({
|
|
427
|
+
code: "DASKI_NO_KEY_FOR_PROFILE",
|
|
428
|
+
message: `No signing key is configured for the "${profile}" profile.`,
|
|
429
|
+
remediation: `Run: daski wallet create --profile ${profile}`,
|
|
430
|
+
});
|
|
431
|
+
}
|
|
432
|
+
/**
|
|
433
|
+
* Serializes a profile's native keychain setup. The entry is per OS user, not
|
|
434
|
+
* per DASKI_HOME, so the lock lives outside DASKI_HOME and names the entry:
|
|
435
|
+
* two setups for the same profile, from any directories, take turns, and the
|
|
436
|
+
* second finds the first's key instead of overwriting it after a check that
|
|
437
|
+
* saw nothing.
|
|
438
|
+
*/
|
|
439
|
+
function withKeychainLock(profile, directory, run) {
|
|
440
|
+
const name = `keychain-${SERVICE}-${accountFor(profile)}`.replace(/[^A-Za-z0-9._-]/g, "_");
|
|
441
|
+
const lock = join(directory ?? join(tmpdir(), "daski-locks"), `${name}.lock`);
|
|
442
|
+
return withFileLock(lock, {
|
|
443
|
+
waitMs: LOCK_WAIT_MS,
|
|
444
|
+
locked: (reason) => new CliError({
|
|
445
|
+
code: "DASKI_KEYSTORE_LOCKED",
|
|
446
|
+
message: reason === "orphaned"
|
|
447
|
+
? `A daski process died while recovering the keychain lock ${lock}.`
|
|
448
|
+
: `Another process is setting up the keychain entry for "${profile}".`,
|
|
449
|
+
remediation: reason === "orphaned"
|
|
450
|
+
? `If no daski process is running, remove ${lock} and ${lock}.reclaim, then re-run. See ${DOC}`
|
|
451
|
+
: "Wait for the other daski command to finish, then re-run. If no daski process " +
|
|
452
|
+
`is running, remove the stale lock file. See ${DOC}`,
|
|
453
|
+
}),
|
|
454
|
+
}, run);
|
|
455
|
+
}
|
|
186
456
|
/**
|
|
187
457
|
* Stores a key for a profile. Returns where it landed so the caller can tell
|
|
188
|
-
* the operator — the caller prints the location, never the key.
|
|
458
|
+
* the operator — the caller prints the location, never the key. The store is
|
|
459
|
+
* re-read under the lock, so two creations for the same profile serialize to
|
|
460
|
+
* one key: the second finds the first and refuses.
|
|
189
461
|
*/
|
|
190
|
-
export async function storeKey(profile, privateKey) {
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
462
|
+
export async function storeKey(profile, privateKey, store, hooks = {}) {
|
|
463
|
+
if (HOSTED_BACKENDS.has(store.backend))
|
|
464
|
+
throw localKeyRefusedOnHost(profile, store.backend);
|
|
465
|
+
const expected = privateKeyToAccount(privateKey).address;
|
|
466
|
+
if (store.backend === "keychain") {
|
|
467
|
+
const entry = hooks.keyring ? hooks.keyring(profile) : await keyring(profile, store.host);
|
|
468
|
+
// Check, write and read-back are one critical section: a read-back alone
|
|
469
|
+
// cannot tell that another setup will overwrite the entry afterwards.
|
|
470
|
+
return withKeychainLock(profile, hooks.lockDirectory, async () => {
|
|
471
|
+
if (entry.getPassword())
|
|
472
|
+
throw keyAlreadyExists(profile);
|
|
473
|
+
await hooks.beforeKeychainWrite?.();
|
|
194
474
|
entry.setPassword(privateKey);
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
const passphrase = await readPassphrase(`No OS keychain is available. Choose a passphrase for ${keystorePath()}: `);
|
|
202
|
-
if (passphrase.length < 8) {
|
|
203
|
-
throw new CliError({
|
|
204
|
-
code: "DASKI_PASSPHRASE_TOO_SHORT",
|
|
205
|
-
message: "The keystore passphrase must be at least 8 characters.",
|
|
206
|
-
remediation: "Re-run and choose a longer passphrase.",
|
|
207
|
-
});
|
|
208
|
-
}
|
|
209
|
-
const again = await readPassphrase("Confirm passphrase: ");
|
|
210
|
-
if (again !== passphrase) {
|
|
211
|
-
throw new CliError({
|
|
212
|
-
code: "DASKI_PASSPHRASE_MISMATCH",
|
|
213
|
-
message: "The passphrases did not match.",
|
|
214
|
-
remediation: "Re-run and enter the same passphrase twice.",
|
|
475
|
+
const readBack = entry.getPassword();
|
|
476
|
+
if (readBack !== privateKey)
|
|
477
|
+
throw readBackMismatch(profile);
|
|
478
|
+
return keychainLocation(profile);
|
|
215
479
|
});
|
|
216
480
|
}
|
|
217
|
-
const
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
481
|
+
const path = keystorePath();
|
|
482
|
+
// The passphrase is obtained before the lock so a prompt never holds it.
|
|
483
|
+
if (readKeystoreFile(path).entries[accountFor(profile)])
|
|
484
|
+
throw keyAlreadyExists(profile);
|
|
485
|
+
const passphrase = await keystorePassphrase(store.host, "create", profile);
|
|
486
|
+
const encrypted = await encrypt(privateKey, passphrase);
|
|
487
|
+
return withKeystoreLock(path, async () => {
|
|
488
|
+
const file = readKeystoreFile(path);
|
|
489
|
+
if (file.entries[accountFor(profile)])
|
|
490
|
+
throw keyAlreadyExists(profile);
|
|
491
|
+
file.entries[accountFor(profile)] = encrypted;
|
|
492
|
+
replaceKeystoreFile(path, file);
|
|
493
|
+
hooks.afterWrite?.();
|
|
494
|
+
// Success is claimed only after the bytes on disk decrypt to this key.
|
|
495
|
+
const written = readKeystoreFile(path).entries[accountFor(profile)];
|
|
496
|
+
let recovered;
|
|
497
|
+
if (written) {
|
|
498
|
+
try {
|
|
499
|
+
recovered = getAddress(privateKeyToAccount(await decrypt(written, passphrase)).address);
|
|
500
|
+
}
|
|
501
|
+
catch {
|
|
502
|
+
recovered = undefined;
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
if (recovered !== expected)
|
|
506
|
+
throw readBackMismatch(profile);
|
|
507
|
+
return fileLocation();
|
|
508
|
+
});
|
|
509
|
+
}
|
|
510
|
+
function keyAlreadyExists(profile) {
|
|
511
|
+
return new CliError({
|
|
512
|
+
code: "DASKI_KEY_ALREADY_EXISTS",
|
|
513
|
+
message: `A signing key already exists for the "${profile}" profile.`,
|
|
514
|
+
remediation: `Use the existing signer with daski wallet address --profile ${profile}.`,
|
|
515
|
+
});
|
|
516
|
+
}
|
|
517
|
+
function readBackMismatch(profile) {
|
|
518
|
+
return new CliError({
|
|
519
|
+
code: "DASKI_KEYSTORE_READBACK_MISMATCH",
|
|
520
|
+
message: `The key written for "${profile}" did not read back as the key that was generated, ` +
|
|
521
|
+
"so the store cannot be trusted to hold it.",
|
|
522
|
+
remediation: "Do not fund this address. Check the disk and the state directory, then re-run " +
|
|
523
|
+
`daski wallet create --profile ${profile}. See ${DOC}`,
|
|
524
|
+
});
|
|
221
525
|
}
|
|
222
526
|
/** True when a key already exists for this profile. */
|
|
223
|
-
export async function hasKey(profile) {
|
|
224
|
-
return (await locateKey(profile)) !== undefined;
|
|
527
|
+
export async function hasKey(profile, store) {
|
|
528
|
+
return (await locateKey(profile, store)) !== undefined;
|
|
225
529
|
}
|
|
226
530
|
//# sourceMappingURL=keystore.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keystore.js","sourceRoot":"","sources":["../../src/store/keystore.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,IAAI,cAAc,EAAE,MAAM,aAAa,CAAC;AACtG,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC5E,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,MAAM,MAAM,GAAG,SAAS,CAAC,cAAc,CAEnB,CAAC;AAErB,MAAM,OAAO,GAAG,cAAc,CAAC;AAC/B,MAAM,GAAG,GAAG,0DAA0D,CAAC;AAEvE,2CAA2C;AAC3C,MAAM,MAAM,GAAG,EAAE,CAAC,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAW,CAAC;AA0BnD,yEAAyE;AACzE,SAAS,UAAU,CAAC,OAAe;IACjC,OAAO,SAAS,OAAO,EAAE,CAAC;AAC5B,CAAC;AAED,kEAAkE;AAClE,SAAS,cAAc,CAAC,OAAe;IACrC,MAAM,GAAG,G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