@de-otio/chaoskb-client 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/agent-registry/config-merger.d.ts +28 -0
- package/dist/cli/agent-registry/config-merger.d.ts.map +1 -0
- package/dist/cli/agent-registry/config-merger.js +90 -0
- package/dist/cli/agent-registry/config-merger.js.map +1 -0
- package/dist/cli/agent-registry/detector.d.ts +7 -0
- package/dist/cli/agent-registry/detector.d.ts.map +1 -0
- package/dist/cli/agent-registry/detector.js +100 -0
- package/dist/cli/agent-registry/detector.js.map +1 -0
- package/dist/cli/agent-registry/index.d.ts +26 -0
- package/dist/cli/agent-registry/index.d.ts.map +1 -0
- package/dist/cli/agent-registry/index.js +77 -0
- package/dist/cli/agent-registry/index.js.map +1 -0
- package/dist/cli/agent-registry/path-validator.d.ts +11 -0
- package/dist/cli/agent-registry/path-validator.d.ts.map +1 -0
- package/dist/cli/agent-registry/path-validator.js +69 -0
- package/dist/cli/agent-registry/path-validator.js.map +1 -0
- package/dist/cli/agent-registry/registry.json +108 -0
- package/dist/cli/agent-registry/types.d.ts +29 -0
- package/dist/cli/agent-registry/types.d.ts.map +1 -0
- package/dist/cli/agent-registry/types.js +2 -0
- package/dist/cli/agent-registry/types.js.map +1 -0
- package/dist/cli/bootstrap-lock.d.ts +7 -0
- package/dist/cli/bootstrap-lock.d.ts.map +1 -0
- package/dist/cli/bootstrap-lock.js +62 -0
- package/dist/cli/bootstrap-lock.js.map +1 -0
- package/dist/cli/bootstrap.d.ts +23 -0
- package/dist/cli/bootstrap.d.ts.map +1 -0
- package/dist/cli/bootstrap.js +438 -0
- package/dist/cli/bootstrap.js.map +1 -0
- package/dist/cli/commands/config.d.ts +13 -0
- package/dist/cli/commands/config.d.ts.map +1 -0
- package/dist/cli/commands/config.js +244 -0
- package/dist/cli/commands/config.js.map +1 -0
- package/dist/cli/commands/devices.d.ts +21 -0
- package/dist/cli/commands/devices.d.ts.map +1 -0
- package/dist/cli/commands/devices.js +229 -0
- package/dist/cli/commands/devices.js.map +1 -0
- package/dist/cli/commands/export.d.ts +12 -0
- package/dist/cli/commands/export.d.ts.map +1 -0
- package/dist/cli/commands/export.js +183 -0
- package/dist/cli/commands/export.js.map +1 -0
- package/dist/cli/commands/import.d.ts +26 -0
- package/dist/cli/commands/import.d.ts.map +1 -0
- package/dist/cli/commands/import.js +311 -0
- package/dist/cli/commands/import.js.map +1 -0
- package/dist/cli/commands/kb.d.ts +39 -0
- package/dist/cli/commands/kb.d.ts.map +1 -0
- package/dist/cli/commands/kb.js +138 -0
- package/dist/cli/commands/kb.js.map +1 -0
- package/dist/cli/commands/project.d.ts +6 -0
- package/dist/cli/commands/project.d.ts.map +1 -0
- package/dist/cli/commands/project.js +115 -0
- package/dist/cli/commands/project.js.map +1 -0
- package/dist/cli/commands/projects.d.ts +33 -0
- package/dist/cli/commands/projects.d.ts.map +1 -0
- package/dist/cli/commands/projects.js +189 -0
- package/dist/cli/commands/projects.js.map +1 -0
- package/dist/cli/commands/register.d.ts +8 -0
- package/dist/cli/commands/register.d.ts.map +1 -0
- package/dist/cli/commands/register.js +146 -0
- package/dist/cli/commands/register.js.map +1 -0
- package/dist/cli/commands/rotate-key.d.ts +16 -0
- package/dist/cli/commands/rotate-key.d.ts.map +1 -0
- package/dist/cli/commands/rotate-key.js +197 -0
- package/dist/cli/commands/rotate-key.js.map +1 -0
- package/dist/cli/commands/setup-sync.d.ts +2 -0
- package/dist/cli/commands/setup-sync.d.ts.map +1 -0
- package/dist/cli/commands/setup-sync.js +165 -0
- package/dist/cli/commands/setup-sync.js.map +1 -0
- package/dist/cli/commands/setup.d.ts +12 -0
- package/dist/cli/commands/setup.d.ts.map +1 -0
- package/dist/cli/commands/setup.js +39 -0
- package/dist/cli/commands/setup.js.map +1 -0
- package/dist/cli/commands/status.d.ts +5 -0
- package/dist/cli/commands/status.d.ts.map +1 -0
- package/dist/cli/commands/status.js +96 -0
- package/dist/cli/commands/status.js.map +1 -0
- package/dist/cli/commands/uninstall.d.ts +4 -0
- package/dist/cli/commands/uninstall.d.ts.map +1 -0
- package/dist/cli/commands/uninstall.js +85 -0
- package/dist/cli/commands/uninstall.js.map +1 -0
- package/dist/cli/commands/unregister.d.ts +2 -0
- package/dist/cli/commands/unregister.d.ts.map +1 -0
- package/dist/cli/commands/unregister.js +46 -0
- package/dist/cli/commands/unregister.js.map +1 -0
- package/dist/cli/device-metadata.d.ts +15 -0
- package/dist/cli/device-metadata.d.ts.map +1 -0
- package/dist/cli/device-metadata.js +58 -0
- package/dist/cli/device-metadata.js.map +1 -0
- package/dist/cli/github.d.ts +38 -0
- package/dist/cli/github.d.ts.map +1 -0
- package/dist/cli/github.js +159 -0
- package/dist/cli/github.js.map +1 -0
- package/dist/cli/guide-hashes.json +13 -0
- package/dist/cli/index.d.ts +3 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +226 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/mcp-server.d.ts +205 -0
- package/dist/cli/mcp-server.d.ts.map +1 -0
- package/dist/cli/mcp-server.js +366 -0
- package/dist/cli/mcp-server.js.map +1 -0
- package/dist/cli/tools/kb-delete.d.ts +10 -0
- package/dist/cli/tools/kb-delete.d.ts.map +1 -0
- package/dist/cli/tools/kb-delete.js +28 -0
- package/dist/cli/tools/kb-delete.js.map +1 -0
- package/dist/cli/tools/kb-ingest.d.ts +13 -0
- package/dist/cli/tools/kb-ingest.d.ts.map +1 -0
- package/dist/cli/tools/kb-ingest.js +72 -0
- package/dist/cli/tools/kb-ingest.js.map +1 -0
- package/dist/cli/tools/kb-list.d.ts +20 -0
- package/dist/cli/tools/kb-list.d.ts.map +1 -0
- package/dist/cli/tools/kb-list.js +24 -0
- package/dist/cli/tools/kb-list.js.map +1 -0
- package/dist/cli/tools/kb-query-shared.d.ts +27 -0
- package/dist/cli/tools/kb-query-shared.d.ts.map +1 -0
- package/dist/cli/tools/kb-query-shared.js +28 -0
- package/dist/cli/tools/kb-query-shared.js.map +1 -0
- package/dist/cli/tools/kb-query.d.ts +20 -0
- package/dist/cli/tools/kb-query.d.ts.map +1 -0
- package/dist/cli/tools/kb-query.js +109 -0
- package/dist/cli/tools/kb-query.js.map +1 -0
- package/dist/cli/tools/kb-summary.d.ts +29 -0
- package/dist/cli/tools/kb-summary.d.ts.map +1 -0
- package/dist/cli/tools/kb-summary.js +89 -0
- package/dist/cli/tools/kb-summary.js.map +1 -0
- package/dist/cli/tools/kb-sync-status.d.ts +7 -0
- package/dist/cli/tools/kb-sync-status.d.ts.map +1 -0
- package/dist/cli/tools/kb-sync-status.js +48 -0
- package/dist/cli/tools/kb-sync-status.js.map +1 -0
- package/dist/crypto/aad.d.ts +8 -0
- package/dist/crypto/aad.d.ts.map +1 -0
- package/dist/crypto/aad.js +11 -0
- package/dist/crypto/aad.js.map +1 -0
- package/dist/crypto/aead.d.ts +21 -0
- package/dist/crypto/aead.d.ts.map +1 -0
- package/dist/crypto/aead.js +43 -0
- package/dist/crypto/aead.js.map +1 -0
- package/dist/crypto/argon2.d.ts +11 -0
- package/dist/crypto/argon2.d.ts.map +1 -0
- package/dist/crypto/argon2.js +33 -0
- package/dist/crypto/argon2.js.map +1 -0
- package/dist/crypto/blob-id.d.ts +6 -0
- package/dist/crypto/blob-id.d.ts.map +1 -0
- package/dist/crypto/blob-id.js +33 -0
- package/dist/crypto/blob-id.js.map +1 -0
- package/dist/crypto/canonical-json.d.ts +6 -0
- package/dist/crypto/canonical-json.d.ts.map +1 -0
- package/dist/crypto/canonical-json.js +88 -0
- package/dist/crypto/canonical-json.js.map +1 -0
- package/dist/crypto/commitment.d.ts +12 -0
- package/dist/crypto/commitment.d.ts.map +1 -0
- package/dist/crypto/commitment.js +37 -0
- package/dist/crypto/commitment.js.map +1 -0
- package/dist/crypto/encryption-service.d.ts +19 -0
- package/dist/crypto/encryption-service.d.ts.map +1 -0
- package/dist/crypto/encryption-service.js +38 -0
- package/dist/crypto/encryption-service.js.map +1 -0
- package/dist/crypto/envelope-cbor.d.ts +37 -0
- package/dist/crypto/envelope-cbor.d.ts.map +1 -0
- package/dist/crypto/envelope-cbor.js +124 -0
- package/dist/crypto/envelope-cbor.js.map +1 -0
- package/dist/crypto/envelope.d.ts +34 -0
- package/dist/crypto/envelope.d.ts.map +1 -0
- package/dist/crypto/envelope.js +160 -0
- package/dist/crypto/envelope.js.map +1 -0
- package/dist/crypto/hkdf.d.ts +16 -0
- package/dist/crypto/hkdf.d.ts.map +1 -0
- package/dist/crypto/hkdf.js +33 -0
- package/dist/crypto/hkdf.js.map +1 -0
- package/dist/crypto/index.d.ts +15 -0
- package/dist/crypto/index.d.ts.map +1 -0
- package/dist/crypto/index.js +15 -0
- package/dist/crypto/index.js.map +1 -0
- package/dist/crypto/invite.d.ts +31 -0
- package/dist/crypto/invite.d.ts.map +1 -0
- package/dist/crypto/invite.js +137 -0
- package/dist/crypto/invite.js.map +1 -0
- package/dist/crypto/keyring.d.ts +37 -0
- package/dist/crypto/keyring.d.ts.map +1 -0
- package/dist/crypto/keyring.js +219 -0
- package/dist/crypto/keyring.js.map +1 -0
- package/dist/crypto/known-keys.d.ts +34 -0
- package/dist/crypto/known-keys.d.ts.map +1 -0
- package/dist/crypto/known-keys.js +106 -0
- package/dist/crypto/known-keys.js.map +1 -0
- package/dist/crypto/project-keys.d.ts +26 -0
- package/dist/crypto/project-keys.d.ts.map +1 -0
- package/dist/crypto/project-keys.js +69 -0
- package/dist/crypto/project-keys.js.map +1 -0
- package/dist/crypto/secure-buffer.d.ts +31 -0
- package/dist/crypto/secure-buffer.d.ts.map +1 -0
- package/dist/crypto/secure-buffer.js +61 -0
- package/dist/crypto/secure-buffer.js.map +1 -0
- package/dist/crypto/ssh-agent.d.ts +16 -0
- package/dist/crypto/ssh-agent.d.ts.map +1 -0
- package/dist/crypto/ssh-agent.js +225 -0
- package/dist/crypto/ssh-agent.js.map +1 -0
- package/dist/crypto/ssh-keys.d.ts +19 -0
- package/dist/crypto/ssh-keys.d.ts.map +1 -0
- package/dist/crypto/ssh-keys.js +121 -0
- package/dist/crypto/ssh-keys.js.map +1 -0
- package/dist/crypto/tiers/enhanced.d.ts +25 -0
- package/dist/crypto/tiers/enhanced.d.ts.map +1 -0
- package/dist/crypto/tiers/enhanced.js +56 -0
- package/dist/crypto/tiers/enhanced.js.map +1 -0
- package/dist/crypto/tiers/maximum.d.ts +19 -0
- package/dist/crypto/tiers/maximum.d.ts.map +1 -0
- package/dist/crypto/tiers/maximum.js +25 -0
- package/dist/crypto/tiers/maximum.js.map +1 -0
- package/dist/crypto/tiers/standard.d.ts +27 -0
- package/dist/crypto/tiers/standard.d.ts.map +1 -0
- package/dist/crypto/tiers/standard.js +147 -0
- package/dist/crypto/tiers/standard.js.map +1 -0
- package/dist/crypto/types.d.ts +169 -0
- package/dist/crypto/types.d.ts.map +1 -0
- package/dist/crypto/types.js +11 -0
- package/dist/crypto/types.js.map +1 -0
- package/dist/pipeline/chunker.d.ts +27 -0
- package/dist/pipeline/chunker.d.ts.map +1 -0
- package/dist/pipeline/chunker.js +96 -0
- package/dist/pipeline/chunker.js.map +1 -0
- package/dist/pipeline/content-pipeline.d.ts +24 -0
- package/dist/pipeline/content-pipeline.d.ts.map +1 -0
- package/dist/pipeline/content-pipeline.js +49 -0
- package/dist/pipeline/content-pipeline.js.map +1 -0
- package/dist/pipeline/embedder.d.ts +49 -0
- package/dist/pipeline/embedder.d.ts.map +1 -0
- package/dist/pipeline/embedder.js +195 -0
- package/dist/pipeline/embedder.js.map +1 -0
- package/dist/pipeline/extract.d.ts +17 -0
- package/dist/pipeline/extract.d.ts.map +1 -0
- package/dist/pipeline/extract.js +70 -0
- package/dist/pipeline/extract.js.map +1 -0
- package/dist/pipeline/fetch.d.ts +26 -0
- package/dist/pipeline/fetch.d.ts.map +1 -0
- package/dist/pipeline/fetch.js +91 -0
- package/dist/pipeline/fetch.js.map +1 -0
- package/dist/pipeline/index.d.ts +10 -0
- package/dist/pipeline/index.d.ts.map +1 -0
- package/dist/pipeline/index.js +10 -0
- package/dist/pipeline/index.js.map +1 -0
- package/dist/pipeline/model-manager.d.ts +57 -0
- package/dist/pipeline/model-manager.d.ts.map +1 -0
- package/dist/pipeline/model-manager.js +234 -0
- package/dist/pipeline/model-manager.js.map +1 -0
- package/dist/pipeline/search.d.ts +37 -0
- package/dist/pipeline/search.d.ts.map +1 -0
- package/dist/pipeline/search.js +65 -0
- package/dist/pipeline/search.js.map +1 -0
- package/dist/pipeline/tokenizer.d.ts +29 -0
- package/dist/pipeline/tokenizer.d.ts.map +1 -0
- package/dist/pipeline/tokenizer.js +54 -0
- package/dist/pipeline/tokenizer.js.map +1 -0
- package/dist/pipeline/types.d.ts +86 -0
- package/dist/pipeline/types.d.ts.map +1 -0
- package/dist/pipeline/types.js +2 -0
- package/dist/pipeline/types.js.map +1 -0
- package/dist/pipeline/wordpiece-tokenizer.d.ts +60 -0
- package/dist/pipeline/wordpiece-tokenizer.d.ts.map +1 -0
- package/dist/pipeline/wordpiece-tokenizer.js +251 -0
- package/dist/pipeline/wordpiece-tokenizer.js.map +1 -0
- package/dist/storage/chunk-repo.d.ts +29 -0
- package/dist/storage/chunk-repo.d.ts.map +1 -0
- package/dist/storage/chunk-repo.js +115 -0
- package/dist/storage/chunk-repo.js.map +1 -0
- package/dist/storage/database-manager.d.ts +17 -0
- package/dist/storage/database-manager.d.ts.map +1 -0
- package/dist/storage/database-manager.js +100 -0
- package/dist/storage/database-manager.js.map +1 -0
- package/dist/storage/database.d.ts +10 -0
- package/dist/storage/database.d.ts.map +1 -0
- package/dist/storage/database.js +34 -0
- package/dist/storage/database.js.map +1 -0
- package/dist/storage/embedding-index.d.ts +22 -0
- package/dist/storage/embedding-index.d.ts.map +1 -0
- package/dist/storage/embedding-index.js +78 -0
- package/dist/storage/embedding-index.js.map +1 -0
- package/dist/storage/index.d.ts +10 -0
- package/dist/storage/index.d.ts.map +1 -0
- package/dist/storage/index.js +10 -0
- package/dist/storage/index.js.map +1 -0
- package/dist/storage/kb-database.d.ts +11 -0
- package/dist/storage/kb-database.d.ts.map +1 -0
- package/dist/storage/kb-database.js +24 -0
- package/dist/storage/kb-database.js.map +1 -0
- package/dist/storage/schema.d.ts +6 -0
- package/dist/storage/schema.d.ts.map +1 -0
- package/dist/storage/schema.js +122 -0
- package/dist/storage/schema.js.map +1 -0
- package/dist/storage/source-repo.d.ts +20 -0
- package/dist/storage/source-repo.d.ts.map +1 -0
- package/dist/storage/source-repo.js +120 -0
- package/dist/storage/source-repo.js.map +1 -0
- package/dist/storage/sync-status-repo.d.ts +15 -0
- package/dist/storage/sync-status-repo.d.ts.map +1 -0
- package/dist/storage/sync-status-repo.js +40 -0
- package/dist/storage/sync-status-repo.js.map +1 -0
- package/dist/storage/types.d.ts +139 -0
- package/dist/storage/types.d.ts.map +1 -0
- package/dist/storage/types.js +9 -0
- package/dist/storage/types.js.map +1 -0
- package/dist/sync/canary.d.ts +14 -0
- package/dist/sync/canary.d.ts.map +1 -0
- package/dist/sync/canary.js +53 -0
- package/dist/sync/canary.js.map +1 -0
- package/dist/sync/full-sync.d.ts +16 -0
- package/dist/sync/full-sync.d.ts.map +1 -0
- package/dist/sync/full-sync.js +91 -0
- package/dist/sync/full-sync.js.map +1 -0
- package/dist/sync/http-client.d.ts +28 -0
- package/dist/sync/http-client.d.ts.map +1 -0
- package/dist/sync/http-client.js +90 -0
- package/dist/sync/http-client.js.map +1 -0
- package/dist/sync/incremental-sync.d.ts +17 -0
- package/dist/sync/incremental-sync.d.ts.map +1 -0
- package/dist/sync/incremental-sync.js +155 -0
- package/dist/sync/incremental-sync.js.map +1 -0
- package/dist/sync/index.d.ts +12 -0
- package/dist/sync/index.d.ts.map +1 -0
- package/dist/sync/index.js +12 -0
- package/dist/sync/index.js.map +1 -0
- package/dist/sync/quota.d.ts +17 -0
- package/dist/sync/quota.d.ts.map +1 -0
- package/dist/sync/quota.js +48 -0
- package/dist/sync/quota.js.map +1 -0
- package/dist/sync/sequence.d.ts +21 -0
- package/dist/sync/sequence.d.ts.map +1 -0
- package/dist/sync/sequence.js +49 -0
- package/dist/sync/sequence.js.map +1 -0
- package/dist/sync/ssh-signer.d.ts +59 -0
- package/dist/sync/ssh-signer.d.ts.map +1 -0
- package/dist/sync/ssh-signer.js +241 -0
- package/dist/sync/ssh-signer.js.map +1 -0
- package/dist/sync/sync-service.d.ts +48 -0
- package/dist/sync/sync-service.d.ts.map +1 -0
- package/dist/sync/sync-service.js +116 -0
- package/dist/sync/sync-service.js.map +1 -0
- package/dist/sync/types.d.ts +106 -0
- package/dist/sync/types.d.ts.map +1 -0
- package/dist/sync/types.js +2 -0
- package/dist/sync/types.js.map +1 -0
- package/dist/sync/upload-queue.d.ts +40 -0
- package/dist/sync/upload-queue.d.ts.map +1 -0
- package/dist/sync/upload-queue.js +148 -0
- package/dist/sync/upload-queue.js.map +1 -0
- package/dist/sync/verification.d.ts +17 -0
- package/dist/sync/verification.d.ts.map +1 -0
- package/dist/sync/verification.js +25 -0
- package/dist/sync/verification.js.map +1 -0
- package/dist/vitest.config.d.ts +3 -0
- package/dist/vitest.config.d.ts.map +1 -0
- package/dist/vitest.config.js +16 -0
- package/dist/vitest.config.js.map +1 -0
- package/package.json +68 -0
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { createHash } from 'node:crypto';
|
|
2
|
+
import sodium from 'sodium-native';
|
|
3
|
+
/**
|
|
4
|
+
* Parse an OpenSSH public key from authorized_keys / .pub file format.
|
|
5
|
+
* Supports ssh-ed25519 and ssh-rsa key types.
|
|
6
|
+
*
|
|
7
|
+
* Format: <key-type> <base64-blob> [comment]
|
|
8
|
+
*/
|
|
9
|
+
export function parseSSHPublicKey(keyString) {
|
|
10
|
+
const trimmed = keyString.trim();
|
|
11
|
+
const parts = trimmed.split(/\s+/);
|
|
12
|
+
if (parts.length < 2) {
|
|
13
|
+
throw new Error('Invalid SSH public key format: expected "<type> <base64> [comment]"');
|
|
14
|
+
}
|
|
15
|
+
const typeStr = parts[0];
|
|
16
|
+
const base64Blob = parts[1];
|
|
17
|
+
const comment = parts.length > 2 ? parts.slice(2).join(' ') : undefined;
|
|
18
|
+
let type;
|
|
19
|
+
if (typeStr === 'ssh-ed25519') {
|
|
20
|
+
type = 'ed25519';
|
|
21
|
+
}
|
|
22
|
+
else if (typeStr === 'ssh-rsa') {
|
|
23
|
+
type = 'rsa';
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
throw new Error(`Unsupported SSH key type: ${typeStr}`);
|
|
27
|
+
}
|
|
28
|
+
// Base64-decode the key blob
|
|
29
|
+
const blob = Buffer.from(base64Blob, 'base64');
|
|
30
|
+
// Parse the SSH wire format: length-prefixed strings
|
|
31
|
+
const publicKeyBytes = extractPublicKeyFromBlob(blob, type);
|
|
32
|
+
// Compute SHA-256 fingerprint
|
|
33
|
+
const hash = createHash('sha256').update(blob).digest();
|
|
34
|
+
const fingerprint = 'SHA256:' + hash.toString('base64').replace(/=+$/, '');
|
|
35
|
+
return {
|
|
36
|
+
type,
|
|
37
|
+
publicKeyBytes,
|
|
38
|
+
fingerprint,
|
|
39
|
+
...(comment !== undefined && { comment }),
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Parse the SSH wire format blob and extract the raw public key bytes.
|
|
44
|
+
*
|
|
45
|
+
* SSH wire format: repeated [4-byte big-endian length][data]
|
|
46
|
+
* - For ed25519: [type string][32-byte public key]
|
|
47
|
+
* - For RSA: [type string][exponent][modulus]
|
|
48
|
+
*/
|
|
49
|
+
function extractPublicKeyFromBlob(blob, type) {
|
|
50
|
+
let offset = 0;
|
|
51
|
+
function readString() {
|
|
52
|
+
if (offset + 4 > blob.length) {
|
|
53
|
+
throw new Error('SSH key blob: unexpected end of data reading length');
|
|
54
|
+
}
|
|
55
|
+
const len = blob.readUInt32BE(offset);
|
|
56
|
+
offset += 4;
|
|
57
|
+
if (offset + len > blob.length) {
|
|
58
|
+
throw new Error('SSH key blob: unexpected end of data reading string');
|
|
59
|
+
}
|
|
60
|
+
const data = blob.subarray(offset, offset + len);
|
|
61
|
+
offset += len;
|
|
62
|
+
return data;
|
|
63
|
+
}
|
|
64
|
+
// First field: key type string
|
|
65
|
+
const typeField = readString().toString('ascii');
|
|
66
|
+
if (type === 'ed25519') {
|
|
67
|
+
if (typeField !== 'ssh-ed25519') {
|
|
68
|
+
throw new Error(`SSH key type mismatch: expected ssh-ed25519, got ${typeField}`);
|
|
69
|
+
}
|
|
70
|
+
// Second field: 32-byte public key
|
|
71
|
+
const pubkey = readString();
|
|
72
|
+
if (pubkey.length !== 32) {
|
|
73
|
+
throw new Error(`Ed25519 public key must be 32 bytes, got ${pubkey.length}`);
|
|
74
|
+
}
|
|
75
|
+
return new Uint8Array(pubkey);
|
|
76
|
+
}
|
|
77
|
+
else if (type === 'rsa') {
|
|
78
|
+
if (typeField !== 'ssh-rsa') {
|
|
79
|
+
throw new Error(`SSH key type mismatch: expected ssh-rsa, got ${typeField}`);
|
|
80
|
+
}
|
|
81
|
+
// RSA blob: [exponent][modulus]
|
|
82
|
+
// For RSA we return the full blob (exponent + modulus) since RSA operations
|
|
83
|
+
// need the full public key structure. The raw blob minus type prefix.
|
|
84
|
+
const exponent = readString();
|
|
85
|
+
const modulus = readString();
|
|
86
|
+
// Build a buffer with the exponent and modulus in SSH wire format
|
|
87
|
+
// This is what Node.js crypto needs for RSA operations
|
|
88
|
+
const result = Buffer.alloc(4 + exponent.length + 4 + modulus.length);
|
|
89
|
+
let pos = 0;
|
|
90
|
+
result.writeUInt32BE(exponent.length, pos);
|
|
91
|
+
pos += 4;
|
|
92
|
+
exponent.copy(result, pos);
|
|
93
|
+
pos += exponent.length;
|
|
94
|
+
result.writeUInt32BE(modulus.length, pos);
|
|
95
|
+
pos += 4;
|
|
96
|
+
modulus.copy(result, pos);
|
|
97
|
+
return new Uint8Array(result);
|
|
98
|
+
}
|
|
99
|
+
throw new Error(`Unsupported key type: ${type}`);
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Convert an Ed25519 public key to X25519 (Curve25519) public key.
|
|
103
|
+
* Uses sodium crypto_sign_ed25519_pk_to_curve25519.
|
|
104
|
+
*/
|
|
105
|
+
export function ed25519ToX25519PublicKey(ed25519PublicKey) {
|
|
106
|
+
const x25519PublicKey = Buffer.alloc(sodium.crypto_box_PUBLICKEYBYTES);
|
|
107
|
+
const ed25519Buffer = Buffer.from(ed25519PublicKey);
|
|
108
|
+
sodium.crypto_sign_ed25519_pk_to_curve25519(x25519PublicKey, ed25519Buffer);
|
|
109
|
+
return new Uint8Array(x25519PublicKey);
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Convert an Ed25519 secret key to X25519 (Curve25519) secret key.
|
|
113
|
+
* Uses sodium crypto_sign_ed25519_sk_to_curve25519.
|
|
114
|
+
*/
|
|
115
|
+
export function ed25519ToX25519SecretKey(ed25519SecretKey) {
|
|
116
|
+
const x25519SecretKey = Buffer.alloc(sodium.crypto_box_SECRETKEYBYTES);
|
|
117
|
+
const ed25519Buffer = Buffer.from(ed25519SecretKey);
|
|
118
|
+
sodium.crypto_sign_ed25519_sk_to_curve25519(x25519SecretKey, ed25519Buffer);
|
|
119
|
+
return new Uint8Array(x25519SecretKey);
|
|
120
|
+
}
|
|
121
|
+
//# sourceMappingURL=ssh-keys.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ssh-keys.js","sourceRoot":"","sources":["../../crypto/ssh-keys.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,MAAM,MAAM,eAAe,CAAC;AAInC;;;;;GAKG;AACH,MAAM,UAAU,iBAAiB,CAAC,SAAiB;IACjD,MAAM,OAAO,GAAG,SAAS,CAAC,IAAI,EAAE,CAAC;IACjC,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAEnC,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CA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eAAe,GAAG,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,yBAAyB,CAAC,CAAC;IACvE,MAAM,aAAa,GAAG,MAAM,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;IACpD,MAAM,CAAC,oCAAoC,CAAC,eAAe,EAAE,aAAa,CAAC,CAAC;IAC5E,OAAO,IAAI,UAAU,CAAC,eAAe,CAAC,CAAC;AACzC,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { ISecureBuffer } from '../types.js';
|
|
2
|
+
export { wrapMasterKey, unwrapMasterKeyEd25519, unwrapMasterKeyRSA } from './standard.js';
|
|
3
|
+
/**
|
|
4
|
+
* @deprecated Enhanced tier is deprecated. New installations use Standard or Maximum only.
|
|
5
|
+
*
|
|
6
|
+
* Enhanced tier: BIP39 24-word recovery key.
|
|
7
|
+
*
|
|
8
|
+
* The master key is a 256-bit random value which maps directly to a 24-word
|
|
9
|
+
* BIP39 mnemonic. Either the mnemonic or the SSH-wrapped key can recover.
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* @deprecated Use Standard tier (SSH key wrapping) instead.
|
|
13
|
+
*
|
|
14
|
+
* Encode a 256-bit master key as a 24-word BIP39 mnemonic.
|
|
15
|
+
* The master key bytes are used directly as the entropy.
|
|
16
|
+
*/
|
|
17
|
+
export declare function generateRecoveryKey(masterKey: ISecureBuffer): string;
|
|
18
|
+
/**
|
|
19
|
+
* @deprecated Use Standard tier (SSH key wrapping) instead.
|
|
20
|
+
*
|
|
21
|
+
* Decode a 24-word BIP39 mnemonic back to the 256-bit master key.
|
|
22
|
+
* Returns a SecureBuffer containing the recovered key.
|
|
23
|
+
*/
|
|
24
|
+
export declare function recoverFromMnemonic(mnemonic: string): ISecureBuffer;
|
|
25
|
+
//# sourceMappingURL=enhanced.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"enhanced.d.ts","sourceRoot":"","sources":["../../../crypto/tiers/enhanced.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAGjD,OAAO,EAAE,aAAa,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAE1F;;;;;;;GAOG;AAEH;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,aAAa,GAAG,MAAM,CAQpE;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,GAAG,aAAa,CAoBnE"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
// Enhanced tier removed — see doc/analysis/zero-config-sync/security-tiers.md
|
|
2
|
+
// This file is deprecated. The zero-config sync implementation uses only two tiers:
|
|
3
|
+
// - Standard: SSH key wrapping (automatic, zero-config)
|
|
4
|
+
// - Maximum: Argon2id passphrase derivation
|
|
5
|
+
// The Enhanced (BIP39 mnemonic) tier added complexity without meaningful security
|
|
6
|
+
// benefit over the Standard tier's SSH-based recovery. Retained for backward
|
|
7
|
+
// compatibility with existing Enhanced-tier users.
|
|
8
|
+
import * as bip39 from 'bip39';
|
|
9
|
+
import { SecureBuffer } from '../secure-buffer.js';
|
|
10
|
+
// Re-export standard tier wrapping for dual-path recovery
|
|
11
|
+
export { wrapMasterKey, unwrapMasterKeyEd25519, unwrapMasterKeyRSA } from './standard.js';
|
|
12
|
+
/**
|
|
13
|
+
* @deprecated Enhanced tier is deprecated. New installations use Standard or Maximum only.
|
|
14
|
+
*
|
|
15
|
+
* Enhanced tier: BIP39 24-word recovery key.
|
|
16
|
+
*
|
|
17
|
+
* The master key is a 256-bit random value which maps directly to a 24-word
|
|
18
|
+
* BIP39 mnemonic. Either the mnemonic or the SSH-wrapped key can recover.
|
|
19
|
+
*/
|
|
20
|
+
/**
|
|
21
|
+
* @deprecated Use Standard tier (SSH key wrapping) instead.
|
|
22
|
+
*
|
|
23
|
+
* Encode a 256-bit master key as a 24-word BIP39 mnemonic.
|
|
24
|
+
* The master key bytes are used directly as the entropy.
|
|
25
|
+
*/
|
|
26
|
+
export function generateRecoveryKey(masterKey) {
|
|
27
|
+
if (masterKey.length !== 32) {
|
|
28
|
+
throw new Error(`Master key must be 32 bytes (256 bits), got ${masterKey.length}`);
|
|
29
|
+
}
|
|
30
|
+
const entropy = Buffer.from(masterKey.buffer).toString('hex');
|
|
31
|
+
const mnemonic = bip39.entropyToMnemonic(entropy);
|
|
32
|
+
return mnemonic;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* @deprecated Use Standard tier (SSH key wrapping) instead.
|
|
36
|
+
*
|
|
37
|
+
* Decode a 24-word BIP39 mnemonic back to the 256-bit master key.
|
|
38
|
+
* Returns a SecureBuffer containing the recovered key.
|
|
39
|
+
*/
|
|
40
|
+
export function recoverFromMnemonic(mnemonic) {
|
|
41
|
+
const trimmed = mnemonic.trim().toLowerCase();
|
|
42
|
+
if (!bip39.validateMnemonic(trimmed)) {
|
|
43
|
+
throw new Error('Invalid BIP39 mnemonic');
|
|
44
|
+
}
|
|
45
|
+
const words = trimmed.split(/\s+/);
|
|
46
|
+
if (words.length !== 24) {
|
|
47
|
+
throw new Error(`Expected 24-word mnemonic, got ${words.length} words`);
|
|
48
|
+
}
|
|
49
|
+
const entropyHex = bip39.mnemonicToEntropy(trimmed);
|
|
50
|
+
const entropyBytes = Buffer.from(entropyHex, 'hex');
|
|
51
|
+
if (entropyBytes.length !== 32) {
|
|
52
|
+
throw new Error(`Recovered entropy must be 32 bytes, got ${entropyBytes.length}`);
|
|
53
|
+
}
|
|
54
|
+
return SecureBuffer.from(entropyBytes);
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=enhanced.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"enhanced.js","sourceRoot":"","sources":["../../../crypto/tiers/enhanced.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,oFAAoF;AACpF,0DAA0D;AAC1D,8CAA8C;AAC9C,kFA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IAAI,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;IAEpD,IAAI,YAAY,CAAC,MAAM,KAAK,EAAE,EAAE,CAAC;QAC/B,MAAM,IAAI,KAAK,CAAC,2CAA2C,YAAY,CAAC,MAAM,EAAE,CAAC,CAAC;IACpF,CAAC;IAED,OAAO,YAAY,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;AACzC,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ISecureBuffer } from '../types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Maximum tier: Argon2id passphrase derivation.
|
|
4
|
+
*
|
|
5
|
+
* The master key is derived from a user-chosen passphrase.
|
|
6
|
+
* No recovery path — if the passphrase is lost, data is lost.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Derive a master key from a passphrase using Argon2id.
|
|
10
|
+
*
|
|
11
|
+
* @param passphrase - User passphrase
|
|
12
|
+
* @param salt - Optional 16-byte salt. If not provided, a random one is generated.
|
|
13
|
+
* @returns Object with the derived master key and the salt (for server storage)
|
|
14
|
+
*/
|
|
15
|
+
export declare function deriveFromPassphrase(passphrase: string, salt?: Uint8Array): {
|
|
16
|
+
masterKey: ISecureBuffer;
|
|
17
|
+
salt: Uint8Array;
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=maximum.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"maximum.d.ts","sourceRoot":"","sources":["../../../crypto/tiers/maximum.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAIjD;;;;;GAKG;AAEH;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAClC,UAAU,EAAE,MAAM,EAClB,IAAI,CAAC,EAAE,UAAU,GAChB;IAAE,SAAS,EAAE,aAAa,CAAC;IAAC,IAAI,EAAE,UAAU,CAAA;CAAE,CAUhD"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { randomBytes } from 'node:crypto';
|
|
2
|
+
import { deriveFromPassphrase as argon2Derive } from '../argon2.js';
|
|
3
|
+
const SALT_LENGTH = 16;
|
|
4
|
+
/**
|
|
5
|
+
* Maximum tier: Argon2id passphrase derivation.
|
|
6
|
+
*
|
|
7
|
+
* The master key is derived from a user-chosen passphrase.
|
|
8
|
+
* No recovery path — if the passphrase is lost, data is lost.
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Derive a master key from a passphrase using Argon2id.
|
|
12
|
+
*
|
|
13
|
+
* @param passphrase - User passphrase
|
|
14
|
+
* @param salt - Optional 16-byte salt. If not provided, a random one is generated.
|
|
15
|
+
* @returns Object with the derived master key and the salt (for server storage)
|
|
16
|
+
*/
|
|
17
|
+
export function deriveFromPassphrase(passphrase, salt) {
|
|
18
|
+
const actualSalt = salt ?? new Uint8Array(randomBytes(SALT_LENGTH));
|
|
19
|
+
if (actualSalt.length !== SALT_LENGTH) {
|
|
20
|
+
throw new Error(`Salt must be ${SALT_LENGTH} bytes, got ${actualSalt.length}`);
|
|
21
|
+
}
|
|
22
|
+
const masterKey = argon2Derive(passphrase, actualSalt);
|
|
23
|
+
return { masterKey, salt: actualSalt };
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=maximum.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"maximum.js","sourceRoot":"","sources":["../../../crypto/tiers/maximum.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,OAAO,EAAE,oBAAoB,IAAI,YAAY,EAAE,MAAM,cAAc,CAAC;AAGpE,MAAM,WAAW,GAAG,EAAE,CAAC;AAEvB;;;;;GAKG;AAEH;;;;;;GAMG;AACH,MAAM,UAAU,oBAAoB,CAClC,UAAkB,EAClB,IAAiB;IAEjB,MAAM,UAAU,GAAG,IAAI,IAAI,IAAI,UAAU,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC,CAAC;IAEpE,IAAI,UAAU,CAAC,MAAM,KAAK,WAAW,EAAE,CAAC;QACtC,MAAM,IAAI,KAAK,CAAC,gBAAgB,WAAW,eAAe,UAAU,CAAC,MAAM,EAAE,CAAC,CAAC;IACjF,CAAC;IAED,MAAM,SAAS,GAAG,YAAY,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;IAEvD,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC;AACzC,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import * as crypto from 'node:crypto';
|
|
2
|
+
import type { ISecureBuffer, SSHKeyInfo } from '../types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Standard tier: SSH key wrapping.
|
|
5
|
+
*
|
|
6
|
+
* For Ed25519 keys: crypto_box_seal (ephemeral X25519 ECDH + XSalsa20-Poly1305)
|
|
7
|
+
* For RSA keys: RSA-OAEP-SHA256 KEM + XChaCha20-Poly1305 DEM
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Wrap a master key with an SSH public key.
|
|
11
|
+
* Ed25519: uses crypto_box_seal after converting to X25519.
|
|
12
|
+
* RSA: uses RSA-OAEP KEM + XChaCha20-Poly1305 DEM.
|
|
13
|
+
*/
|
|
14
|
+
export declare function wrapMasterKey(masterKey: ISecureBuffer, sshPublicKey: SSHKeyInfo): Uint8Array;
|
|
15
|
+
/**
|
|
16
|
+
* Unwrap a master key with an SSH private key (Ed25519).
|
|
17
|
+
* @param wrappedKey - The sealed box
|
|
18
|
+
* @param ed25519SecretKey - The 64-byte Ed25519 secret key
|
|
19
|
+
*/
|
|
20
|
+
export declare function unwrapMasterKeyEd25519(wrappedKey: Uint8Array, ed25519SecretKey: Uint8Array, ed25519PublicKey: Uint8Array): ISecureBuffer;
|
|
21
|
+
/**
|
|
22
|
+
* Unwrap a master key wrapped with RSA-OAEP KEM + DEM.
|
|
23
|
+
* @param wrappedKey - Serialized [4-byte wrappedWKLen][wrappedWK][nonce][ct][tag]
|
|
24
|
+
* @param rsaPrivateKey - RSA private key in PEM or DER format
|
|
25
|
+
*/
|
|
26
|
+
export declare function unwrapMasterKeyRSA(wrappedKey: Uint8Array, rsaPrivateKey: crypto.KeyObject): ISecureBuffer;
|
|
27
|
+
//# sourceMappingURL=standard.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"standard.d.ts","sourceRoot":"","sources":["../../../crypto/tiers/standard.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AAMtC,OAAO,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAI7D;;;;;GAKG;AAEH;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,SAAS,EAAE,aAAa,EAAE,YAAY,EAAE,UAAU,GAAG,UAAU,CAO5F;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CACpC,UAAU,EAAE,UAAU,EACtB,gBAAgB,EAAE,UAAU,EAC5B,gBAAgB,EAAE,UAAU,GAC3B,aAAa,CAaf;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAChC,UAAU,EAAE,UAAU,EACtB,aAAa,EAAE,MAAM,CAAC,SAAS,GAC9B,aAAa,CA0Cf"}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import * as crypto from 'node:crypto';
|
|
2
|
+
import sodium from 'sodium-native';
|
|
3
|
+
import { aeadEncrypt, aeadDecrypt } from '../aead.js';
|
|
4
|
+
import { SecureBuffer } from '../secure-buffer.js';
|
|
5
|
+
import { ed25519ToX25519PublicKey, ed25519ToX25519SecretKey } from '../ssh-keys.js';
|
|
6
|
+
const RSA_MIN_BITS = 2048;
|
|
7
|
+
/**
|
|
8
|
+
* Standard tier: SSH key wrapping.
|
|
9
|
+
*
|
|
10
|
+
* For Ed25519 keys: crypto_box_seal (ephemeral X25519 ECDH + XSalsa20-Poly1305)
|
|
11
|
+
* For RSA keys: RSA-OAEP-SHA256 KEM + XChaCha20-Poly1305 DEM
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* Wrap a master key with an SSH public key.
|
|
15
|
+
* Ed25519: uses crypto_box_seal after converting to X25519.
|
|
16
|
+
* RSA: uses RSA-OAEP KEM + XChaCha20-Poly1305 DEM.
|
|
17
|
+
*/
|
|
18
|
+
export function wrapMasterKey(masterKey, sshPublicKey) {
|
|
19
|
+
if (sshPublicKey.type === 'ed25519') {
|
|
20
|
+
return wrapWithEd25519(masterKey, sshPublicKey.publicKeyBytes);
|
|
21
|
+
}
|
|
22
|
+
else if (sshPublicKey.type === 'rsa') {
|
|
23
|
+
return wrapWithRSA(masterKey, sshPublicKey.publicKeyBytes);
|
|
24
|
+
}
|
|
25
|
+
throw new Error(`Unsupported SSH key type: ${sshPublicKey.type}`);
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Unwrap a master key with an SSH private key (Ed25519).
|
|
29
|
+
* @param wrappedKey - The sealed box
|
|
30
|
+
* @param ed25519SecretKey - The 64-byte Ed25519 secret key
|
|
31
|
+
*/
|
|
32
|
+
export function unwrapMasterKeyEd25519(wrappedKey, ed25519SecretKey, ed25519PublicKey) {
|
|
33
|
+
const x25519Sk = ed25519ToX25519SecretKey(ed25519SecretKey);
|
|
34
|
+
const x25519Pk = ed25519ToX25519PublicKey(ed25519PublicKey);
|
|
35
|
+
const plaintext = Buffer.alloc(wrappedKey.length - sodium.crypto_box_SEALBYTES);
|
|
36
|
+
sodium.crypto_box_seal_open(plaintext, Buffer.from(wrappedKey), Buffer.from(x25519Pk), Buffer.from(x25519Sk));
|
|
37
|
+
return SecureBuffer.from(plaintext);
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Unwrap a master key wrapped with RSA-OAEP KEM + DEM.
|
|
41
|
+
* @param wrappedKey - Serialized [4-byte wrappedWKLen][wrappedWK][nonce][ct][tag]
|
|
42
|
+
* @param rsaPrivateKey - RSA private key in PEM or DER format
|
|
43
|
+
*/
|
|
44
|
+
export function unwrapMasterKeyRSA(wrappedKey, rsaPrivateKey) {
|
|
45
|
+
const buf = Buffer.from(wrappedKey);
|
|
46
|
+
let offset = 0;
|
|
47
|
+
// Read wrapped wrapping key length
|
|
48
|
+
const wrappedWKLen = buf.readUInt32BE(offset);
|
|
49
|
+
offset += 4;
|
|
50
|
+
// Read wrapped wrapping key
|
|
51
|
+
const wrappedWK = buf.subarray(offset, offset + wrappedWKLen);
|
|
52
|
+
offset += wrappedWKLen;
|
|
53
|
+
// Remaining is AEAD encrypted master key: nonce(24) || ciphertext || tag(16)
|
|
54
|
+
const aeadPayload = buf.subarray(offset);
|
|
55
|
+
const nonce = aeadPayload.subarray(0, 24);
|
|
56
|
+
const ciphertext = aeadPayload.subarray(24, aeadPayload.length - 16);
|
|
57
|
+
const tag = aeadPayload.subarray(aeadPayload.length - 16);
|
|
58
|
+
// Decrypt wrapping key with RSA-OAEP
|
|
59
|
+
const wrappingKey = crypto.privateDecrypt({
|
|
60
|
+
key: rsaPrivateKey,
|
|
61
|
+
padding: crypto.constants.RSA_PKCS1_OAEP_PADDING,
|
|
62
|
+
oaepHash: 'sha256',
|
|
63
|
+
}, wrappedWK);
|
|
64
|
+
// Decrypt master key with XChaCha20-Poly1305
|
|
65
|
+
const emptyAAD = new Uint8Array(0);
|
|
66
|
+
const masterKeyBytes = aeadDecrypt(new Uint8Array(wrappingKey), new Uint8Array(nonce), new Uint8Array(ciphertext), new Uint8Array(tag), emptyAAD);
|
|
67
|
+
// Zero the wrapping key
|
|
68
|
+
wrappingKey.fill(0);
|
|
69
|
+
return SecureBuffer.from(Buffer.from(masterKeyBytes));
|
|
70
|
+
}
|
|
71
|
+
// --- Internal helpers ---
|
|
72
|
+
function wrapWithEd25519(masterKey, ed25519PublicKey) {
|
|
73
|
+
const x25519Pk = ed25519ToX25519PublicKey(ed25519PublicKey);
|
|
74
|
+
const sealed = Buffer.alloc(masterKey.length + sodium.crypto_box_SEALBYTES);
|
|
75
|
+
sodium.crypto_box_seal(sealed, masterKey.buffer, Buffer.from(x25519Pk));
|
|
76
|
+
return new Uint8Array(sealed);
|
|
77
|
+
}
|
|
78
|
+
function wrapWithRSA(masterKey, rsaPublicKeyBytes) {
|
|
79
|
+
// Parse the RSA public key bytes (SSH wire format: exponent + modulus)
|
|
80
|
+
const rsaPubKey = rsaPublicKeyBytesToKeyObject(rsaPublicKeyBytes);
|
|
81
|
+
// Check minimum key size
|
|
82
|
+
const keyDetail = rsaPubKey.asymmetricKeySize;
|
|
83
|
+
if (keyDetail !== undefined && keyDetail * 8 < RSA_MIN_BITS) {
|
|
84
|
+
throw new Error(`RSA key too small: ${keyDetail * 8} bits (minimum ${RSA_MIN_BITS})`);
|
|
85
|
+
}
|
|
86
|
+
// Generate random 32-byte wrapping key
|
|
87
|
+
const wrappingKey = crypto.randomBytes(32);
|
|
88
|
+
// RSA-OAEP encrypt the wrapping key
|
|
89
|
+
const wrappedWK = crypto.publicEncrypt({
|
|
90
|
+
key: rsaPubKey,
|
|
91
|
+
padding: crypto.constants.RSA_PKCS1_OAEP_PADDING,
|
|
92
|
+
oaepHash: 'sha256',
|
|
93
|
+
}, wrappingKey);
|
|
94
|
+
// XChaCha20-Poly1305 encrypt the master key with the wrapping key
|
|
95
|
+
const emptyAAD = new Uint8Array(0);
|
|
96
|
+
const { nonce, ciphertext, tag } = aeadEncrypt(new Uint8Array(wrappingKey), new Uint8Array(masterKey.buffer), emptyAAD);
|
|
97
|
+
// Zero the wrapping key
|
|
98
|
+
wrappingKey.fill(0);
|
|
99
|
+
// Serialize: [4-byte wrappedWK length][wrappedWK][nonce][ciphertext][tag]
|
|
100
|
+
const totalLen = 4 + wrappedWK.length + nonce.length + ciphertext.length + tag.length;
|
|
101
|
+
const result = Buffer.alloc(totalLen);
|
|
102
|
+
let offset = 0;
|
|
103
|
+
result.writeUInt32BE(wrappedWK.length, offset);
|
|
104
|
+
offset += 4;
|
|
105
|
+
wrappedWK.copy(result, offset);
|
|
106
|
+
offset += wrappedWK.length;
|
|
107
|
+
Buffer.from(nonce).copy(result, offset);
|
|
108
|
+
offset += nonce.length;
|
|
109
|
+
Buffer.from(ciphertext).copy(result, offset);
|
|
110
|
+
offset += ciphertext.length;
|
|
111
|
+
Buffer.from(tag).copy(result, offset);
|
|
112
|
+
return new Uint8Array(result);
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Convert SSH wire format RSA public key bytes to a Node.js KeyObject.
|
|
116
|
+
* Input: [4-byte exponent length][exponent][4-byte modulus length][modulus]
|
|
117
|
+
*/
|
|
118
|
+
function rsaPublicKeyBytesToKeyObject(rsaBytes) {
|
|
119
|
+
const buf = Buffer.from(rsaBytes);
|
|
120
|
+
let offset = 0;
|
|
121
|
+
const eLen = buf.readUInt32BE(offset);
|
|
122
|
+
offset += 4;
|
|
123
|
+
const e = buf.subarray(offset, offset + eLen);
|
|
124
|
+
offset += eLen;
|
|
125
|
+
const nLen = buf.readUInt32BE(offset);
|
|
126
|
+
offset += 4;
|
|
127
|
+
const n = buf.subarray(offset, offset + nLen);
|
|
128
|
+
// Build a DER-encoded RSA public key (PKCS#1)
|
|
129
|
+
// Use Node.js crypto to create from JWK
|
|
130
|
+
const jwk = {
|
|
131
|
+
kty: 'RSA',
|
|
132
|
+
n: bufferToBase64Url(stripLeadingZero(n)),
|
|
133
|
+
e: bufferToBase64Url(stripLeadingZero(e)),
|
|
134
|
+
};
|
|
135
|
+
return crypto.createPublicKey({ key: jwk, format: 'jwk' });
|
|
136
|
+
}
|
|
137
|
+
function stripLeadingZero(buf) {
|
|
138
|
+
// SSH wire format may have a leading zero byte for sign
|
|
139
|
+
if (buf[0] === 0 && buf.length > 1) {
|
|
140
|
+
return buf.subarray(1);
|
|
141
|
+
}
|
|
142
|
+
return buf;
|
|
143
|
+
}
|
|
144
|
+
function bufferToBase64Url(buf) {
|
|
145
|
+
return buf.toString('base64').replace(/\+/g, '-').replace(/\//g, '_').replace(/=+$/, '');
|
|
146
|
+
}
|
|
147
|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AAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAED,SAAS,iBAAiB,CAAC,GAAW;IACpC,OAAO,GAAG,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;AAC3F,CAAC"}
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Memory-locked buffer for sensitive key material.
|
|
3
|
+
* Wraps sodium_malloc() with mlock and auto-zeroing on dispose.
|
|
4
|
+
*/
|
|
5
|
+
export interface ISecureBuffer {
|
|
6
|
+
/** Read the buffer contents. Throws if disposed. */
|
|
7
|
+
readonly buffer: Buffer;
|
|
8
|
+
/** Byte length of the buffer */
|
|
9
|
+
readonly length: number;
|
|
10
|
+
/** Whether the buffer has been zeroed and disposed */
|
|
11
|
+
readonly isDisposed: boolean;
|
|
12
|
+
/** Zero the buffer contents and release memory */
|
|
13
|
+
dispose(): void;
|
|
14
|
+
}
|
|
15
|
+
/** Supported encryption algorithms */
|
|
16
|
+
export type Algorithm = 'XChaCha20-Poly1305' | 'AES-256-GCM';
|
|
17
|
+
/** Key identifier for derived keys */
|
|
18
|
+
export type KeyId = 'CEK' | 'MEK' | 'EEK';
|
|
19
|
+
/** Security tier for key management */
|
|
20
|
+
export declare enum SecurityTier {
|
|
21
|
+
/** SSH key wrapping (crypto_box_seal for Ed25519, RSA-OAEP KEM+DEM for RSA) */
|
|
22
|
+
Standard = "standard",
|
|
23
|
+
/** @deprecated BIP39 24-word recovery key + SSH key. Use Standard or Maximum instead. */
|
|
24
|
+
Enhanced = "enhanced",
|
|
25
|
+
/** Argon2id passphrase derivation, no recovery */
|
|
26
|
+
Maximum = "maximum"
|
|
27
|
+
}
|
|
28
|
+
/** Set of derived keys from the master key */
|
|
29
|
+
export interface DerivedKeySet {
|
|
30
|
+
/** Content encryption key (HKDF info: "chaoskb-content") */
|
|
31
|
+
contentKey: ISecureBuffer;
|
|
32
|
+
/** Metadata encryption key (HKDF info: "chaoskb-metadata") */
|
|
33
|
+
metadataKey: ISecureBuffer;
|
|
34
|
+
/** Embedding encryption key (HKDF info: "chaoskb-embedding", reserved) */
|
|
35
|
+
embeddingKey: ISecureBuffer;
|
|
36
|
+
/** Commitment key for HMAC (HKDF info: "chaoskb-commit") */
|
|
37
|
+
commitKey: ISecureBuffer;
|
|
38
|
+
}
|
|
39
|
+
/** SSH key type */
|
|
40
|
+
export type SSHKeyType = 'ed25519' | 'rsa';
|
|
41
|
+
/** Parsed SSH key information */
|
|
42
|
+
export interface SSHKeyInfo {
|
|
43
|
+
type: SSHKeyType;
|
|
44
|
+
publicKeyBytes: Uint8Array;
|
|
45
|
+
fingerprint: string;
|
|
46
|
+
comment?: string;
|
|
47
|
+
}
|
|
48
|
+
/** Encryption envelope v1 wire format */
|
|
49
|
+
export interface Envelope {
|
|
50
|
+
/** Envelope version (must be 1) */
|
|
51
|
+
v: 1;
|
|
52
|
+
/** Opaque blob identifier (b_ prefix + base62) */
|
|
53
|
+
id: string;
|
|
54
|
+
/** ISO 8601 timestamp (server-generated) */
|
|
55
|
+
ts: string;
|
|
56
|
+
/** Encryption envelope */
|
|
57
|
+
enc: {
|
|
58
|
+
/** Algorithm identifier */
|
|
59
|
+
alg: Algorithm;
|
|
60
|
+
/** Key identifier */
|
|
61
|
+
kid: KeyId;
|
|
62
|
+
/** Base64-encoded: nonce || ciphertext || auth_tag */
|
|
63
|
+
ct: string;
|
|
64
|
+
/** Byte length of decoded ct */
|
|
65
|
+
'ct.len': number;
|
|
66
|
+
/** Base64-encoded HMAC-SHA256 key commitment */
|
|
67
|
+
commit: string;
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Envelope v2 CBOR wire format — stores ct and commit as raw binary
|
|
72
|
+
* instead of base64, saving ~33% size on ciphertext.
|
|
73
|
+
*/
|
|
74
|
+
export interface EnvelopeV2 {
|
|
75
|
+
/** Envelope version (must be 2) */
|
|
76
|
+
v: 2;
|
|
77
|
+
/** Opaque blob identifier */
|
|
78
|
+
id: string;
|
|
79
|
+
/** ISO 8601 timestamp */
|
|
80
|
+
ts: string;
|
|
81
|
+
/** Encryption envelope */
|
|
82
|
+
enc: {
|
|
83
|
+
alg: Algorithm;
|
|
84
|
+
kid: KeyId;
|
|
85
|
+
/** Raw binary: nonce || ciphertext || auth_tag */
|
|
86
|
+
ct: Uint8Array;
|
|
87
|
+
/** HMAC-SHA256 key commitment (raw binary) */
|
|
88
|
+
commit: Uint8Array;
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
/** Union type for any supported envelope version */
|
|
92
|
+
export type AnyEnvelope = Envelope | EnvelopeV2;
|
|
93
|
+
/** Plaintext payload types */
|
|
94
|
+
export type PayloadType = 'source' | 'chunk' | 'canary';
|
|
95
|
+
/** Source payload (decrypted) */
|
|
96
|
+
export interface SourcePayload {
|
|
97
|
+
type: 'source';
|
|
98
|
+
url: string;
|
|
99
|
+
title?: string;
|
|
100
|
+
tags?: string[];
|
|
101
|
+
chunkCount: number;
|
|
102
|
+
chunkIds: string[];
|
|
103
|
+
}
|
|
104
|
+
/** Chunk payload (decrypted) */
|
|
105
|
+
export interface ChunkPayload {
|
|
106
|
+
type: 'chunk';
|
|
107
|
+
sourceId: string;
|
|
108
|
+
index: number;
|
|
109
|
+
model: string;
|
|
110
|
+
content: string;
|
|
111
|
+
tokenCount: number;
|
|
112
|
+
embedding: number[];
|
|
113
|
+
}
|
|
114
|
+
/** Canary payload for key verification */
|
|
115
|
+
export interface CanaryPayload {
|
|
116
|
+
type: 'canary';
|
|
117
|
+
value: 'chaoskb-canary-v1';
|
|
118
|
+
}
|
|
119
|
+
/** Any decrypted payload */
|
|
120
|
+
export type Payload = SourcePayload | ChunkPayload | CanaryPayload;
|
|
121
|
+
/** Result of encryption */
|
|
122
|
+
export interface EncryptResult {
|
|
123
|
+
envelope: Envelope;
|
|
124
|
+
/** Raw JSON bytes for upload */
|
|
125
|
+
bytes: Uint8Array;
|
|
126
|
+
}
|
|
127
|
+
/** Result of decryption */
|
|
128
|
+
export interface DecryptResult {
|
|
129
|
+
payload: Payload;
|
|
130
|
+
envelope: Envelope;
|
|
131
|
+
}
|
|
132
|
+
/** OS keyring service interface */
|
|
133
|
+
export interface IKeyringService {
|
|
134
|
+
store(service: string, account: string, secret: ISecureBuffer): Promise<void>;
|
|
135
|
+
retrieve(service: string, account: string): Promise<ISecureBuffer | null>;
|
|
136
|
+
delete(service: string, account: string): Promise<boolean>;
|
|
137
|
+
}
|
|
138
|
+
/** Encryption service interface */
|
|
139
|
+
export interface IEncryptionService {
|
|
140
|
+
/** Generate a new random master key */
|
|
141
|
+
generateMasterKey(): ISecureBuffer;
|
|
142
|
+
/** Derive all subkeys from master key */
|
|
143
|
+
deriveKeys(masterKey: ISecureBuffer, salt?: Uint8Array): DerivedKeySet;
|
|
144
|
+
/** Encrypt a payload into an envelope */
|
|
145
|
+
encrypt(payload: Payload, keys: DerivedKeySet, kid?: KeyId): EncryptResult;
|
|
146
|
+
/** Decrypt an envelope into a payload */
|
|
147
|
+
decrypt(envelope: Envelope, keys: DerivedKeySet): DecryptResult;
|
|
148
|
+
/** Generate a blob ID */
|
|
149
|
+
generateBlobId(): string;
|
|
150
|
+
}
|
|
151
|
+
/** Key management service for a specific security tier */
|
|
152
|
+
export interface IKeyManager {
|
|
153
|
+
tier: SecurityTier;
|
|
154
|
+
/** Wrap master key for storage */
|
|
155
|
+
wrapMasterKey(masterKey: ISecureBuffer): Promise<Uint8Array>;
|
|
156
|
+
/** Unwrap master key from storage */
|
|
157
|
+
unwrapMasterKey(wrappedKey: Uint8Array): Promise<ISecureBuffer>;
|
|
158
|
+
}
|
|
159
|
+
/** Project key management */
|
|
160
|
+
export interface IProjectKeyManager {
|
|
161
|
+
/** Generate a new project key and wrap with personal master key */
|
|
162
|
+
createProjectKey(masterKey: ISecureBuffer): Promise<{
|
|
163
|
+
projectKey: ISecureBuffer;
|
|
164
|
+
wrappedKey: Uint8Array;
|
|
165
|
+
}>;
|
|
166
|
+
/** Unwrap a project key using personal master key */
|
|
167
|
+
unwrapProjectKey(wrappedKey: Uint8Array, masterKey: ISecureBuffer): Promise<ISecureBuffer>;
|
|
168
|
+
}
|
|
169
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../crypto/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B,oDAAoD;IACpD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,gCAAgC;IAChC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,sDAAsD;IACtD,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;IAC7B,kDAAkD;IAClD,OAAO,IAAI,IAAI,CAAC;CACjB;AAED,sCAAsC;AACtC,MAAM,MAAM,SAAS,GAAG,oBAAoB,GAAG,aAAa,CAAC;AAE7D,sCAAsC;AACtC,MAAM,MAAM,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,CAAC;AAE1C,uCAAuC;AACvC,oBAAY,YAAY;IACtB,+EAA+E;IAC/E,QAAQ,aAAa;IACrB,yFAAyF;IACzF,QAAQ,aAAa;IACrB,kDAAkD;IAClD,OAAO,YAAY;CACpB;AAED,8CAA8C;AAC9C,MAAM,WAAW,aAAa;IAC5B,4DAA4D;IAC5D,UAAU,EAAE,aAAa,CAAC;IAC1B,8DAA8D;IAC9D,WAAW,EAAE,aAAa,CAAC;IAC3B,0EAA0E;IAC1E,YAAY,EAAE,aAAa,CAAC;IAC5B,4DAA4D;IAC5D,SAAS,EAAE,aAAa,CAAC;CAC1B;AAED,mBAAmB;AACnB,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG,KAAK,CAAC;AAE3C,iCAAiC;AACjC,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AAuC;IACvC,iBAAiB,IAAI,aAAa,CAAC;IACnC,yCAAyC;IACzC,UAAU,CAAC,SAAS,EAAE,aAAa,EAAE,IAAI,CAAC,EAAE,UAAU,GAAG,aAAa,CAAC;IACvE,yCAAyC;IACzC,OAAO,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,aAAa,EAAE,GAAG,CAAC,EAAE,KAAK,GAAG,aAAa,CAAC;IAC3E,yCAAyC;IACzC,OAAO,CAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,aAAa,GAAG,aAAa,CAAC;IAChE,yBAAyB;IACzB,cAAc,IAAI,MAAM,CAAC;CAC1B;AAED,0DAA0D;AAC1D,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,YAAY,CAAC;IACnB,kCAAkC;IAClC,aAAa,CAAC,SAAS,EAAE,aAAa,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IAC7D,qCAAqC;IACrC,eAAe,CAAC,UAAU,EAAE,UAAU,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;CACjE;AAED,6BAA6B;AAC7B,MAAM,WAAW,kBAAkB;IACjC,mEAAmE;IACnE,gBAAgB,CACd,SAAS,EAAE,aAAa,GACvB,OAAO,CAAC;QAAE,UAAU,EAAE,aAAa,CAAC;QAAC,UAAU,EAAE,UAAU,CAAA;KAAE,CAAC,CAAC;IAClE,qDAAqD;IACrD,gBAAgB,CAAC,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;CAC5F"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** Security tier for key management */
|
|
2
|
+
export var SecurityTier;
|
|
3
|
+
(function (SecurityTier) {
|
|
4
|
+
/** SSH key wrapping (crypto_box_seal for Ed25519, RSA-OAEP KEM+DEM for RSA) */
|
|
5
|
+
SecurityTier["Standard"] = "standard";
|
|
6
|
+
/** @deprecated BIP39 24-word recovery key + SSH key. Use Standard or Maximum instead. */
|
|
7
|
+
SecurityTier["Enhanced"] = "enhanced";
|
|
8
|
+
/** Argon2id passphrase derivation, no recovery */
|
|
9
|
+
SecurityTier["Maximum"] = "maximum";
|
|
10
|
+
})(SecurityTier || (SecurityTier = {}));
|
|
11
|
+
//# sourceMappingURL=types.js.map
|