instar 0.26.11 → 0.27.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.
Files changed (161) hide show
  1. package/README.md +1 -1
  2. package/dist/commands/init.d.ts +5 -0
  3. package/dist/commands/init.d.ts.map +1 -1
  4. package/dist/commands/init.js +46 -1
  5. package/dist/commands/init.js.map +1 -1
  6. package/dist/commands/server.d.ts.map +1 -1
  7. package/dist/commands/server.js +228 -36
  8. package/dist/commands/server.js.map +1 -1
  9. package/dist/commands/slack-cli.d.ts +6 -0
  10. package/dist/commands/slack-cli.d.ts.map +1 -1
  11. package/dist/commands/slack-cli.js +99 -1
  12. package/dist/commands/slack-cli.js.map +1 -1
  13. package/dist/core/GitSync.d.ts.map +1 -1
  14. package/dist/core/GitSync.js +47 -5
  15. package/dist/core/GitSync.js.map +1 -1
  16. package/dist/core/PostUpdateMigrator.d.ts +7 -1
  17. package/dist/core/PostUpdateMigrator.d.ts.map +1 -1
  18. package/dist/core/PostUpdateMigrator.js +19 -1
  19. package/dist/core/PostUpdateMigrator.js.map +1 -1
  20. package/dist/core/types.d.ts +9 -0
  21. package/dist/core/types.d.ts.map +1 -1
  22. package/dist/identity/IdentityManager.d.ts +70 -0
  23. package/dist/identity/IdentityManager.d.ts.map +1 -0
  24. package/dist/identity/IdentityManager.js +179 -0
  25. package/dist/identity/IdentityManager.js.map +1 -0
  26. package/dist/identity/KeyEncryption.d.ts +40 -0
  27. package/dist/identity/KeyEncryption.d.ts.map +1 -0
  28. package/dist/identity/KeyEncryption.js +93 -0
  29. package/dist/identity/KeyEncryption.js.map +1 -0
  30. package/dist/identity/KeyRevocation.d.ts +68 -0
  31. package/dist/identity/KeyRevocation.d.ts.map +1 -0
  32. package/dist/identity/KeyRevocation.js +171 -0
  33. package/dist/identity/KeyRevocation.js.map +1 -0
  34. package/dist/identity/KeyRotation.d.ts +43 -0
  35. package/dist/identity/KeyRotation.d.ts.map +1 -0
  36. package/dist/identity/KeyRotation.js +81 -0
  37. package/dist/identity/KeyRotation.js.map +1 -0
  38. package/dist/identity/Migration.d.ts +50 -0
  39. package/dist/identity/Migration.d.ts.map +1 -0
  40. package/dist/identity/Migration.js +125 -0
  41. package/dist/identity/Migration.js.map +1 -0
  42. package/dist/identity/RecoveryPhrase.d.ts +43 -0
  43. package/dist/identity/RecoveryPhrase.d.ts.map +1 -0
  44. package/dist/identity/RecoveryPhrase.js +93 -0
  45. package/dist/identity/RecoveryPhrase.js.map +1 -0
  46. package/dist/identity/index.d.ts +13 -0
  47. package/dist/identity/index.d.ts.map +1 -0
  48. package/dist/identity/index.js +20 -0
  49. package/dist/identity/index.js.map +1 -0
  50. package/dist/identity/types.d.ts +101 -0
  51. package/dist/identity/types.d.ts.map +1 -0
  52. package/dist/identity/types.js +55 -0
  53. package/dist/identity/types.js.map +1 -0
  54. package/dist/knowledge/TreeTriage.d.ts.map +1 -1
  55. package/dist/knowledge/TreeTriage.js +9 -0
  56. package/dist/knowledge/TreeTriage.js.map +1 -1
  57. package/dist/memory/TopicMemory.d.ts +2 -0
  58. package/dist/memory/TopicMemory.d.ts.map +1 -1
  59. package/dist/memory/TopicMemory.js +55 -0
  60. package/dist/memory/TopicMemory.js.map +1 -1
  61. package/dist/messaging/slack/SlackAdapter.d.ts +15 -4
  62. package/dist/messaging/slack/SlackAdapter.d.ts.map +1 -1
  63. package/dist/messaging/slack/SlackAdapter.js +131 -14
  64. package/dist/messaging/slack/SlackAdapter.js.map +1 -1
  65. package/dist/messaging/slack/SocketModeClient.d.ts +2 -0
  66. package/dist/messaging/slack/SocketModeClient.d.ts.map +1 -1
  67. package/dist/messaging/slack/SocketModeClient.js +31 -1
  68. package/dist/messaging/slack/SocketModeClient.js.map +1 -1
  69. package/dist/moltbridge/MoltBridgeClient.d.ts +124 -0
  70. package/dist/moltbridge/MoltBridgeClient.d.ts.map +1 -0
  71. package/dist/moltbridge/MoltBridgeClient.js +321 -0
  72. package/dist/moltbridge/MoltBridgeClient.js.map +1 -0
  73. package/dist/moltbridge/ProfileCompiler.d.ts +68 -0
  74. package/dist/moltbridge/ProfileCompiler.d.ts.map +1 -0
  75. package/dist/moltbridge/ProfileCompiler.js +317 -0
  76. package/dist/moltbridge/ProfileCompiler.js.map +1 -0
  77. package/dist/moltbridge/index.d.ts +12 -0
  78. package/dist/moltbridge/index.d.ts.map +1 -0
  79. package/dist/moltbridge/index.js +11 -0
  80. package/dist/moltbridge/index.js.map +1 -0
  81. package/dist/moltbridge/routes.d.ts +21 -0
  82. package/dist/moltbridge/routes.d.ts.map +1 -0
  83. package/dist/moltbridge/routes.js +224 -0
  84. package/dist/moltbridge/routes.js.map +1 -0
  85. package/dist/moltbridge/types.d.ts +93 -0
  86. package/dist/moltbridge/types.d.ts.map +1 -0
  87. package/dist/moltbridge/types.js +20 -0
  88. package/dist/moltbridge/types.js.map +1 -0
  89. package/dist/monitoring/PresenceProxy.d.ts +3 -0
  90. package/dist/monitoring/PresenceProxy.d.ts.map +1 -1
  91. package/dist/monitoring/PresenceProxy.js +80 -3
  92. package/dist/monitoring/PresenceProxy.js.map +1 -1
  93. package/dist/monitoring/SessionMonitor.d.ts +7 -0
  94. package/dist/monitoring/SessionMonitor.d.ts.map +1 -1
  95. package/dist/monitoring/SessionMonitor.js +47 -22
  96. package/dist/monitoring/SessionMonitor.js.map +1 -1
  97. package/dist/monitoring/TriageOrchestrator.d.ts.map +1 -1
  98. package/dist/monitoring/TriageOrchestrator.js +25 -1
  99. package/dist/monitoring/TriageOrchestrator.js.map +1 -1
  100. package/dist/scaffold/templates.d.ts.map +1 -1
  101. package/dist/scaffold/templates.js +29 -1
  102. package/dist/scaffold/templates.js.map +1 -1
  103. package/dist/server/AgentServer.d.ts +1 -0
  104. package/dist/server/AgentServer.d.ts.map +1 -1
  105. package/dist/server/AgentServer.js +1 -0
  106. package/dist/server/AgentServer.js.map +1 -1
  107. package/dist/server/routes.d.ts +2 -0
  108. package/dist/server/routes.d.ts.map +1 -1
  109. package/dist/server/routes.js +21 -0
  110. package/dist/server/routes.js.map +1 -1
  111. package/dist/threadline/AuthorizationPolicy.d.ts +110 -0
  112. package/dist/threadline/AuthorizationPolicy.d.ts.map +1 -0
  113. package/dist/threadline/AuthorizationPolicy.js +226 -0
  114. package/dist/threadline/AuthorizationPolicy.js.map +1 -0
  115. package/dist/threadline/DiscoveryWaterfall.d.ts +73 -0
  116. package/dist/threadline/DiscoveryWaterfall.d.ts.map +1 -0
  117. package/dist/threadline/DiscoveryWaterfall.js +113 -0
  118. package/dist/threadline/DiscoveryWaterfall.js.map +1 -0
  119. package/dist/threadline/ListenerSessionManager.d.ts.map +1 -1
  120. package/dist/threadline/ListenerSessionManager.js +2 -0
  121. package/dist/threadline/ListenerSessionManager.js.map +1 -1
  122. package/dist/threadline/MessageSecurity.d.ts +49 -0
  123. package/dist/threadline/MessageSecurity.d.ts.map +1 -0
  124. package/dist/threadline/MessageSecurity.js +93 -0
  125. package/dist/threadline/MessageSecurity.js.map +1 -0
  126. package/dist/threadline/SecureInvitation.d.ts +79 -0
  127. package/dist/threadline/SecureInvitation.d.ts.map +1 -0
  128. package/dist/threadline/SecureInvitation.js +164 -0
  129. package/dist/threadline/SecureInvitation.js.map +1 -0
  130. package/dist/threadline/TrustAuditLog.d.ts +49 -0
  131. package/dist/threadline/TrustAuditLog.d.ts.map +1 -0
  132. package/dist/threadline/TrustAuditLog.js +111 -0
  133. package/dist/threadline/TrustAuditLog.js.map +1 -0
  134. package/dist/threadline/TrustEvaluator.d.ts +69 -0
  135. package/dist/threadline/TrustEvaluator.d.ts.map +1 -0
  136. package/dist/threadline/TrustEvaluator.js +93 -0
  137. package/dist/threadline/TrustEvaluator.js.map +1 -0
  138. package/dist/threadline/UnifiedTrustWiring.d.ts +66 -0
  139. package/dist/threadline/UnifiedTrustWiring.d.ts.map +1 -0
  140. package/dist/threadline/UnifiedTrustWiring.js +192 -0
  141. package/dist/threadline/UnifiedTrustWiring.js.map +1 -0
  142. package/dist/threadline/client/IdentityManager.d.ts +27 -6
  143. package/dist/threadline/client/IdentityManager.d.ts.map +1 -1
  144. package/dist/threadline/client/IdentityManager.js +64 -18
  145. package/dist/threadline/client/IdentityManager.js.map +1 -1
  146. package/dist/threadline/relay/SybilProtection.d.ts +78 -0
  147. package/dist/threadline/relay/SybilProtection.d.ts.map +1 -0
  148. package/dist/threadline/relay/SybilProtection.js +187 -0
  149. package/dist/threadline/relay/SybilProtection.js.map +1 -0
  150. package/package.json +9 -3
  151. package/playbook-scripts/build-state.py +529 -0
  152. package/scripts/check-contract-evidence.js +103 -0
  153. package/scripts/pre-push-gate.js +53 -0
  154. package/scripts/run-contract-tests.js +75 -0
  155. package/src/data/builtin-manifest.json +87 -63
  156. package/src/templates/hooks/build-stop-hook.sh +79 -0
  157. package/upgrades/0.26.10.md +36 -0
  158. package/upgrades/0.27.1.md +101 -0
  159. package/upgrades/0.27.2.md +36 -0
  160. package/upgrades/NEXT.md +0 -27
  161. /package/.claude/skills/secret-setup/{SKILL.md → skill.md} +0 -0
