@cogcoin/client 1.1.6 → 1.1.7
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 +2 -2
- package/dist/bitcoind/indexer-daemon.js +29 -79
- package/dist/bitcoind/managed-runtime/bitcoind-runtime.d.ts +20 -0
- package/dist/bitcoind/managed-runtime/bitcoind-runtime.js +74 -0
- package/dist/bitcoind/managed-runtime/bitcoind-status.d.ts +11 -0
- package/dist/bitcoind/managed-runtime/bitcoind-status.js +44 -0
- package/dist/bitcoind/managed-runtime/indexer-runtime.d.ts +15 -0
- package/dist/bitcoind/managed-runtime/indexer-runtime.js +82 -0
- package/dist/bitcoind/managed-runtime/types.d.ts +40 -0
- package/dist/bitcoind/node.d.ts +2 -2
- package/dist/bitcoind/node.js +2 -2
- package/dist/bitcoind/rpc.d.ts +2 -1
- package/dist/bitcoind/rpc.js +53 -3
- package/dist/bitcoind/service.js +46 -126
- package/dist/cli/command-registry.d.ts +1 -1
- package/dist/cli/command-registry.js +2 -64
- package/dist/cli/commands/client-admin.js +3 -18
- package/dist/cli/commands/mining-runtime.js +4 -60
- package/dist/cli/commands/wallet-admin.js +6 -6
- package/dist/cli/context.js +1 -3
- package/dist/cli/mining-json.d.ts +1 -22
- package/dist/cli/mining-json.js +0 -23
- package/dist/cli/output.js +16 -2
- package/dist/cli/parse.js +0 -2
- package/dist/cli/preview-json.d.ts +1 -22
- package/dist/cli/preview-json.js +0 -19
- package/dist/cli/types.d.ts +1 -3
- package/dist/cli/wallet-format.js +1 -1
- package/dist/cli/workflow-hints.d.ts +1 -2
- package/dist/cli/workflow-hints.js +5 -8
- package/dist/wallet/lifecycle/context.js +0 -1
- package/dist/wallet/lifecycle/repair-mining.d.ts +1 -5
- package/dist/wallet/lifecycle/repair-mining.js +5 -39
- package/dist/wallet/lifecycle/repair.js +0 -3
- package/dist/wallet/lifecycle/setup.js +10 -8
- package/dist/wallet/lifecycle/types.d.ts +1 -4
- package/dist/wallet/managed-core-wallet.d.ts +2 -0
- package/dist/wallet/managed-core-wallet.js +27 -1
- package/dist/wallet/mining/candidate.d.ts +1 -0
- package/dist/wallet/mining/candidate.js +38 -6
- package/dist/wallet/mining/competitiveness.d.ts +1 -0
- package/dist/wallet/mining/competitiveness.js +6 -0
- package/dist/wallet/mining/cycle.d.ts +2 -0
- package/dist/wallet/mining/cycle.js +14 -4
- package/dist/wallet/mining/engine-types.d.ts +1 -0
- package/dist/wallet/mining/index.d.ts +1 -1
- package/dist/wallet/mining/index.js +1 -1
- package/dist/wallet/mining/publish.d.ts +3 -0
- package/dist/wallet/mining/publish.js +78 -6
- package/dist/wallet/mining/runner.d.ts +0 -32
- package/dist/wallet/mining/runner.js +59 -104
- package/dist/wallet/mining/stop.d.ts +7 -0
- package/dist/wallet/mining/stop.js +23 -0
- package/dist/wallet/mining/supervisor.d.ts +2 -36
- package/dist/wallet/mining/supervisor.js +139 -246
- package/dist/wallet/read/context.d.ts +1 -5
- package/dist/wallet/read/context.js +20 -204
- package/dist/wallet/read/managed-services.d.ts +33 -0
- package/dist/wallet/read/managed-services.js +222 -0
- package/dist/wallet/state/client-password/bootstrap.d.ts +2 -0
- package/dist/wallet/state/client-password/bootstrap.js +3 -0
- package/dist/wallet/state/client-password/context.d.ts +10 -0
- package/dist/wallet/state/client-password/context.js +46 -0
- package/dist/wallet/state/client-password/crypto.d.ts +34 -0
- package/dist/wallet/state/client-password/crypto.js +117 -0
- package/dist/wallet/state/client-password/files.d.ts +10 -0
- package/dist/wallet/state/client-password/files.js +109 -0
- package/dist/wallet/state/client-password/legacy-cleanup.d.ts +11 -0
- package/dist/wallet/state/client-password/legacy-cleanup.js +338 -0
- package/dist/wallet/state/client-password/messages.d.ts +3 -0
- package/dist/wallet/state/client-password/messages.js +9 -0
- package/dist/wallet/state/client-password/migration.d.ts +4 -0
- package/dist/wallet/state/client-password/migration.js +32 -0
- package/dist/wallet/state/client-password/prompts.d.ts +12 -0
- package/dist/wallet/state/client-password/prompts.js +79 -0
- package/dist/wallet/state/client-password/protected-secrets.d.ts +13 -0
- package/dist/wallet/state/client-password/protected-secrets.js +90 -0
- package/dist/wallet/state/client-password/readiness.d.ts +4 -0
- package/dist/wallet/state/client-password/readiness.js +48 -0
- package/dist/wallet/state/client-password/references.d.ts +1 -0
- package/dist/wallet/state/client-password/references.js +56 -0
- package/dist/wallet/state/client-password/rotation.d.ts +6 -0
- package/dist/wallet/state/client-password/rotation.js +98 -0
- package/dist/wallet/state/client-password/session-policy.d.ts +6 -0
- package/dist/wallet/state/client-password/session-policy.js +28 -0
- package/dist/wallet/state/client-password/session.d.ts +19 -0
- package/dist/wallet/state/client-password/session.js +170 -0
- package/dist/wallet/state/client-password/setup.d.ts +8 -0
- package/dist/wallet/state/client-password/setup.js +49 -0
- package/dist/wallet/state/client-password/types.d.ts +82 -0
- package/dist/wallet/state/client-password/types.js +5 -0
- package/dist/wallet/state/client-password.d.ts +7 -38
- package/dist/wallet/state/client-password.js +52 -937
- package/dist/wallet/tx/anchor.js +123 -216
- package/dist/wallet/tx/cog.js +294 -489
- package/dist/wallet/tx/common.d.ts +2 -0
- package/dist/wallet/tx/common.js +2 -0
- package/dist/wallet/tx/domain-admin.js +111 -220
- package/dist/wallet/tx/domain-market.js +401 -681
- package/dist/wallet/tx/executor.d.ts +176 -0
- package/dist/wallet/tx/executor.js +302 -0
- package/dist/wallet/tx/field.js +109 -215
- package/dist/wallet/tx/register.js +158 -269
- package/dist/wallet/tx/reputation.js +120 -227
- package/package.json +1 -1
- package/dist/wallet/mining/worker-main.d.ts +0 -1
- package/dist/wallet/mining/worker-main.js +0 -17
- package/dist/wallet/state/client-password-agent.d.ts +0 -1
- package/dist/wallet/state/client-password-agent.js +0 -211
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { mkdir } from "node:fs/promises";
|
|
2
|
+
import { createClientPasswordState, zeroizeBuffer, } from "./crypto.js";
|
|
3
|
+
import { writeClientPasswordState } from "./files.js";
|
|
4
|
+
import { migrateReferencedSecrets } from "./migration.js";
|
|
5
|
+
import { promptForNewPassword } from "./prompts.js";
|
|
6
|
+
import { inspectClientPasswordReadinessResolved } from "./readiness.js";
|
|
7
|
+
import { resolveClientPasswordPromptSessionPolicy } from "./session-policy.js";
|
|
8
|
+
import { finalizePendingClientPasswordRotationIfNeeded } from "./rotation.js";
|
|
9
|
+
import { startClientPasswordSessionResolved } from "./session.js";
|
|
10
|
+
import { readClientPasswordSessionStatusResolved } from "./session.js";
|
|
11
|
+
export async function ensureClientPasswordConfiguredResolved(options) {
|
|
12
|
+
await finalizePendingClientPasswordRotationIfNeeded(options.context);
|
|
13
|
+
const readiness = await inspectClientPasswordReadinessResolved(options.context);
|
|
14
|
+
if (readiness === "ready") {
|
|
15
|
+
return {
|
|
16
|
+
action: "already-configured",
|
|
17
|
+
session: await readClientPasswordSessionStatusResolved(options.context),
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
const setup = await promptForNewPassword(options.prompt);
|
|
21
|
+
let derivedKey = null;
|
|
22
|
+
try {
|
|
23
|
+
const created = await createClientPasswordState({
|
|
24
|
+
passwordBytes: setup.passwordBytes,
|
|
25
|
+
passwordHint: setup.passwordHint,
|
|
26
|
+
});
|
|
27
|
+
derivedKey = created.derivedKey;
|
|
28
|
+
await mkdir(options.context.directoryPath, { recursive: true, mode: 0o700 });
|
|
29
|
+
await writeClientPasswordState(options.context.passwordStatePath, created.state);
|
|
30
|
+
const migrated = await migrateReferencedSecrets({
|
|
31
|
+
...options.context,
|
|
32
|
+
derivedKey,
|
|
33
|
+
});
|
|
34
|
+
const session = await startClientPasswordSessionResolved({
|
|
35
|
+
...options.context,
|
|
36
|
+
derivedKey,
|
|
37
|
+
sessionPolicy: resolveClientPasswordPromptSessionPolicy(options.prompt),
|
|
38
|
+
});
|
|
39
|
+
derivedKey = null;
|
|
40
|
+
return {
|
|
41
|
+
action: migrated || readiness === "migration-required" ? "migrated" : "created",
|
|
42
|
+
session,
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
finally {
|
|
46
|
+
zeroizeBuffer(setup.passwordBytes);
|
|
47
|
+
zeroizeBuffer(derivedKey);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
export declare const CLIENT_PASSWORD_STATE_FORMAT = "cogcoin-client-password";
|
|
2
|
+
export declare const CLIENT_PASSWORD_ROTATION_JOURNAL_FORMAT = "cogcoin-client-password-rotation";
|
|
3
|
+
export declare const CLIENT_PASSWORD_VERIFIER_FORMAT = "cogcoin-client-password-verifier";
|
|
4
|
+
export declare const LOCAL_SECRET_ENVELOPE_FORMAT = "cogcoin-local-wallet-secret";
|
|
5
|
+
export declare const CLIENT_PASSWORD_VERIFIER_TEXT = "cogcoin-client-password-verifier-v1";
|
|
6
|
+
export type ClientPasswordReadiness = "ready" | "setup-required" | "migration-required";
|
|
7
|
+
export type ClientPasswordSetupAction = "created" | "migrated" | "already-configured";
|
|
8
|
+
export interface ClientPasswordPrompt {
|
|
9
|
+
readonly isInteractive: boolean;
|
|
10
|
+
writeLine(message: string): void;
|
|
11
|
+
prompt(message: string): Promise<string>;
|
|
12
|
+
promptHidden?(message: string): Promise<string>;
|
|
13
|
+
}
|
|
14
|
+
export interface ClientPasswordSessionStatus {
|
|
15
|
+
unlocked: boolean;
|
|
16
|
+
unlockUntilUnixMs: number | null;
|
|
17
|
+
}
|
|
18
|
+
export interface ClientPasswordLegacyKeychainReader {
|
|
19
|
+
loadSecret(keyId: string): Promise<Uint8Array>;
|
|
20
|
+
}
|
|
21
|
+
export interface ClientPasswordStorageOptions {
|
|
22
|
+
platform: NodeJS.Platform;
|
|
23
|
+
stateRoot: string;
|
|
24
|
+
runtimeRoot: string;
|
|
25
|
+
directoryPath: string;
|
|
26
|
+
runtimeErrorCode: string;
|
|
27
|
+
legacyMacKeychainReader?: ClientPasswordLegacyKeychainReader | null;
|
|
28
|
+
}
|
|
29
|
+
export interface ClientPasswordResolvedContext extends ClientPasswordStorageOptions {
|
|
30
|
+
legacyMacKeychainReader?: ClientPasswordLegacyKeychainReader | null;
|
|
31
|
+
passwordStatePath: string;
|
|
32
|
+
rotationJournalPath: string;
|
|
33
|
+
}
|
|
34
|
+
export interface ClientPasswordStateV1 {
|
|
35
|
+
format: typeof CLIENT_PASSWORD_STATE_FORMAT;
|
|
36
|
+
version: 1;
|
|
37
|
+
passwordHint: string;
|
|
38
|
+
kdf: {
|
|
39
|
+
name: "argon2id";
|
|
40
|
+
memoryKib: number;
|
|
41
|
+
iterations: number;
|
|
42
|
+
parallelism: number;
|
|
43
|
+
salt: string;
|
|
44
|
+
};
|
|
45
|
+
verifier: {
|
|
46
|
+
cipher: "aes-256-gcm";
|
|
47
|
+
nonce: string;
|
|
48
|
+
tag: string;
|
|
49
|
+
ciphertext: string;
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
export interface WrappedSecretEnvelopeV1 {
|
|
53
|
+
format: typeof LOCAL_SECRET_ENVELOPE_FORMAT;
|
|
54
|
+
version: 1;
|
|
55
|
+
cipher: "aes-256-gcm";
|
|
56
|
+
wrappedBy: "client-password";
|
|
57
|
+
nonce: string;
|
|
58
|
+
tag: string;
|
|
59
|
+
ciphertext: string;
|
|
60
|
+
}
|
|
61
|
+
export interface ClientPasswordRotationJournalV1 {
|
|
62
|
+
format: typeof CLIENT_PASSWORD_ROTATION_JOURNAL_FORMAT;
|
|
63
|
+
version: 1;
|
|
64
|
+
nextState: ClientPasswordStateV1;
|
|
65
|
+
secrets: Array<{
|
|
66
|
+
keyId: string;
|
|
67
|
+
envelope: WrappedSecretEnvelopeV1;
|
|
68
|
+
}>;
|
|
69
|
+
}
|
|
70
|
+
export interface ClientPasswordAgentBootstrapState {
|
|
71
|
+
unlockUntilUnixMs: number;
|
|
72
|
+
derivedKeyBase64: string;
|
|
73
|
+
}
|
|
74
|
+
export type LocalSecretFile = {
|
|
75
|
+
state: "missing";
|
|
76
|
+
} | {
|
|
77
|
+
state: "raw";
|
|
78
|
+
secret: Uint8Array;
|
|
79
|
+
} | {
|
|
80
|
+
state: "wrapped";
|
|
81
|
+
envelope: WrappedSecretEnvelopeV1;
|
|
82
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export const CLIENT_PASSWORD_STATE_FORMAT = "cogcoin-client-password";
|
|
2
|
+
export const CLIENT_PASSWORD_ROTATION_JOURNAL_FORMAT = "cogcoin-client-password-rotation";
|
|
3
|
+
export const CLIENT_PASSWORD_VERIFIER_FORMAT = "cogcoin-client-password-verifier";
|
|
4
|
+
export const LOCAL_SECRET_ENVELOPE_FORMAT = "cogcoin-local-wallet-secret";
|
|
5
|
+
export const CLIENT_PASSWORD_VERIFIER_TEXT = "cogcoin-client-password-verifier-v1";
|
|
@@ -1,27 +1,10 @@
|
|
|
1
|
-
export
|
|
2
|
-
export type ClientPasswordReadiness
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
promptHidden?(message: string): Promise<string>;
|
|
9
|
-
}
|
|
10
|
-
export interface ClientPasswordSessionStatus {
|
|
11
|
-
unlocked: boolean;
|
|
12
|
-
unlockUntilUnixMs: number | null;
|
|
13
|
-
}
|
|
14
|
-
export interface ClientPasswordStorageOptions {
|
|
15
|
-
platform: NodeJS.Platform;
|
|
16
|
-
stateRoot: string;
|
|
17
|
-
runtimeRoot: string;
|
|
18
|
-
directoryPath: string;
|
|
19
|
-
runtimeErrorCode: string;
|
|
20
|
-
legacyMacKeychainReader?: {
|
|
21
|
-
loadSecret(keyId: string): Promise<Uint8Array>;
|
|
22
|
-
} | null;
|
|
23
|
-
}
|
|
24
|
-
export declare function resolveLocalSecretFilePath(directoryPath: string, keyId: string): string;
|
|
1
|
+
export { CLIENT_PASSWORD_SETUP_AUTO_UNLOCK_SECONDS } from "./client-password/crypto.js";
|
|
2
|
+
export type { ClientPasswordPrompt, ClientPasswordReadiness, ClientPasswordSessionStatus, ClientPasswordSetupAction, ClientPasswordStorageOptions, } from "./client-password/types.js";
|
|
3
|
+
export { resolveLocalSecretFilePath, createLegacyKeychainServiceName, } from "./client-password/context.js";
|
|
4
|
+
export { createAgentBootstrapState } from "./client-password/bootstrap.js";
|
|
5
|
+
export { describeClientPasswordLockedMessage, describeClientPasswordMigrationMessage, describeClientPasswordSetupMessage, } from "./client-password/messages.js";
|
|
6
|
+
export { listLocalSecretFilesForTesting } from "./client-password/files.js";
|
|
7
|
+
import type { ClientPasswordPrompt, ClientPasswordReadiness, ClientPasswordSessionStatus, ClientPasswordSetupAction, ClientPasswordStorageOptions } from "./client-password/types.js";
|
|
25
8
|
export declare function inspectClientPasswordReadiness(options: ClientPasswordStorageOptions): Promise<ClientPasswordReadiness>;
|
|
26
9
|
export declare function readClientPasswordSessionStatus(options: ClientPasswordStorageOptions): Promise<ClientPasswordSessionStatus>;
|
|
27
10
|
export declare function lockClientPasswordSession(options: ClientPasswordStorageOptions): Promise<ClientPasswordSessionStatus>;
|
|
@@ -49,17 +32,3 @@ export declare function unlockClientPasswordSession(options: ClientPasswordStora
|
|
|
49
32
|
export declare function changeClientPassword(options: ClientPasswordStorageOptions & {
|
|
50
33
|
prompt: ClientPasswordPrompt;
|
|
51
34
|
}): Promise<ClientPasswordSessionStatus>;
|
|
52
|
-
export declare function createLegacyKeychainServiceName(): string;
|
|
53
|
-
export declare function createAgentBootstrapState(options: {
|
|
54
|
-
unlockUntilUnixMs: number;
|
|
55
|
-
derivedKeyBase64: string;
|
|
56
|
-
}): {
|
|
57
|
-
unlockUntilUnixMs: number;
|
|
58
|
-
derivedKeyBase64: string;
|
|
59
|
-
};
|
|
60
|
-
export declare function describeClientPasswordLockedMessage(): string;
|
|
61
|
-
export declare function describeClientPasswordSetupMessage(): string;
|
|
62
|
-
export declare function describeClientPasswordMigrationMessage(): string;
|
|
63
|
-
export declare function listLocalSecretFilesForTesting(options: {
|
|
64
|
-
directoryPath: string;
|
|
65
|
-
}): Promise<string[]>;
|