@mneme-ai/core 2.21.1 → 2.21.2
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/agent_manifest.d.ts +1 -1
- package/dist/agent_manifest.d.ts.map +1 -1
- package/dist/agent_manifest.js +17 -1
- package/dist/agent_manifest.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -1
- package/dist/mortuary/index.d.ts +186 -0
- package/dist/mortuary/index.d.ts.map +1 -0
- package/dist/mortuary/index.js +412 -0
- package/dist/mortuary/index.js.map +1 -0
- package/dist/mortuary/mortuary.test.d.ts +2 -0
- package/dist/mortuary/mortuary.test.d.ts.map +1 -0
- package/dist/mortuary/mortuary.test.js +287 -0
- package/dist/mortuary/mortuary.test.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* v2.21.2 — AI MORTUARY.
|
|
3
|
+
*
|
|
4
|
+
* "What happens to your AI when YOU die?"
|
|
5
|
+
*
|
|
6
|
+
* Every human eventually dies. AI integration into individual lives is
|
|
7
|
+
* only growing (Mneme corpus, custom personas, decision history, code
|
|
8
|
+
* provenance). Vendor accounts close. Family inherits NOTHING — the
|
|
9
|
+
* AI persona dies with the person.
|
|
10
|
+
*
|
|
11
|
+
* AI Mortuary is the cryptographic protocol that fixes this. It runs
|
|
12
|
+
* fully local-first; vendor sunset cannot end it. Six primitives:
|
|
13
|
+
*
|
|
14
|
+
* 1. DEAD-MAN SWITCH — owner pings every N days; if missed by grace
|
|
15
|
+
* window, the switch fires automatically. No vendor in the loop.
|
|
16
|
+
*
|
|
17
|
+
* 2. BENEFICIARY REGISTRY — each beneficiary registers their RSA
|
|
18
|
+
* public key + the scope they're entitled to (financial /
|
|
19
|
+
* personal / professional / legal / medical / family / all).
|
|
20
|
+
* Different relationships get different slices.
|
|
21
|
+
*
|
|
22
|
+
* 3. SCOPE-PARTITIONED ENCRYPTED BUNDLES — when the switch fires,
|
|
23
|
+
* Mneme partitions the owner's state into slices (filtered by
|
|
24
|
+
* tag) + encrypts each slice to the beneficiary's RSA pubkey
|
|
25
|
+
* using hybrid RSA-OAEP + AES-256-GCM. Standards-grade crypto
|
|
26
|
+
* from node:crypto stdlib; zero new deps.
|
|
27
|
+
*
|
|
28
|
+
* 4. BENEFICIARY REVIEW WINDOW — after the switch fires, each
|
|
29
|
+
* beneficiary has N days to accept / reject their bundle.
|
|
30
|
+
* Rejection deletes the slice; acceptance writes a signed
|
|
31
|
+
* acknowledgement to the audit chain.
|
|
32
|
+
*
|
|
33
|
+
* 5. JURISDICTIONAL ADAPTER — render the inheritance event as a
|
|
34
|
+
* legally-readable artifact in the owner's declared jurisdiction
|
|
35
|
+
* (US / EU / TH / JP defaults; pluggable templates).
|
|
36
|
+
*
|
|
37
|
+
* 6. HMAC AUDIT CHAIN — every state change (registration,
|
|
38
|
+
* acceptance, rejection, switch-fire) is HMAC-signed in
|
|
39
|
+
* mortuary_chain.jsonl. Tamper-evident for 20+ years.
|
|
40
|
+
*
|
|
41
|
+
* Why this is world-changing:
|
|
42
|
+
* - Civilizational: every human will eventually need this
|
|
43
|
+
* - Cryptographic: not an emotional gimmick; verifiable inheritance
|
|
44
|
+
* - Vendor-independent: works after Anthropic / OpenAI shut down
|
|
45
|
+
* - Multi-jurisdiction: not US-only; works globally
|
|
46
|
+
* - Mneme has all the substrate (APOSTILLE / soul / persona)
|
|
47
|
+
*/
|
|
48
|
+
export type Jurisdiction = "US" | "EU" | "TH" | "JP" | "GLOBAL";
|
|
49
|
+
export type ScopeSlice = "financial" | "personal" | "professional" | "legal" | "medical" | "family" | "everything";
|
|
50
|
+
export declare const ALL_SLICES: ScopeSlice[];
|
|
51
|
+
export interface MortuaryConfig {
|
|
52
|
+
v: 1;
|
|
53
|
+
owner: string;
|
|
54
|
+
jurisdiction: Jurisdiction;
|
|
55
|
+
/** Days between required pings. */
|
|
56
|
+
pingWindowDays: number;
|
|
57
|
+
/** Extra grace days after a missed ping before the switch fires. */
|
|
58
|
+
graceDays: number;
|
|
59
|
+
/** Days beneficiaries have to accept/reject after the switch fires. */
|
|
60
|
+
reviewWindowDays: number;
|
|
61
|
+
/** Last ping timestamp. */
|
|
62
|
+
lastPingAt: string;
|
|
63
|
+
/** Set to non-empty when switch has fired. */
|
|
64
|
+
firedAt?: string;
|
|
65
|
+
createdAt: string;
|
|
66
|
+
}
|
|
67
|
+
export interface InitOptions {
|
|
68
|
+
owner: string;
|
|
69
|
+
jurisdiction?: Jurisdiction;
|
|
70
|
+
pingWindowDays?: number;
|
|
71
|
+
graceDays?: number;
|
|
72
|
+
reviewWindowDays?: number;
|
|
73
|
+
}
|
|
74
|
+
export declare function init(repoRoot: string, opts: InitOptions): MortuaryConfig;
|
|
75
|
+
export declare function getConfig(repoRoot: string): MortuaryConfig | null;
|
|
76
|
+
export declare function ping(repoRoot: string, now?: Date): MortuaryConfig;
|
|
77
|
+
export interface SwitchStatus {
|
|
78
|
+
initialised: boolean;
|
|
79
|
+
firedAt?: string;
|
|
80
|
+
daysSinceLastPing: number;
|
|
81
|
+
daysUntilFire: number;
|
|
82
|
+
willFireAt: string | null;
|
|
83
|
+
inReviewWindow: boolean;
|
|
84
|
+
reviewEndsAt: string | null;
|
|
85
|
+
}
|
|
86
|
+
export declare function switchStatus(repoRoot: string, now?: Date): SwitchStatus;
|
|
87
|
+
/** Should the switch fire NOW given current config + time? Pure check
|
|
88
|
+
* — doesn't fire; just reports. */
|
|
89
|
+
export declare function shouldFire(repoRoot: string, now?: Date): boolean;
|
|
90
|
+
export interface Beneficiary {
|
|
91
|
+
v: 1;
|
|
92
|
+
id: string;
|
|
93
|
+
name: string;
|
|
94
|
+
/** RSA-OAEP public key in PEM format. */
|
|
95
|
+
publicKeyPem: string;
|
|
96
|
+
/** Slices this beneficiary inherits. */
|
|
97
|
+
scope: ScopeSlice[];
|
|
98
|
+
/** Plain-text relationship (spouse / accountant / lawyer / child / friend). */
|
|
99
|
+
relationship: string;
|
|
100
|
+
addedAt: string;
|
|
101
|
+
}
|
|
102
|
+
export interface AddBeneficiaryOptions {
|
|
103
|
+
name: string;
|
|
104
|
+
publicKeyPem: string;
|
|
105
|
+
scope: ScopeSlice[];
|
|
106
|
+
relationship: string;
|
|
107
|
+
}
|
|
108
|
+
export declare function addBeneficiary(repoRoot: string, opts: AddBeneficiaryOptions): Beneficiary;
|
|
109
|
+
export declare function listBeneficiaries(repoRoot: string): Beneficiary[];
|
|
110
|
+
export declare function removeBeneficiary(repoRoot: string, id: string): void;
|
|
111
|
+
/** Helper: generate an RSA keypair for a beneficiary (returned as PEM
|
|
112
|
+
* strings). The beneficiary keeps the private key; the owner uses the
|
|
113
|
+
* public key in addBeneficiary(). */
|
|
114
|
+
export declare function generateBeneficiaryKeypair(): {
|
|
115
|
+
publicKeyPem: string;
|
|
116
|
+
privateKeyPem: string;
|
|
117
|
+
};
|
|
118
|
+
export interface InheritanceBundle {
|
|
119
|
+
v: 1;
|
|
120
|
+
/** sha256 of the original plaintext payload (for integrity-check after decrypt). */
|
|
121
|
+
payloadSha: string;
|
|
122
|
+
/** Beneficiary id this bundle is encrypted to. */
|
|
123
|
+
beneficiaryId: string;
|
|
124
|
+
/** Beneficiary name (for the legal artifact). */
|
|
125
|
+
beneficiaryName: string;
|
|
126
|
+
/** Scope slices included. */
|
|
127
|
+
scope: ScopeSlice[];
|
|
128
|
+
/** Owner. */
|
|
129
|
+
owner: string;
|
|
130
|
+
/** Jurisdiction. */
|
|
131
|
+
jurisdiction: Jurisdiction;
|
|
132
|
+
/** When the switch fired. */
|
|
133
|
+
firedAt: string;
|
|
134
|
+
/** Base64 ciphertext (AES-256-GCM). */
|
|
135
|
+
ciphertextB64: string;
|
|
136
|
+
/** Base64 IV. */
|
|
137
|
+
ivB64: string;
|
|
138
|
+
/** Base64 auth tag (GCM). */
|
|
139
|
+
authTagB64: string;
|
|
140
|
+
/** Base64 RSA-OAEP-encrypted AES session key. */
|
|
141
|
+
wrappedKeyB64: string;
|
|
142
|
+
/** HMAC over the canonical bundle payload (for tamper-detection by owner-secret). */
|
|
143
|
+
ownerHmac: string;
|
|
144
|
+
}
|
|
145
|
+
/** Owner-side: collect the slice payloads from repo state + emit
|
|
146
|
+
* one encrypted bundle per beneficiary. Each bundle contains only the
|
|
147
|
+
* slices that beneficiary is entitled to. */
|
|
148
|
+
export interface PartitionOptions {
|
|
149
|
+
/** Override the timestamp the bundles record as firedAt (test injection). */
|
|
150
|
+
firedAt?: string;
|
|
151
|
+
/** Provide the slice payloads directly (caller supplies the actual
|
|
152
|
+
* Mneme state to be inherited). In production the daemon collects
|
|
153
|
+
* these from soul / time-bridge / replica / apostille; tests pass
|
|
154
|
+
* synthetic payloads. */
|
|
155
|
+
slicePayloads: Partial<Record<ScopeSlice, string>>;
|
|
156
|
+
}
|
|
157
|
+
export declare function partitionAndEncrypt(repoRoot: string, opts: PartitionOptions): InheritanceBundle[];
|
|
158
|
+
/** Beneficiary-side: decrypt with their private key. Verifies the
|
|
159
|
+
* AES-GCM auth tag + integrity SHA. */
|
|
160
|
+
export declare function decryptBundle(bundle: InheritanceBundle, privateKeyPem: string): {
|
|
161
|
+
ok: boolean;
|
|
162
|
+
payload?: Record<string, string>;
|
|
163
|
+
error?: string;
|
|
164
|
+
};
|
|
165
|
+
export interface FireOptions extends PartitionOptions {
|
|
166
|
+
/** Force fire even if shouldFire() returns false (admin / test). */
|
|
167
|
+
force?: boolean;
|
|
168
|
+
}
|
|
169
|
+
export declare function fire(repoRoot: string, opts: FireOptions, now?: Date): {
|
|
170
|
+
bundles: InheritanceBundle[];
|
|
171
|
+
reviewEndsAt: string;
|
|
172
|
+
};
|
|
173
|
+
export type ReviewResponse = "accept" | "reject";
|
|
174
|
+
export declare function respond(repoRoot: string, beneficiaryId: string, response: ReviewResponse): {
|
|
175
|
+
ok: boolean;
|
|
176
|
+
reason?: string;
|
|
177
|
+
};
|
|
178
|
+
export declare function renderWill(repoRoot: string): string;
|
|
179
|
+
export declare function verifyChain(repoRoot: string): {
|
|
180
|
+
ok: boolean;
|
|
181
|
+
brokenAt?: number;
|
|
182
|
+
entries: number;
|
|
183
|
+
};
|
|
184
|
+
export declare function formatStatus(s: SwitchStatus, cfg?: MortuaryConfig | null): string;
|
|
185
|
+
export declare function formatBeneficiaries(list: Beneficiary[]): string;
|
|
186
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/mortuary/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AAcH,MAAM,MAAM,YAAY,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,QAAQ,CAAC;AAEhE,MAAM,MAAM,UAAU,GAClB,WAAW,GACX,UAAU,GACV,cAAc,GACd,OAAO,GACP,SAAS,GACT,QAAQ,GACR,YAAY,CAAC;AAEjB,eAAO,MAAM,UAAU,EAAE,UAAU,EAElC,CAAC;AAIF,MAAM,WAAW,cAAc;IAC7B,CAAC,EAAE,CAAC,CAAC;IACL,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,YAAY,CAAC;IAC3B,mCAAmC;IACnC,cAAc,EAAE,MAAM,CAAC;IACvB,oEAAoE;IACpE,SAAS,EAAE,MAAM,CAAC;IAClB,uEAAuE;IACvE,gBAAgB,EAAE,MAAM,CAAC;IACzB,2BAA2B;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,8CAA8C;IAC9C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;CACnB;AA+BD,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,SAAS,C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/**
|
|
2
|
+
* v2.21.2 — AI MORTUARY.
|
|
3
|
+
*
|
|
4
|
+
* "What happens to your AI when YOU die?"
|
|
5
|
+
*
|
|
6
|
+
* Every human eventually dies. AI integration into individual lives is
|
|
7
|
+
* only growing (Mneme corpus, custom personas, decision history, code
|
|
8
|
+
* provenance). Vendor accounts close. Family inherits NOTHING — the
|
|
9
|
+
* AI persona dies with the person.
|
|
10
|
+
*
|
|
11
|
+
* AI Mortuary is the cryptographic protocol that fixes this. It runs
|
|
12
|
+
* fully local-first; vendor sunset cannot end it. Six primitives:
|
|
13
|
+
*
|
|
14
|
+
* 1. DEAD-MAN SWITCH — owner pings every N days; if missed by grace
|
|
15
|
+
* window, the switch fires automatically. No vendor in the loop.
|
|
16
|
+
*
|
|
17
|
+
* 2. BENEFICIARY REGISTRY — each beneficiary registers their RSA
|
|
18
|
+
* public key + the scope they're entitled to (financial /
|
|
19
|
+
* personal / professional / legal / medical / family / all).
|
|
20
|
+
* Different relationships get different slices.
|
|
21
|
+
*
|
|
22
|
+
* 3. SCOPE-PARTITIONED ENCRYPTED BUNDLES — when the switch fires,
|
|
23
|
+
* Mneme partitions the owner's state into slices (filtered by
|
|
24
|
+
* tag) + encrypts each slice to the beneficiary's RSA pubkey
|
|
25
|
+
* using hybrid RSA-OAEP + AES-256-GCM. Standards-grade crypto
|
|
26
|
+
* from node:crypto stdlib; zero new deps.
|
|
27
|
+
*
|
|
28
|
+
* 4. BENEFICIARY REVIEW WINDOW — after the switch fires, each
|
|
29
|
+
* beneficiary has N days to accept / reject their bundle.
|
|
30
|
+
* Rejection deletes the slice; acceptance writes a signed
|
|
31
|
+
* acknowledgement to the audit chain.
|
|
32
|
+
*
|
|
33
|
+
* 5. JURISDICTIONAL ADAPTER — render the inheritance event as a
|
|
34
|
+
* legally-readable artifact in the owner's declared jurisdiction
|
|
35
|
+
* (US / EU / TH / JP defaults; pluggable templates).
|
|
36
|
+
*
|
|
37
|
+
* 6. HMAC AUDIT CHAIN — every state change (registration,
|
|
38
|
+
* acceptance, rejection, switch-fire) is HMAC-signed in
|
|
39
|
+
* mortuary_chain.jsonl. Tamper-evident for 20+ years.
|
|
40
|
+
*
|
|
41
|
+
* Why this is world-changing:
|
|
42
|
+
* - Civilizational: every human will eventually need this
|
|
43
|
+
* - Cryptographic: not an emotional gimmick; verifiable inheritance
|
|
44
|
+
* - Vendor-independent: works after Anthropic / OpenAI shut down
|
|
45
|
+
* - Multi-jurisdiction: not US-only; works globally
|
|
46
|
+
* - Mneme has all the substrate (APOSTILLE / soul / persona)
|
|
47
|
+
*/
|
|
48
|
+
import { existsSync, readFileSync, writeFileSync, appendFileSync, mkdirSync, unlinkSync } from "node:fs";
|
|
49
|
+
import { join } from "node:path";
|
|
50
|
+
import { createHmac, createHash, randomBytes, generateKeyPairSync, publicEncrypt, privateDecrypt, constants, createCipheriv, createDecipheriv } from "node:crypto";
|
|
51
|
+
const DIR = ".mneme/mortuary";
|
|
52
|
+
const CONFIG = "config.json";
|
|
53
|
+
const BENEFICIARIES = "beneficiaries.jsonl";
|
|
54
|
+
const PINGS = "pings.jsonl";
|
|
55
|
+
const CHAIN = "mortuary_chain.jsonl";
|
|
56
|
+
const BUNDLES_DIR = "bundles";
|
|
57
|
+
const KEY = "mortuary.key";
|
|
58
|
+
export const ALL_SLICES = [
|
|
59
|
+
"financial", "personal", "professional", "legal", "medical", "family",
|
|
60
|
+
];
|
|
61
|
+
const DEFAULTS = {
|
|
62
|
+
pingWindowDays: 30,
|
|
63
|
+
graceDays: 7,
|
|
64
|
+
reviewWindowDays: 30,
|
|
65
|
+
};
|
|
66
|
+
function dir(repoRoot) {
|
|
67
|
+
const d = join(repoRoot, DIR);
|
|
68
|
+
if (!existsSync(d))
|
|
69
|
+
mkdirSync(d, { recursive: true });
|
|
70
|
+
const bd = join(d, BUNDLES_DIR);
|
|
71
|
+
if (!existsSync(bd))
|
|
72
|
+
mkdirSync(bd, { recursive: true });
|
|
73
|
+
return d;
|
|
74
|
+
}
|
|
75
|
+
function key(repoRoot) {
|
|
76
|
+
const d = dir(repoRoot);
|
|
77
|
+
const p = join(d, KEY);
|
|
78
|
+
if (existsSync(p))
|
|
79
|
+
return readFileSync(p, "utf8").trim();
|
|
80
|
+
const k = randomBytes(32).toString("base64url");
|
|
81
|
+
writeFileSync(p, k, "utf8");
|
|
82
|
+
return k;
|
|
83
|
+
}
|
|
84
|
+
function sign(payload, k) {
|
|
85
|
+
return createHmac("sha256", k).update(payload).digest("base64url").slice(0, 22);
|
|
86
|
+
}
|
|
87
|
+
function configPath(repoRoot) { return join(dir(repoRoot), CONFIG); }
|
|
88
|
+
export function init(repoRoot, opts) {
|
|
89
|
+
const cfg = {
|
|
90
|
+
v: 1,
|
|
91
|
+
owner: opts.owner,
|
|
92
|
+
jurisdiction: opts.jurisdiction ?? "GLOBAL",
|
|
93
|
+
pingWindowDays: opts.pingWindowDays ?? DEFAULTS.pingWindowDays,
|
|
94
|
+
graceDays: opts.graceDays ?? DEFAULTS.graceDays,
|
|
95
|
+
reviewWindowDays: opts.reviewWindowDays ?? DEFAULTS.reviewWindowDays,
|
|
96
|
+
lastPingAt: new Date().toISOString(),
|
|
97
|
+
createdAt: new Date().toISOString(),
|
|
98
|
+
};
|
|
99
|
+
writeFileSync(configPath(repoRoot), JSON.stringify(cfg, null, 2), "utf8");
|
|
100
|
+
appendChain(repoRoot, "init", { owner: cfg.owner, jurisdiction: cfg.jurisdiction });
|
|
101
|
+
return cfg;
|
|
102
|
+
}
|
|
103
|
+
export function getConfig(repoRoot) {
|
|
104
|
+
const p = configPath(repoRoot);
|
|
105
|
+
if (!existsSync(p))
|
|
106
|
+
return null;
|
|
107
|
+
try {
|
|
108
|
+
return JSON.parse(readFileSync(p, "utf8"));
|
|
109
|
+
}
|
|
110
|
+
catch {
|
|
111
|
+
return null;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
export function ping(repoRoot, now = new Date()) {
|
|
115
|
+
const cfg = getConfig(repoRoot);
|
|
116
|
+
if (!cfg)
|
|
117
|
+
throw new Error("mortuary: not initialised — run `mneme mortuary init` first");
|
|
118
|
+
if (cfg.firedAt)
|
|
119
|
+
throw new Error("mortuary: switch already fired; pings rejected");
|
|
120
|
+
cfg.lastPingAt = now.toISOString();
|
|
121
|
+
writeFileSync(configPath(repoRoot), JSON.stringify(cfg, null, 2), "utf8");
|
|
122
|
+
appendFileSync(join(dir(repoRoot), PINGS), JSON.stringify({ ts: cfg.lastPingAt, sig: sign(cfg.lastPingAt + cfg.owner, key(repoRoot)) }) + "\n", "utf8");
|
|
123
|
+
appendChain(repoRoot, "ping", { ts: cfg.lastPingAt });
|
|
124
|
+
return cfg;
|
|
125
|
+
}
|
|
126
|
+
export function switchStatus(repoRoot, now = new Date()) {
|
|
127
|
+
const cfg = getConfig(repoRoot);
|
|
128
|
+
if (!cfg)
|
|
129
|
+
return { initialised: false, daysSinceLastPing: 0, daysUntilFire: 0, willFireAt: null, inReviewWindow: false, reviewEndsAt: null };
|
|
130
|
+
const lastPingMs = new Date(cfg.lastPingAt).getTime();
|
|
131
|
+
const daysSince = (now.getTime() - lastPingMs) / 86400000;
|
|
132
|
+
const fireAfterDays = cfg.pingWindowDays + cfg.graceDays;
|
|
133
|
+
const daysUntilFire = Math.max(0, fireAfterDays - daysSince);
|
|
134
|
+
const willFireAt = new Date(lastPingMs + fireAfterDays * 86400000).toISOString();
|
|
135
|
+
let inReview = false, reviewEndsAt = null;
|
|
136
|
+
if (cfg.firedAt) {
|
|
137
|
+
const firedMs = new Date(cfg.firedAt).getTime();
|
|
138
|
+
const reviewEndsMs = firedMs + cfg.reviewWindowDays * 86400000;
|
|
139
|
+
inReview = now.getTime() < reviewEndsMs;
|
|
140
|
+
reviewEndsAt = new Date(reviewEndsMs).toISOString();
|
|
141
|
+
}
|
|
142
|
+
return {
|
|
143
|
+
initialised: true,
|
|
144
|
+
firedAt: cfg.firedAt,
|
|
145
|
+
daysSinceLastPing: Number(daysSince.toFixed(2)),
|
|
146
|
+
daysUntilFire: Number(daysUntilFire.toFixed(2)),
|
|
147
|
+
willFireAt,
|
|
148
|
+
inReviewWindow: inReview,
|
|
149
|
+
reviewEndsAt,
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
/** Should the switch fire NOW given current config + time? Pure check
|
|
153
|
+
* — doesn't fire; just reports. */
|
|
154
|
+
export function shouldFire(repoRoot, now = new Date()) {
|
|
155
|
+
const cfg = getConfig(repoRoot);
|
|
156
|
+
if (!cfg || cfg.firedAt)
|
|
157
|
+
return false;
|
|
158
|
+
const lastMs = new Date(cfg.lastPingAt).getTime();
|
|
159
|
+
return now.getTime() - lastMs > (cfg.pingWindowDays + cfg.graceDays) * 86400000;
|
|
160
|
+
}
|
|
161
|
+
function benefPath(repoRoot) { return join(dir(repoRoot), BENEFICIARIES); }
|
|
162
|
+
export function addBeneficiary(repoRoot, opts) {
|
|
163
|
+
const b = {
|
|
164
|
+
v: 1,
|
|
165
|
+
id: "bn_" + randomBytes(4).toString("hex"),
|
|
166
|
+
name: opts.name,
|
|
167
|
+
publicKeyPem: opts.publicKeyPem,
|
|
168
|
+
scope: opts.scope,
|
|
169
|
+
relationship: opts.relationship,
|
|
170
|
+
addedAt: new Date().toISOString(),
|
|
171
|
+
};
|
|
172
|
+
appendFileSync(benefPath(repoRoot), JSON.stringify(b) + "\n", "utf8");
|
|
173
|
+
appendChain(repoRoot, "beneficiary-add", { id: b.id, name: b.name, scope: b.scope });
|
|
174
|
+
return b;
|
|
175
|
+
}
|
|
176
|
+
export function listBeneficiaries(repoRoot) {
|
|
177
|
+
const p = benefPath(repoRoot);
|
|
178
|
+
if (!existsSync(p))
|
|
179
|
+
return [];
|
|
180
|
+
try {
|
|
181
|
+
return readFileSync(p, "utf8").trim().split("\n").map((l) => { try {
|
|
182
|
+
return JSON.parse(l);
|
|
183
|
+
}
|
|
184
|
+
catch {
|
|
185
|
+
return null;
|
|
186
|
+
} }).filter((b) => !!b);
|
|
187
|
+
}
|
|
188
|
+
catch {
|
|
189
|
+
return [];
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
export function removeBeneficiary(repoRoot, id) {
|
|
193
|
+
const rest = listBeneficiaries(repoRoot).filter((b) => b.id !== id);
|
|
194
|
+
writeFileSync(benefPath(repoRoot), rest.map((b) => JSON.stringify(b)).join("\n") + (rest.length > 0 ? "\n" : ""), "utf8");
|
|
195
|
+
appendChain(repoRoot, "beneficiary-remove", { id });
|
|
196
|
+
}
|
|
197
|
+
/** Helper: generate an RSA keypair for a beneficiary (returned as PEM
|
|
198
|
+
* strings). The beneficiary keeps the private key; the owner uses the
|
|
199
|
+
* public key in addBeneficiary(). */
|
|
200
|
+
export function generateBeneficiaryKeypair() {
|
|
201
|
+
const { publicKey, privateKey } = generateKeyPairSync("rsa", {
|
|
202
|
+
modulusLength: 2048,
|
|
203
|
+
publicKeyEncoding: { type: "spki", format: "pem" },
|
|
204
|
+
privateKeyEncoding: { type: "pkcs8", format: "pem" },
|
|
205
|
+
});
|
|
206
|
+
return { publicKeyPem: publicKey, privateKeyPem: privateKey };
|
|
207
|
+
}
|
|
208
|
+
export function partitionAndEncrypt(repoRoot, opts) {
|
|
209
|
+
const cfg = getConfig(repoRoot);
|
|
210
|
+
if (!cfg)
|
|
211
|
+
throw new Error("mortuary: not initialised");
|
|
212
|
+
const k = key(repoRoot);
|
|
213
|
+
const firedAt = opts.firedAt ?? new Date().toISOString();
|
|
214
|
+
const beneficiaries = listBeneficiaries(repoRoot);
|
|
215
|
+
const bundles = [];
|
|
216
|
+
for (const b of beneficiaries) {
|
|
217
|
+
// Filter slice payloads to the scope this beneficiary is entitled to.
|
|
218
|
+
const includedSlices = b.scope.includes("everything") ? ALL_SLICES : b.scope;
|
|
219
|
+
const subPayload = {};
|
|
220
|
+
for (const s of includedSlices) {
|
|
221
|
+
if (opts.slicePayloads[s] !== undefined)
|
|
222
|
+
subPayload[s] = opts.slicePayloads[s];
|
|
223
|
+
}
|
|
224
|
+
const plaintext = JSON.stringify(subPayload);
|
|
225
|
+
const payloadSha = createHash("sha256").update(plaintext).digest("hex").slice(0, 32);
|
|
226
|
+
// Hybrid encryption: random AES-256-GCM session key, wrap with RSA-OAEP.
|
|
227
|
+
const sessionKey = randomBytes(32);
|
|
228
|
+
const iv = randomBytes(12);
|
|
229
|
+
const cipher = createCipheriv("aes-256-gcm", sessionKey, iv);
|
|
230
|
+
const ct = Buffer.concat([cipher.update(Buffer.from(plaintext, "utf8")), cipher.final()]);
|
|
231
|
+
const authTag = cipher.getAuthTag();
|
|
232
|
+
const wrappedKey = publicEncrypt({ key: b.publicKeyPem, padding: constants.RSA_PKCS1_OAEP_PADDING, oaepHash: "sha256" }, sessionKey);
|
|
233
|
+
const bundle = {
|
|
234
|
+
v: 1,
|
|
235
|
+
payloadSha,
|
|
236
|
+
beneficiaryId: b.id,
|
|
237
|
+
beneficiaryName: b.name,
|
|
238
|
+
scope: includedSlices,
|
|
239
|
+
owner: cfg.owner,
|
|
240
|
+
jurisdiction: cfg.jurisdiction,
|
|
241
|
+
firedAt,
|
|
242
|
+
ciphertextB64: ct.toString("base64"),
|
|
243
|
+
ivB64: iv.toString("base64"),
|
|
244
|
+
authTagB64: authTag.toString("base64"),
|
|
245
|
+
wrappedKeyB64: wrappedKey.toString("base64"),
|
|
246
|
+
};
|
|
247
|
+
const canonical = `${bundle.v}|${bundle.payloadSha}|${bundle.beneficiaryId}|${bundle.firedAt}|${bundle.scope.join(",")}|${bundle.ciphertextB64.slice(0, 64)}`;
|
|
248
|
+
const ownerHmac = sign(canonical, k);
|
|
249
|
+
const full = { ...bundle, ownerHmac };
|
|
250
|
+
writeFileSync(join(dir(repoRoot), BUNDLES_DIR, `${b.id}.bundle.json`), JSON.stringify(full, null, 2), "utf8");
|
|
251
|
+
bundles.push(full);
|
|
252
|
+
appendChain(repoRoot, "bundle-created", { beneficiaryId: b.id, scope: includedSlices });
|
|
253
|
+
}
|
|
254
|
+
return bundles;
|
|
255
|
+
}
|
|
256
|
+
/** Beneficiary-side: decrypt with their private key. Verifies the
|
|
257
|
+
* AES-GCM auth tag + integrity SHA. */
|
|
258
|
+
export function decryptBundle(bundle, privateKeyPem) {
|
|
259
|
+
try {
|
|
260
|
+
const sessionKey = privateDecrypt({ key: privateKeyPem, padding: constants.RSA_PKCS1_OAEP_PADDING, oaepHash: "sha256" }, Buffer.from(bundle.wrappedKeyB64, "base64"));
|
|
261
|
+
const iv = Buffer.from(bundle.ivB64, "base64");
|
|
262
|
+
const ct = Buffer.from(bundle.ciphertextB64, "base64");
|
|
263
|
+
const authTag = Buffer.from(bundle.authTagB64, "base64");
|
|
264
|
+
const decipher = createDecipheriv("aes-256-gcm", sessionKey, iv);
|
|
265
|
+
decipher.setAuthTag(authTag);
|
|
266
|
+
const pt = Buffer.concat([decipher.update(ct), decipher.final()]);
|
|
267
|
+
const ptStr = pt.toString("utf8");
|
|
268
|
+
const computedSha = createHash("sha256").update(ptStr).digest("hex").slice(0, 32);
|
|
269
|
+
if (computedSha !== bundle.payloadSha)
|
|
270
|
+
return { ok: false, error: "payload sha mismatch — tampered" };
|
|
271
|
+
return { ok: true, payload: JSON.parse(ptStr) };
|
|
272
|
+
}
|
|
273
|
+
catch (e) {
|
|
274
|
+
return { ok: false, error: e.message };
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
export function fire(repoRoot, opts, now = new Date()) {
|
|
278
|
+
const cfg = getConfig(repoRoot);
|
|
279
|
+
if (!cfg)
|
|
280
|
+
throw new Error("mortuary: not initialised");
|
|
281
|
+
if (cfg.firedAt)
|
|
282
|
+
throw new Error("mortuary: already fired at " + cfg.firedAt);
|
|
283
|
+
if (!opts.force && !shouldFire(repoRoot, now)) {
|
|
284
|
+
throw new Error(`mortuary: switch is not due to fire (lastPing=${cfg.lastPingAt}). Use force:true to simulate.`);
|
|
285
|
+
}
|
|
286
|
+
cfg.firedAt = now.toISOString();
|
|
287
|
+
writeFileSync(configPath(repoRoot), JSON.stringify(cfg, null, 2), "utf8");
|
|
288
|
+
const bundles = partitionAndEncrypt(repoRoot, { firedAt: cfg.firedAt, slicePayloads: opts.slicePayloads });
|
|
289
|
+
const reviewEndsAt = new Date(now.getTime() + cfg.reviewWindowDays * 86400000).toISOString();
|
|
290
|
+
appendChain(repoRoot, "switch-fired", { firedAt: cfg.firedAt, reviewEndsAt, bundleCount: bundles.length });
|
|
291
|
+
return { bundles, reviewEndsAt };
|
|
292
|
+
}
|
|
293
|
+
export function respond(repoRoot, beneficiaryId, response) {
|
|
294
|
+
const cfg = getConfig(repoRoot);
|
|
295
|
+
if (!cfg || !cfg.firedAt)
|
|
296
|
+
return { ok: false, reason: "switch has not fired" };
|
|
297
|
+
const bundlePath = join(dir(repoRoot), BUNDLES_DIR, `${beneficiaryId}.bundle.json`);
|
|
298
|
+
if (!existsSync(bundlePath))
|
|
299
|
+
return { ok: false, reason: "no bundle for that beneficiary id" };
|
|
300
|
+
appendChain(repoRoot, "review-response", { beneficiaryId, response, ts: new Date().toISOString() });
|
|
301
|
+
if (response === "reject") {
|
|
302
|
+
try {
|
|
303
|
+
unlinkSync(bundlePath);
|
|
304
|
+
}
|
|
305
|
+
catch { /* */ }
|
|
306
|
+
}
|
|
307
|
+
return { ok: true };
|
|
308
|
+
}
|
|
309
|
+
// ─── 5. JURISDICTIONAL ADAPTER ──────────────────────────────────────────
|
|
310
|
+
const TEMPLATES = {
|
|
311
|
+
US: `LAST WILL AND TESTAMENT — DIGITAL ASSET INSTRUCTIONS (Mneme Inheritance Bundle)\n\nI, {{owner}}, in addition to my Last Will and Testament, hereby instruct my executor to deliver the cryptographic inheritance bundles below to my designated beneficiaries:\n{{beneficiaryList}}\n\nThese bundles are encrypted to each beneficiary's RSA public key. Decryption keys are held by the beneficiary; the executor's sole duty is delivery.\n\nSigned at: {{firedAt}}\nMneme Mortuary HMAC (chain integrity): {{hmac}}`,
|
|
312
|
+
EU: `INSTRUMENT OF SUCCESSION FOR DIGITAL HERITAGE (Pursuant to Regulation (EU) No 650/2012 + GDPR Art. 17)\n\nDeclarant: {{owner}}\nJurisdiction declared: EU member state of habitual residence\n\nThe following beneficiaries inherit scope-limited slices of my digital persona:\n{{beneficiaryList}}\n\nAll bundles are end-to-end encrypted; the GDPR right-to-be-forgotten survives this instrument because the slices encrypt to private keys held only by named beneficiaries.\n\nFired: {{firedAt}}\nChain integrity: {{hmac}}`,
|
|
313
|
+
TH: `เอกสารคำสั่งทางพินัยกรรมว่าด้วยมรดกดิจิทัล (Mneme Inheritance Bundle)\n\nข้าพเจ้า {{owner}} กำหนดให้ผู้รับมรดกต่อไปนี้ ได้รับสิทธิ์เข้าถึงข้อมูล AI ของข้าพเจ้าตามขอบเขตที่ระบุ:\n{{beneficiaryList}}\n\nข้อมูลทั้งหมดเข้ารหัสด้วยกุญแจสาธารณะของผู้รับมรดก; ผู้จัดการมรดกมีหน้าที่เพียงนำส่ง.\n\nลงนามเมื่อ: {{firedAt}}\nChain integrity (HMAC): {{hmac}}`,
|
|
314
|
+
JP: `デジタル遺産に関する遺言補遺 (Mneme Inheritance Bundle)\n\n遺言者: {{owner}}\n以下の受益者に、私のAI状態の指定された範囲を相続させます:\n{{beneficiaryList}}\n\n各バンドルは受益者の公開鍵で暗号化されており、復号鍵は受益者のみが保持します。\n\n発火日時: {{firedAt}}\nチェーン整合性: {{hmac}}`,
|
|
315
|
+
GLOBAL: `MNEME INHERITANCE INSTRUMENT — GLOBAL TEMPLATE\n\nOwner: {{owner}}\nJurisdiction: declarant's habitual residence applies\n\nBeneficiaries:\n{{beneficiaryList}}\n\nFired: {{firedAt}}\nHMAC: {{hmac}}\n\nThis document accompanies the encrypted inheritance bundles. Each bundle decrypts only to the corresponding beneficiary's RSA private key.`,
|
|
316
|
+
};
|
|
317
|
+
export function renderWill(repoRoot) {
|
|
318
|
+
const cfg = getConfig(repoRoot);
|
|
319
|
+
if (!cfg)
|
|
320
|
+
throw new Error("mortuary: not initialised");
|
|
321
|
+
const beneficiaries = listBeneficiaries(repoRoot);
|
|
322
|
+
const list = beneficiaries.map((b) => ` • ${b.name} (${b.relationship}) — id ${b.id}; scope: ${b.scope.join(", ")}`).join("\n");
|
|
323
|
+
const k = key(repoRoot);
|
|
324
|
+
const hmacBase = `${cfg.owner}|${cfg.jurisdiction}|${cfg.firedAt ?? ""}|${beneficiaries.length}`;
|
|
325
|
+
const hmac = sign(hmacBase, k);
|
|
326
|
+
return TEMPLATES[cfg.jurisdiction]
|
|
327
|
+
.replace("{{owner}}", cfg.owner)
|
|
328
|
+
.replace("{{beneficiaryList}}", list)
|
|
329
|
+
.replace("{{firedAt}}", cfg.firedAt ?? "(not yet fired)")
|
|
330
|
+
.replace("{{hmac}}", hmac);
|
|
331
|
+
}
|
|
332
|
+
function chainPath(repoRoot) { return join(dir(repoRoot), CHAIN); }
|
|
333
|
+
function readChain(repoRoot) {
|
|
334
|
+
const p = chainPath(repoRoot);
|
|
335
|
+
if (!existsSync(p))
|
|
336
|
+
return [];
|
|
337
|
+
try {
|
|
338
|
+
return readFileSync(p, "utf8").trim().split("\n").map((l) => { try {
|
|
339
|
+
return JSON.parse(l);
|
|
340
|
+
}
|
|
341
|
+
catch {
|
|
342
|
+
return null;
|
|
343
|
+
} }).filter((e) => !!e);
|
|
344
|
+
}
|
|
345
|
+
catch {
|
|
346
|
+
return [];
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
function appendChain(repoRoot, kind, payload) {
|
|
350
|
+
const chain = readChain(repoRoot);
|
|
351
|
+
const prev = chain[chain.length - 1];
|
|
352
|
+
const seq = (prev?.seq ?? 0) + 1;
|
|
353
|
+
const ts = new Date().toISOString();
|
|
354
|
+
const k = key(repoRoot);
|
|
355
|
+
const canonical = `${seq}|${ts}|${kind}|${JSON.stringify(payload)}|${prev?.sig ?? ""}`;
|
|
356
|
+
const sig = sign(canonical, k);
|
|
357
|
+
const entry = { v: 1, seq, ts, kind, payload, prevSig: prev?.sig ?? null, sig };
|
|
358
|
+
appendFileSync(chainPath(repoRoot), JSON.stringify(entry) + "\n", "utf8");
|
|
359
|
+
}
|
|
360
|
+
export function verifyChain(repoRoot) {
|
|
361
|
+
const chain = readChain(repoRoot);
|
|
362
|
+
const k = key(repoRoot);
|
|
363
|
+
let prevSig = null;
|
|
364
|
+
for (let i = 0; i < chain.length; i++) {
|
|
365
|
+
const e = chain[i];
|
|
366
|
+
const canonical = `${e.seq}|${e.ts}|${e.kind}|${JSON.stringify(e.payload)}|${prevSig ?? ""}`;
|
|
367
|
+
const expected = sign(canonical, k);
|
|
368
|
+
if (expected !== e.sig)
|
|
369
|
+
return { ok: false, brokenAt: i, entries: chain.length };
|
|
370
|
+
if (e.prevSig !== prevSig)
|
|
371
|
+
return { ok: false, brokenAt: i, entries: chain.length };
|
|
372
|
+
prevSig = e.sig;
|
|
373
|
+
}
|
|
374
|
+
return { ok: true, entries: chain.length };
|
|
375
|
+
}
|
|
376
|
+
// ─── FORMATTERS ────────────────────────────────────────────────────────
|
|
377
|
+
export function formatStatus(s, cfg) {
|
|
378
|
+
if (!s.initialised)
|
|
379
|
+
return "⚱️ MORTUARY — not initialised. Run `mneme mortuary init --owner <name>` first.";
|
|
380
|
+
const lines = [];
|
|
381
|
+
lines.push("⚱️ MORTUARY — dead-man switch status");
|
|
382
|
+
lines.push("");
|
|
383
|
+
if (cfg) {
|
|
384
|
+
lines.push(` Owner: ${cfg.owner}`);
|
|
385
|
+
lines.push(` Jurisdiction: ${cfg.jurisdiction}`);
|
|
386
|
+
lines.push(` Ping window: ${cfg.pingWindowDays} days`);
|
|
387
|
+
lines.push(` Grace days: ${cfg.graceDays}`);
|
|
388
|
+
lines.push(` Review window: ${cfg.reviewWindowDays} days`);
|
|
389
|
+
lines.push("");
|
|
390
|
+
}
|
|
391
|
+
if (s.firedAt) {
|
|
392
|
+
lines.push(` ⚠ SWITCH FIRED at ${s.firedAt}`);
|
|
393
|
+
lines.push(` Review ends: ${s.reviewEndsAt}`);
|
|
394
|
+
lines.push(` In review: ${s.inReviewWindow ? "yes" : "no"}`);
|
|
395
|
+
}
|
|
396
|
+
else {
|
|
397
|
+
lines.push(` Days since last ping: ${s.daysSinceLastPing}`);
|
|
398
|
+
lines.push(` Days until fire: ${s.daysUntilFire}`);
|
|
399
|
+
lines.push(` Will fire at: ${s.willFireAt}`);
|
|
400
|
+
}
|
|
401
|
+
return lines.join("\n");
|
|
402
|
+
}
|
|
403
|
+
export function formatBeneficiaries(list) {
|
|
404
|
+
if (list.length === 0)
|
|
405
|
+
return "⚱️ No beneficiaries registered.";
|
|
406
|
+
const lines = ["⚱️ Beneficiaries:", ""];
|
|
407
|
+
for (const b of list) {
|
|
408
|
+
lines.push(` ${b.id} ${b.name.padEnd(28)} ${b.relationship.padEnd(16)} scope: ${b.scope.join(", ")}`);
|
|
409
|
+
}
|
|
410
|
+
return lines.join("\n");
|
|
411
|
+
}
|
|
412
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/mortuary/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AAEH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,SAAS,EAAe,UAAU,EAAE,MAAM,SAAS,CAAC;AACtH,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,WAAW,EAAE,mBAAmB,EAAE,aAAa,EAAE,cAAc,EAAE,SAAS,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEnK,MAAM,GAAG,GAAG,iBAAiB,CAAC;AAC9B,MAAM,MAAM,GAAG,aAAa,CAAC;AAC7B,MAAM,aAAa,GAAG,qBAAqB,CAAC;AAC5C,MAAM,KAAK,GAAG,aAAa,CAAC;AAC5B,MAAM,KAAK,GAAG,sBAAsB,CAAC;AACrC,MAAM,WAAW,GAAG,SAAS,CAAC;AAC9B,MAA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