@@ -0,0 +1,81 @@
1
+ /**
2
+ * KeyRotation — Ed25519 key rotation with dual-signed proofs.
3
+ *
4
+ * Spec Section 3.10:
5
+ * - Generate new keypair
6
+ * - Sign rotation proof with BOTH old and new keys
7
+ * - Broadcast to contacts and MoltBridge
8
+ * - Old key enters 72h grace period (can verify old sigs, can't create new grants)
9
+ * - After grace period, old key permanently revoked
10
+ */
11
+ import crypto from 'node:crypto';
12
+ import { generateIdentityKeyPair, sign, verify } from '../threadline/ThreadlineCrypto.js';
13
+ import { computeCanonicalId, computeDisplayFingerprint, KEY_ROTATION_GRACE_MS } from './types.js';
14
+ // ── Constants ────────────────────────────────────────────────────────
15
+ const ROTATION_PROOF_DOMAIN = 'instar-key-rotation-v1';
16
+ // ── Public API ───────────────────────────────────────────────────────
17
+ /**
18
+ * Generate a new keypair and create a dual-signed rotation proof.
19
+ *
20
+ * Both the old and new private keys sign the same rotation payload,
21
+ * proving the holder controls both keys.
22
+ */
23
+ export function createRotation(oldPrivateKey, oldPublicKey, reason) {
24
+ const newKeypair = generateIdentityKeyPair();
25
+ const timestamp = new Date().toISOString();
26
+ const message = buildRotationMessage(oldPublicKey, newKeypair.publicKey, timestamp, reason);
27
+ const oldKeySignature = sign(oldPrivateKey, message);
28
+ const newKeySignature = sign(newKeypair.privateKey, message);
29
+ const proof = {
30
+ oldPublicKey: oldPublicKey.toString('base64'),
31
+ newPublicKey: newKeypair.publicKey.toString('base64'),
32
+ timestamp,
33
+ reason,
34
+ oldKeySignature: oldKeySignature.toString('base64'),
35
+ newKeySignature: newKeySignature.toString('base64'),
36
+ };
37
+ return { newKeypair, proof };
38
+ }
39
+ /**
40
+ * Verify a rotation proof: both signatures must be valid.
41
+ */
42
+ export function verifyRotationProof(proof) {
43
+ const oldPub = Buffer.from(proof.oldPublicKey, 'base64');
44
+ const newPub = Buffer.from(proof.newPublicKey, 'base64');
45
+ const message = buildRotationMessage(oldPub, newPub, proof.timestamp, proof.reason);
46
+ const oldSigValid = verify(oldPub, message, Buffer.from(proof.oldKeySignature, 'base64'));
47
+ const newSigValid = verify(newPub, message, Buffer.from(proof.newKeySignature, 'base64'));
48
+ return oldSigValid && newSigValid;
49
+ }
50
+ /**
51
+ * Check if a rotation is within the grace period.
52
+ *
53
+ * During grace: old key can verify old signatures but not create new grants.
54
+ * After grace: old key is permanently revoked.
55
+ */
56
+ export function isWithinGracePeriod(rotationTimestamp, now) {
57
+ const rotatedAt = new Date(rotationTimestamp).getTime();
58
+ const currentTime = (now ?? new Date()).getTime();
59
+ return currentTime - rotatedAt < KEY_ROTATION_GRACE_MS;
60
+ }
61
+ /**
62
+ * Compute the canonical ID for the new key after rotation.
63
+ */
64
+ export function computeRotatedCanonicalId(newPublicKey) {
65
+ const canonicalId = computeCanonicalId(newPublicKey);
66
+ return {
67
+ canonicalId,
68
+ displayFingerprint: computeDisplayFingerprint(canonicalId),
69
+ };
70
+ }
71
+ // ── Internal ─────────────────────────────────────────────────────────
72
+ function buildRotationMessage(oldPub, newPub, timestamp, reason) {
73
+ const hash = crypto.createHash('sha256');
74
+ hash.update(Buffer.from(ROTATION_PROOF_DOMAIN, 'utf-8'));
75
+ hash.update(oldPub);
76
+ hash.update(newPub);
77
+ hash.update(Buffer.from(timestamp, 'utf-8'));
78
+ hash.update(Buffer.from(reason, 'utf-8'));
79
+ return hash.digest();
80
+ }
81
+ //# sourceMappingURL=KeyRotation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"KeyRotation.js","sourceRoot":"","sources":["../../src/identity/KeyRotation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,MAAM,MAAM,aAAa,CAAC;AACjC,OAAO,EAAE,uBAAuB,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,mCAAmC,CAAC;AAC1F,OAAO,EAAE,kBAAkB,EAAE,yBAAyB,EAAE,qBAAqB,EAAsB,MAAM,YAAY,CAAC;AAEtH,wEAAwE;AAExE,MAAM,qBAAqB,GAAG,wBAAwB,CAAC;AAEvD,wEAAwE;AAExE;;;;;GAKG;AACH,MAAM,UAAU,cAAc,CAC5B,aAAqB,EACrB,YAAoB,EACpB,MAAc;IAEd,MAAM,UAAU,GAAG,uBAAuB,EAAE,CAAC;IAC7C,MAAM,SAAS,GAAG,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IAE3C,MAAM,OAAO,GAAG,oBAAoB,CAAC,YAAY,EAAE,UAAU,CAAC,SAAS,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC;IAE5F,MAAM,eAAe,GAAG,IAAI,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;IACrD,MAAM,eAAe,GAAG,IAAI,CAAC,UAAU,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;IAE7D,MAAM,KAAK,GAAkB;QAC3B,YAAY,EAAE,YAAY,CAAC,QAAQ,CAAC,QAAQ,CAAC;QAC7C,YAAY,EAAE,UAAU,CAAC,SAAS,CAAC,QAAQ,CAAC,QAAQ,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oB;IAI5D,MAAM,WAAW,GAAG,kBAAkB,CAAC,YAAY,CAAC,CAAC;IACrD,OAAO;QACL,WAAW;QACX,kBAAkB,EAAE,yBAAyB,CAAC,WAAW,CAAC;KAC3D,CAAC;AACJ,CAAC;AAED,wEAAwE;AAExE,SAAS,oBAAoB,CAC3B,MAAc,EACd,MAAc,EACd,SAAiB,EACjB,MAAc;IAEd,MAAM,IAAI,GAAG,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;IACzC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,qBAAqB,EAAE,OAAO,CAAC,CAAC,CAAC;IACzD,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IACpB,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IACpB,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC,CAAC;IAC7C,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IAC1C,OAAO,IAAI,CAAC,MAAM,EAAE,CAAC;AACvB,CAAC"}
@@ -0,0 +1,50 @@
1
+ /**
2
+ * Migration — Bridge legacy Threadline identity to canonical identity.
3
+ *
4
+ * Legacy: {stateDir}/threadline/identity.json (unencrypted, fingerprint-based)
5
+ * Canonical: {stateDir}/identity.json (encrypted, canonical ID + display fingerprint)
6
+ *
7
+ * Migration preserves the same Ed25519 keypair — only the storage location
8
+ * and metadata format change. The agent's identity (public key) doesn't change.
9
+ */
10
+ import { type CanonicalIdentity } from './types.js';
11
+ export interface MigrationOptions {
12
+ /** Passphrase to encrypt the private key in the new format. Omit for dev mode. */
13
+ passphrase?: string;
14
+ /** Skip recovery phrase generation. */
15
+ skipRecovery?: boolean;
16
+ }
17
+ export interface MigrationResult {
18
+ identity: CanonicalIdentity;
19
+ /** The 24-word recovery phrase, if generated. Show to user once. */
20
+ recoveryPhrase?: string;
21
+ /** Path to the legacy file that was migrated from. */
22
+ legacyPath: string;
23
+ }
24
+ /**
25
+ * Check if a legacy Threadline identity exists.
26
+ */
27
+ export declare function hasLegacyIdentity(stateDir: string): boolean;
28
+ /**
29
+ * Check if a canonical identity already exists.
30
+ */
31
+ export declare function hasCanonicalIdentity(stateDir: string): boolean;
32
+ /**
33
+ * Migrate a legacy Threadline identity to the canonical format.
34
+ *
35
+ * Reads the legacy identity, creates the canonical identity.json with the
36
+ * same keypair, and optionally encrypts the private key. The legacy file
37
+ * is NOT deleted (preserved for rollback per spec Section 3.10).
38
+ *
39
+ * @returns The migrated identity and optional recovery phrase.
40
+ * @throws If no legacy identity exists or canonical already exists.
41
+ */
42
+ export declare function migrateFromLegacy(stateDir: string, options?: MigrationOptions): MigrationResult;
43
+ /**
44
+ * Get the legacy Threadline fingerprint for backward compatibility mapping.
45
+ *
46
+ * Returns the old-style fingerprint (first 16 bytes of public key, hex)
47
+ * so existing Threadline contacts can still find this agent during migration.
48
+ */
49
+ export declare function getLegacyFingerprint(stateDir: string): string | null;
50
+ //# sourceMappingURL=Migration.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Migration.d.ts","sourceRoot":"","sources":["../../src/identity/Migration.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAYH,OAAO,EAKL,KAAK,iBAAiB,EACvB,MAAM,YAAY,CAAC;AAapB,MAAM,WAAW,gBAAgB;IAC/B,kFAAkF;IAClF,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,uCAAuC;IACvC,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,iBAAiB,CAAC;IAC5B,oEAAoE;IACpE,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,sDAAsD;IACtD,UAAU,EAAE,MAAM,CAAC;CACpB;AAID;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAE3D;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAE9D;AAED;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,MAAM,EAChB,OAAO,GAAE,gBAAqB,GAC7B,eAAe,CA8EjB;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CASpE"}
@@ -0,0 +1,125 @@
1
+ /**
2
+ * Migration — Bridge legacy Threadline identity to canonical identity.
3
+ *
4
+ * Legacy: {stateDir}/threadline/identity.json (unencrypted, fingerprint-based)
5
+ * Canonical: {stateDir}/identity.json (encrypted, canonical ID + display fingerprint)
6
+ *
7
+ * Migration preserves the same Ed25519 keypair — only the storage location
8
+ * and metadata format change. The agent's identity (public key) doesn't change.
9
+ */
10
+ import fs from 'node:fs';
11
+ import path from 'node:path';
12
+ import { deriveX25519PublicKey } from '../threadline/client/MessageEncryptor.js';
13
+ import { encryptPrivateKey, generateSalt } from './KeyEncryption.js';
14
+ import { generateRecoveryPhrase, deriveRecoveryKeypair, createRecoveryCommitment, generateRecoverySalt, } from './RecoveryPhrase.js';
15
+ import { computeCanonicalId, computeDisplayFingerprint, IDENTITY_SCHEMA_VERSION, } from './types.js';
16
+ // ── Public API ───────────────────────────────────────────────────────
17
+ /**
18
+ * Check if a legacy Threadline identity exists.
19
+ */
20
+ export function hasLegacyIdentity(stateDir) {
21
+ return fs.existsSync(path.join(stateDir, 'threadline', 'identity.json'));
22
+ }
23
+ /**
24
+ * Check if a canonical identity already exists.
25
+ */
26
+ export function hasCanonicalIdentity(stateDir) {
27
+ return fs.existsSync(path.join(stateDir, 'identity.json'));
28
+ }
29
+ /**
30
+ * Migrate a legacy Threadline identity to the canonical format.
31
+ *
32
+ * Reads the legacy identity, creates the canonical identity.json with the
33
+ * same keypair, and optionally encrypts the private key. The legacy file
34
+ * is NOT deleted (preserved for rollback per spec Section 3.10).
35
+ *
36
+ * @returns The migrated identity and optional recovery phrase.
37
+ * @throws If no legacy identity exists or canonical already exists.
38
+ */
39
+ export function migrateFromLegacy(stateDir, options = {}) {
40
+ const legacyPath = path.join(stateDir, 'threadline', 'identity.json');
41
+ const canonicalPath = path.join(stateDir, 'identity.json');
42
+ if (!fs.existsSync(legacyPath)) {
43
+ throw new Error('No legacy identity found at ' + legacyPath);
44
+ }
45
+ if (fs.existsSync(canonicalPath)) {
46
+ throw new Error('Canonical identity already exists — migration not needed');
47
+ }
48
+ // Read legacy identity
49
+ const legacyRaw = JSON.parse(fs.readFileSync(legacyPath, 'utf-8'));
50
+ const publicKey = Buffer.from(legacyRaw.publicKey, 'base64');
51
+ const privateKey = Buffer.from(legacyRaw.privateKey, 'base64');
52
+ // Compute new canonical identifiers
53
+ const canonicalId = computeCanonicalId(publicKey);
54
+ const displayFingerprint = computeDisplayFingerprint(canonicalId);
55
+ // Recovery phrase
56
+ let recoveryPhrase;
57
+ let recoveryCommitment;
58
+ let recoverySalt;
59
+ if (!options.skipRecovery) {
60
+ recoveryPhrase = generateRecoveryPhrase();
61
+ const rSalt = generateRecoverySalt();
62
+ const recoveryKeypair = deriveRecoveryKeypair(recoveryPhrase, rSalt);
63
+ recoveryCommitment = createRecoveryCommitment(recoveryKeypair.publicKey, privateKey);
64
+ recoverySalt = rSalt.toString('base64');
65
+ }
66
+ // Encrypt private key
67
+ let privateKeyData;
68
+ let keySalt;
69
+ if (options.passphrase !== undefined) {
70
+ const salt = generateSalt();
71
+ privateKeyData = encryptPrivateKey(privateKey, options.passphrase, salt);
72
+ keySalt = salt.toString('base64');
73
+ }
74
+ else {
75
+ privateKeyData = legacyRaw.privateKey; // keep the same base64
76
+ }
77
+ // Build canonical identity file
78
+ const file = {
79
+ version: IDENTITY_SCHEMA_VERSION,
80
+ publicKey: legacyRaw.publicKey,
81
+ privateKey: privateKeyData,
82
+ privateKeyEncryption: options.passphrase !== undefined ? 'xchacha20-poly1305+argon2id' : 'none',
83
+ ...(keySalt && { keySalt }),
84
+ canonicalId,
85
+ displayFingerprint,
86
+ ...(recoveryCommitment && { recoveryCommitment }),
87
+ ...(recoverySalt && { recoverySalt }),
88
+ createdAt: legacyRaw.createdAt,
89
+ };
90
+ // Write canonical identity (legacy file preserved for rollback)
91
+ fs.mkdirSync(path.dirname(canonicalPath), { recursive: true });
92
+ const tmpPath = `${canonicalPath}.${process.pid}.tmp`;
93
+ fs.writeFileSync(tmpPath, JSON.stringify(file, null, 2), { mode: 0o600 });
94
+ fs.renameSync(tmpPath, canonicalPath);
95
+ const identity = {
96
+ version: IDENTITY_SCHEMA_VERSION,
97
+ publicKey,
98
+ privateKey,
99
+ x25519PublicKey: deriveX25519PublicKey(privateKey),
100
+ canonicalId,
101
+ displayFingerprint,
102
+ createdAt: legacyRaw.createdAt,
103
+ recoveryCommitment,
104
+ };
105
+ return { identity, recoveryPhrase, legacyPath };
106
+ }
107
+ /**
108
+ * Get the legacy Threadline fingerprint for backward compatibility mapping.
109
+ *
110
+ * Returns the old-style fingerprint (first 16 bytes of public key, hex)
111
+ * so existing Threadline contacts can still find this agent during migration.
112
+ */
113
+ export function getLegacyFingerprint(stateDir) {
114
+ const legacyPath = path.join(stateDir, 'threadline', 'identity.json');
115
+ try {
116
+ if (!fs.existsSync(legacyPath))
117
+ return null;
118
+ const raw = JSON.parse(fs.readFileSync(legacyPath, 'utf-8'));
119
+ return raw.fingerprint;
120
+ }
121
+ catch {
122
+ return null;
123
+ }
124
+ }
125
+ //# sourceMappingURL=Migration.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Migration.js","sourceRoot":"","sources":["../../src/identity/Migration.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,qBAAqB,EAAE,MAAM,0CAA0C,CAAC;AACjF,OAAO,EAAE,iBAAiB,EAAE,YAAY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QACH,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,UAAU,CAAC;YAAE,OAAO,IAAI,CAAC;QAC5C,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,UAAU,EAAE,OAAO,CAAC,CAAuB,CAAC;QACnF,OAAO,GAAG,CAAC,WAAW,CAAC;IACzB,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC"}
@@ -0,0 +1,43 @@
1
+ /**
2
+ * RecoveryPhrase — BIP-39 mnemonic generation and recovery keypair derivation.
3
+ *
4
+ * Spec Section 3.10:
5
+ * - Recovery keypair is independently CSPRNG-generated, NOT derived from primary key
6
+ * - Recovery phrase follows BIP-39 (24-word mnemonic, 256 bits of entropy)
7
+ * - Recovery keypair derivation: Argon2id(mnemonic, per_agent_salt, t=3, m=65536, p=4) → seed → Ed25519
8
+ * - Recovery commitment: recovery public key signed by primary key
9
+ */
10
+ /**
11
+ * Generate a new 24-word BIP-39 mnemonic (256 bits of entropy).
12
+ */
13
+ export declare function generateRecoveryPhrase(): string;
14
+ /**
15
+ * Validate a BIP-39 mnemonic phrase.
16
+ */
17
+ export declare function isValidRecoveryPhrase(phrase: string): boolean;
18
+ /**
19
+ * Derive an Ed25519 recovery keypair from a mnemonic and per-agent salt.
20
+ *
21
+ * Uses Argon2id for key stretching, then feeds the output as an Ed25519 seed.
22
+ */
23
+ export declare function deriveRecoveryKeypair(mnemonic: string, salt: Buffer): {
24
+ publicKey: Buffer;
25
+ privateKey: Buffer;
26
+ };
27
+ /**
28
+ * Create a recovery commitment: the recovery public key signed by the primary key.
29
+ *
30
+ * This is stored in identity.json and registered with MoltBridge at creation time.
31
+ * Later, during emergency revocation, the recovery key proves it matches the pre-committed key.
32
+ */
33
+ export declare function createRecoveryCommitment(recoveryPublicKey: Buffer, primaryPrivateKey: Buffer): string;
34
+ /**
35
+ * Verify a recovery commitment against a primary public key.
36
+ */
37
+ export declare function verifyRecoveryCommitment(recoveryPublicKey: Buffer, commitment: string, primaryPublicKey: Buffer): boolean;
38
+ /**
39
+ * Generate a new per-agent salt for recovery key derivation.
40
+ * This salt is stored in identity.json as recoverySalt.
41
+ */
42
+ export declare function generateRecoverySalt(): Buffer;
43
+ //# sourceMappingURL=RecoveryPhrase.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RecoveryPhrase.d.ts","sourceRoot":"","sources":["../../src/identity/RecoveryPhrase.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAqBH;;GAEG;AACH,wBAAgB,sBAAsB,IAAI,MAAM,CAE/C;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAE7D;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CACnC,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,GACX;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,CAsB3C;AAED;;;;;GAKG;AACH,wBAAgB,wBAAwB,CACtC,iBAAiB,EAAE,MAAM,EACzB,iBAAiB,EAAE,MAAM,GACxB,MAAM,CAOR;AAED;;GAEG;AACH,wBAAgB,wBAAwB,CACtC,iBAAiB,EAAE,MAAM,EACzB,UAAU,EAAE,MAAM,EAClB,gBAAgB,EAAE,MAAM,GACvB,OAAO,CAOT;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,IAAI,MAAM,CAE7C"}
@@ -0,0 +1,93 @@
1
+ /**
2
+ * RecoveryPhrase — BIP-39 mnemonic generation and recovery keypair derivation.
3
+ *
4
+ * Spec Section 3.10:
5
+ * - Recovery keypair is independently CSPRNG-generated, NOT derived from primary key
6
+ * - Recovery phrase follows BIP-39 (24-word mnemonic, 256 bits of entropy)
7
+ * - Recovery keypair derivation: Argon2id(mnemonic, per_agent_salt, t=3, m=65536, p=4) → seed → Ed25519
8
+ * - Recovery commitment: recovery public key signed by primary key
9
+ */
10
+ import crypto from 'node:crypto';
11
+ import { generateMnemonic, validateMnemonic } from '@scure/bip39';
12
+ import { wordlist } from '@scure/bip39/wordlists/english.js';
13
+ import { argon2id } from '@noble/hashes/argon2.js';
14
+ import { sign, verify } from '../threadline/ThreadlineCrypto.js';
15
+ // ── Constants ────────────────────────────────────────────────────────
16
+ const ARGON2_TIME_COST = 3;
17
+ const ARGON2_MEMORY_KB = 65536;
18
+ const ARGON2_PARALLELISM = 4;
19
+ const ED25519_SEED_LENGTH = 32;
20
+ // Ed25519 PKCS#8 and SPKI prefixes for key wrapping
21
+ const ED25519_PKCS8_PREFIX = Buffer.from('302e020100300506032b657004220420', 'hex');
22
+ const ED25519_SPKI_PREFIX = Buffer.from('302a300506032b6570032100', 'hex');
23
+ // ── Public API ───────────────────────────────────────────────────────
24
+ /**
25
+ * Generate a new 24-word BIP-39 mnemonic (256 bits of entropy).
26
+ */
27
+ export function generateRecoveryPhrase() {
28
+ return generateMnemonic(wordlist, 256);
29
+ }
30
+ /**
31
+ * Validate a BIP-39 mnemonic phrase.
32
+ */
33
+ export function isValidRecoveryPhrase(phrase) {
34
+ return validateMnemonic(phrase, wordlist);
35
+ }
36
+ /**
37
+ * Derive an Ed25519 recovery keypair from a mnemonic and per-agent salt.
38
+ *
39
+ * Uses Argon2id for key stretching, then feeds the output as an Ed25519 seed.
40
+ */
41
+ export function deriveRecoveryKeypair(mnemonic, salt) {
42
+ // Derive seed via Argon2id
43
+ const seed = argon2id(Buffer.from(mnemonic, 'utf-8'), salt, {
44
+ t: ARGON2_TIME_COST,
45
+ m: ARGON2_MEMORY_KB,
46
+ p: ARGON2_PARALLELISM,
47
+ dkLen: ED25519_SEED_LENGTH,
48
+ });
49
+ // Generate Ed25519 keypair from seed
50
+ const privateKeyObj = crypto.createPrivateKey({
51
+ key: Buffer.concat([ED25519_PKCS8_PREFIX, Buffer.from(seed)]),
52
+ format: 'der',
53
+ type: 'pkcs8',
54
+ });
55
+ const publicKeyObj = crypto.createPublicKey(privateKeyObj);
56
+ return {
57
+ publicKey: Buffer.from(publicKeyObj.export({ type: 'spki', format: 'der' }).subarray(-32)),
58
+ privateKey: Buffer.from(seed),
59
+ };
60
+ }
61
+ /**
62
+ * Create a recovery commitment: the recovery public key signed by the primary key.
63
+ *
64
+ * This is stored in identity.json and registered with MoltBridge at creation time.
65
+ * Later, during emergency revocation, the recovery key proves it matches the pre-committed key.
66
+ */
67
+ export function createRecoveryCommitment(recoveryPublicKey, primaryPrivateKey) {
68
+ const message = Buffer.concat([
69
+ Buffer.from('instar-recovery-commitment-v1', 'utf-8'),
70
+ recoveryPublicKey,
71
+ ]);
72
+ const signature = sign(primaryPrivateKey, message);
73
+ return signature.toString('base64');
74
+ }
75
+ /**
76
+ * Verify a recovery commitment against a primary public key.
77
+ */
78
+ export function verifyRecoveryCommitment(recoveryPublicKey, commitment, primaryPublicKey) {
79
+ const message = Buffer.concat([
80
+ Buffer.from('instar-recovery-commitment-v1', 'utf-8'),
81
+ recoveryPublicKey,
82
+ ]);
83
+ const signature = Buffer.from(commitment, 'base64');
84
+ return verify(primaryPublicKey, message, signature);
85
+ }
86
+ /**
87
+ * Generate a new per-agent salt for recovery key derivation.
88
+ * This salt is stored in identity.json as recoverySalt.
89
+ */
90
+ export function generateRecoverySalt() {
91
+ return crypto.randomBytes(32);
92
+ }
93
+ //# sourceMappingURL=RecoveryPhrase.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RecoveryPhrase.js","sourceRoot":"","sources":["../../src/identity/RecoveryPhrase.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,MAAM,MAAM,aAAa,CAAC;AACjC,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAqB,MAAM,cAAc,CAAC;AACrF,OAAO,EAAE,QAAQ,EAAE,MAAM,mCAAmC,CAAC;AAC7D,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE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AC,CAAC;IAE3D,OAAO;QACL,SAAS,EAAE,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC;QAC1F,UAAU,EAAE,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC;KAC9B,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,wBAAwB,CACtC,iBAAyB,EACzB,iBAAyB;IAEzB,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC;QAC5B,MAAM,CAAC,IAAI,CAAC,+BAA+B,EAAE,OAAO,CAAC;QACrD,iBAAiB;KAClB,CAAC,CAAC;IACH,MAAM,SAAS,GAAG,IAAI,CAAC,iBAAiB,EAAE,OAAO,CAAC,CAAC;IACnD,OAAO,SAAS,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;AACtC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,wBAAwB,CACtC,iBAAyB,EACzB,UAAkB,EAClB,gBAAwB;IAExB,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC;QAC5B,MAAM,CAAC,IAAI,CAAC,+BAA+B,EAAE,OAAO,CAAC;QACrD,iBAAiB;KAClB,CAAC,CAAC;IACH,MAAM,SAAS,GAAG,MAAM,CAAC,IAAI,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;IACpD,OAAO,MAAM,CAAC,gBAAgB,EAAE,OAAO,EAAE,SAAS,CAAC,CAAC;AACtD,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,oBAAoB;IAClC,OAAO,MAAM,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;AAChC,CAAC"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Identity module — Public API.
3
+ *
4
+ * Canonical agent identity management for Instar agents.
5
+ */
6
+ export { computeCanonicalId, computeDisplayFingerprint, CANONICAL_ID_DOMAIN, IDENTITY_SCHEMA_VERSION, DISPLAY_FINGERPRINT_BYTES, DEFAULT_GRANT_TTL_MS, TRUST_DECAY, KEY_ROTATION_GRACE_MS, RECOVERY_TIMELOCK_MS, MAX_RECOVERY_ATTEMPTS, MIGRATION_DEADLINE_MS, type CanonicalIdentity, type IdentityFile, type PrivateKeyEncryption, type RotationProof, type RevocationRequest, } from './types.js';
7
+ export { CanonicalIdentityManager, type CreateIdentityOptions, type CreateIdentityResult, type LoadIdentityOptions, } from './IdentityManager.js';
8
+ export { encryptPrivateKey, decryptPrivateKey, generateSalt, SALT_BYTES, } from './KeyEncryption.js';
9
+ export { generateRecoveryPhrase, isValidRecoveryPhrase, deriveRecoveryKeypair, createRecoveryCommitment, verifyRecoveryCommitment, generateRecoverySalt, } from './RecoveryPhrase.js';
10
+ export { createRotation, verifyRotationProof, isWithinGracePeriod, computeRotatedCanonicalId, } from './KeyRotation.js';
11
+ export { RevocationManager, type RevocationAuditEntry, type RevocationState, } from './KeyRevocation.js';
12
+ export { hasLegacyIdentity, hasCanonicalIdentity, migrateFromLegacy, getLegacyFingerprint, type MigrationOptions, type MigrationResult, } from './Migration.js';
13
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/identity/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EACL,kBAAkB,EAClB,yBAAyB,EACzB,mBAAmB,EACnB,uBAAuB,EACvB,yBAAyB,EACzB,oBAAoB,EACpB,WAAW,EACX,qBAAqB,EACrB,oBAAoB,EACpB,qBAAqB,EACrB,qBAAqB,EACrB,KAAK,iBAAiB,EACtB,KAAK,YAAY,EACjB,KAAK,oBAAoB,EACzB,KAAK,aAAa,EAClB,KAAK,iBAAiB,GACvB,MAAM,YAAY,CAAC;AAGpB,OAAO,EACL,wBAAwB,EACxB,KAAK,qBAAqB,EAC1B,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,GACzB,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,YAAY,EACZ,UAAU,GACX,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EACL,sBAAsB,EACtB,qBAAqB,EACrB,qBAAqB,EACrB,wBAAwB,EACxB,wBAAwB,EACxB,oBAAoB,GACrB,MAAM,qBAAqB,CAAC;AAG7B,OAAO,EACL,cAAc,EACd,mBAAmB,EACnB,mBAAmB,EACnB,yBAAyB,GAC1B,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EACL,iBAAiB,EACjB,KAAK,oBAAoB,EACzB,KAAK,eAAe,GACrB,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EACL,iBAAiB,EACjB,oBAAoB,EACpB,iBAAiB,EACjB,oBAAoB,EACpB,KAAK,gBAAgB,EACrB,KAAK,eAAe,GACrB,MAAM,gBAAgB,CAAC"}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Identity module — Public API.
3
+ *
4
+ * Canonical agent identity management for Instar agents.
5
+ */
6
+ // Types and constants
7
+ export { computeCanonicalId, computeDisplayFingerprint, CANONICAL_ID_DOMAIN, IDENTITY_SCHEMA_VERSION, DISPLAY_FINGERPRINT_BYTES, DEFAULT_GRANT_TTL_MS, TRUST_DECAY, KEY_ROTATION_GRACE_MS, RECOVERY_TIMELOCK_MS, MAX_RECOVERY_ATTEMPTS, MIGRATION_DEADLINE_MS, } from './types.js';
8
+ // Identity manager
9
+ export { CanonicalIdentityManager, } from './IdentityManager.js';
10
+ // Key encryption
11
+ export { encryptPrivateKey, decryptPrivateKey, generateSalt, SALT_BYTES, } from './KeyEncryption.js';
12
+ // Recovery phrase
13
+ export { generateRecoveryPhrase, isValidRecoveryPhrase, deriveRecoveryKeypair, createRecoveryCommitment, verifyRecoveryCommitment, generateRecoverySalt, } from './RecoveryPhrase.js';
14
+ // Key rotation
15
+ export { createRotation, verifyRotationProof, isWithinGracePeriod, computeRotatedCanonicalId, } from './KeyRotation.js';
16
+ // Key revocation
17
+ export { RevocationManager, } from './KeyRevocation.js';
18
+ // Migration
19
+ export { hasLegacyIdentity, hasCanonicalIdentity, migrateFromLegacy, getLegacyFingerprint, } from './Migration.js';
20
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/identity/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,sBAAsB;AACtB,OAAO,EACL,kBAAkB,EAClB,yBAAyB,EACzB,mBAAmB,EACnB,uBAAuB,EACvB,yBAAyB,EACzB,oBAAoB,EACpB,WAAW,EACX,qBAAqB,EACrB,oBAAoB,EACpB,qBAAqB,EACrB,qBAAqB,GAMtB,MAAM,YAAY,CAAC;AAEpB,mBAAmB;AACnB,OAAO,EACL,wBAAwB,GAIzB,MAAM,sBAAsB,CAAC;AAE9B,iBAAiB;AACjB,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,YAAY,EACZ,UAAU,GACX,MAAM,oBAAoB,CAAC;AAE5B,kBAAkB;AAClB,OAAO,EACL,sBAAsB,EACtB,qBAAqB,EACrB,qBAAqB,EACrB,wBAAwB,EACxB,wBAAwB,EACxB,oBAAoB,GACrB,MAAM,qBAAqB,CAAC;AAE7B,eAAe;AACf,OAAO,EACL,cAAc,EACd,mBAAmB,EACnB,mBAAmB,EACnB,yBAAyB,GAC1B,MAAM,kBAAkB,CAAC;AAE1B,iBAAiB;AACjB,OAAO,EACL,iBAAiB,GAGlB,MAAM,oBAAoB,CAAC;AAE5B,YAAY;AACZ,OAAO,EACL,iBAAiB,EACjB,oBAAoB,EACpB,iBAAiB,EACjB,oBAAoB,GAGrB,MAAM,gBAAgB,CAAC"}
@@ -0,0 +1,101 @@
1
+ /**
2
+ * Identity types — Canonical agent identity schema.
3
+ *
4
+ * Implements the Unified Threadline spec (v0.6.0) Section 3.3:
5
+ * - Single Ed25519 keypair shared across all systems
6
+ * - Canonical Agent ID: SHA-256 with domain separation
7
+ * - Display fingerprint: first 8 bytes of canonical ID
8
+ */
9
+ /** Domain separation prefix for canonical agent ID derivation */
10
+ export declare const CANONICAL_ID_DOMAIN = "instar-agent-id-v1";
11
+ /** Schema version for identity.json */
12
+ export declare const IDENTITY_SCHEMA_VERSION = 1;
13
+ /** Display fingerprint length in bytes (8 bytes = 16 hex chars) */
14
+ export declare const DISPLAY_FINGERPRINT_BYTES = 8;
15
+ /** Default TTL for authorization grants (4 hours in ms) */
16
+ export declare const DEFAULT_GRANT_TTL_MS: number;
17
+ /** Trust decay periods (Section 3.7) */
18
+ export declare const TRUST_DECAY: {
19
+ readonly trustedToVerifiedDays: 90;
20
+ readonly verifiedToUntrustedDays: 180;
21
+ };
22
+ /** Key rotation grace period (72 hours in ms) */
23
+ export declare const KEY_ROTATION_GRACE_MS: number;
24
+ /** Recovery time-lock duration (24 hours in ms) */
25
+ export declare const RECOVERY_TIMELOCK_MS: number;
26
+ /** Max recovery attempts per 24h period */
27
+ export declare const MAX_RECOVERY_ATTEMPTS = 3;
28
+ /** Dual-key migration deadline (30 days in ms) */
29
+ export declare const MIGRATION_DEADLINE_MS: number;
30
+ /** Private key encryption methods */
31
+ export type PrivateKeyEncryption = 'xchacha20-poly1305+argon2id' | 'none';
32
+ /**
33
+ * On-disk identity file schema (identity.json).
34
+ * Private key is encrypted at rest unless in dev mode.
35
+ */
36
+ export interface IdentityFile {
37
+ version: typeof IDENTITY_SCHEMA_VERSION;
38
+ publicKey: string;
39
+ privateKey: string;
40
+ privateKeyEncryption: PrivateKeyEncryption;
41
+ keySalt?: string;
42
+ canonicalId: string;
43
+ displayFingerprint: string;
44
+ recoveryCommitment?: string;
45
+ recoverySalt?: string;
46
+ createdAt: string;
47
+ migrationComplete?: boolean;
48
+ migrationCompletedAt?: string;
49
+ }
50
+ /**
51
+ * In-memory identity with decrypted keys.
52
+ */
53
+ export interface CanonicalIdentity {
54
+ version: number;
55
+ publicKey: Buffer;
56
+ privateKey: Buffer;
57
+ x25519PublicKey: Buffer;
58
+ canonicalId: string;
59
+ displayFingerprint: string;
60
+ createdAt: string;
61
+ recoveryCommitment?: string;
62
+ migrationComplete?: boolean;
63
+ }
64
+ /**
65
+ * Key rotation proof — dual-signed by old and new keys.
66
+ */
67
+ export interface RotationProof {
68
+ oldPublicKey: string;
69
+ newPublicKey: string;
70
+ timestamp: string;
71
+ reason: string;
72
+ oldKeySignature: string;
73
+ newKeySignature: string;
74
+ }
75
+ /**
76
+ * Recovery revocation request.
77
+ */
78
+ export interface RevocationRequest {
79
+ targetCanonicalId: string;
80
+ newPublicKey: string;
81
+ recoverySignature: string;
82
+ timestamp: string;
83
+ status: 'pending' | 'active' | 'cancelled';
84
+ expiresAt: string;
85
+ }
86
+ /**
87
+ * Compute the canonical agent ID from an Ed25519 public key.
88
+ *
89
+ * canonicalId = SHA-256("instar-agent-id-v1" || publicKey)
90
+ *
91
+ * This is the stable identifier used across all systems.
92
+ */
93
+ export declare function computeCanonicalId(publicKey: Buffer): string;
94
+ /**
95
+ * Compute the display fingerprint from a canonical ID.
96
+ *
97
+ * First 8 bytes (16 hex chars) for human-readable display.
98
+ * Never used for security-critical operations.
99
+ */
100
+ export declare function computeDisplayFingerprint(canonicalId: string): string;
101
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/identity/types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAMH,iEAAiE;AACjE,eAAO,MAAM,mBAAmB,uBAAuB,CAAC;AAExD,uCAAuC;AACvC,eAAO,MAAM,uBAAuB,IAAI,CAAC;AAEzC,mEAAmE;AACnE,eAAO,MAAM,yBAAyB,IAAI,CAAC;AAE3C,2DAA2D;AAC3D,eAAO,MAAM,oBAAoB,QAAqB,CAAC;AAEvD,wCAAwC;AACxC,eAAO,MAAM,WAAW;;;CAGd,CAAC;AAEX,iDAAiD;AACjD,eAAO,MAAM,qBAAqB,QAAsB,CAAC;AAEzD,mDAAmD;AACnD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AAC;CACzB;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,iBAAiB,EAAE,MAAM,CAAC;IAC1B,YAAY,EAAE,MAAM,CAAC;IACrB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,SAAS,GAAG,QAAQ,GAAG,WAAW,CAAC;IAC3C,SAAS,EAAE,MAAM,CAAC;CACnB;AAID;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAK5D;AAED;;;;;GAKG;AACH,wBAAgB,yBAAyB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAErE"}
@@ -0,0 +1,55 @@
1
+ /**
2
+ * Identity types — Canonical agent identity schema.
3
+ *
4
+ * Implements the Unified Threadline spec (v0.6.0) Section 3.3:
5
+ * - Single Ed25519 keypair shared across all systems
6
+ * - Canonical Agent ID: SHA-256 with domain separation
7
+ * - Display fingerprint: first 8 bytes of canonical ID
8
+ */
9
+ import crypto from 'node:crypto';
10
+ // ── Constants ────────────────────────────────────────────────────────
11
+ /** Domain separation prefix for canonical agent ID derivation */
12
+ export const CANONICAL_ID_DOMAIN = 'instar-agent-id-v1';
13
+ /** Schema version for identity.json */
14
+ export const IDENTITY_SCHEMA_VERSION = 1;
15
+ /** Display fingerprint length in bytes (8 bytes = 16 hex chars) */
16
+ export const DISPLAY_FINGERPRINT_BYTES = 8;
17
+ /** Default TTL for authorization grants (4 hours in ms) */
18
+ export const DEFAULT_GRANT_TTL_MS = 4 * 60 * 60 * 1000;
19
+ /** Trust decay periods (Section 3.7) */
20
+ export const TRUST_DECAY = {
21
+ trustedToVerifiedDays: 90,
22
+ verifiedToUntrustedDays: 180,
23
+ };
24
+ /** Key rotation grace period (72 hours in ms) */
25
+ export const KEY_ROTATION_GRACE_MS = 72 * 60 * 60 * 1000;
26
+ /** Recovery time-lock duration (24 hours in ms) */
27
+ export const RECOVERY_TIMELOCK_MS = 24 * 60 * 60 * 1000;
28
+ /** Max recovery attempts per 24h period */
29
+ export const MAX_RECOVERY_ATTEMPTS = 3;
30
+ /** Dual-key migration deadline (30 days in ms) */
31
+ export const MIGRATION_DEADLINE_MS = 30 * 24 * 60 * 60 * 1000;
32
+ // ── Derivation Functions ─────────────────────────────────────────────
33
+ /**
34
+ * Compute the canonical agent ID from an Ed25519 public key.
35
+ *
36
+ * canonicalId = SHA-256("instar-agent-id-v1" || publicKey)
37
+ *
38
+ * This is the stable identifier used across all systems.
39
+ */
40
+ export function computeCanonicalId(publicKey) {
41
+ const hash = crypto.createHash('sha256');
42
+ hash.update(Buffer.from(CANONICAL_ID_DOMAIN, 'utf-8'));
43
+ hash.update(publicKey);
44
+ return hash.digest('hex');
45
+ }
46
+ /**
47
+ * Compute the display fingerprint from a canonical ID.
48
+ *
49
+ * First 8 bytes (16 hex chars) for human-readable display.
50
+ * Never used for security-critical operations.
51
+ */
52
+ export function computeDisplayFingerprint(canonicalId) {
53
+ return canonicalId.slice(0, DISPLAY_FINGERPRINT_BYTES * 2);
54
+ }
55
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/identity/types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,MAAM,MAAM,aAAa,CAAC;AAEjC,wEAAwE;AAExE,iEAAiE;AACjE,MAAM,CAAC,MAAM,mBAAmB,GAAG,oBAAoB,CAAC;AAExD,uCAAuC;AACvC,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC;AAEzC,mEAAmE;AACnE,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,CAAC;AAE3C,2DAA2D;AAC3D,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AAEvD,wCAAwC;AACxC,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,qBAAqB,EAAE,EAAE;IAC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