-
Notifications
You must be signed in to change notification settings - Fork 44
Expand file tree
/
Copy pathtypes.ts
More file actions
55 lines (51 loc) · 1.52 KB
/
Copy pathtypes.ts
File metadata and controls
55 lines (51 loc) · 1.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/**
* TypeScript types for the credentials skill.
* AES-256-GCM encrypted credential storage at ~/.aibtc/credentials.json
*/
/**
* A single encrypted credential as stored on disk.
* All sensitive values are encrypted — only id, label, category, and timestamps
* are stored in plaintext.
*/
export interface EncryptedCredential {
/** Normalized credential identifier: lowercase, hyphens only */
id: string;
/** Human-readable label (stored plaintext) */
label: string;
/** Category tag, e.g., "api-key", "token", "url", "secret" */
category: string;
/** AES-256-GCM ciphertext (base64) */
encrypted: string;
/** 12-byte GCM initialization vector (base64) */
iv: string;
/** 32-byte PBKDF2 salt (base64) — unique per credential */
salt: string;
/** 16-byte GCM authentication tag (base64) */
tag: string;
/** ISO 8601 creation timestamp */
createdAt: string;
/** ISO 8601 last-updated timestamp */
updatedAt: string;
}
/**
* The top-level structure of ~/.aibtc/credentials.json
*/
export interface CredentialStore {
version: 1;
credentials: Record<string, EncryptedCredential>;
}
/**
* Credential metadata — safe to expose without decryption.
* Excludes encrypted, iv, salt, and tag fields.
*/
export type CredentialMeta = Omit<
EncryptedCredential,
"encrypted" | "iv" | "salt" | "tag"
>;
/**
* A fully decrypted credential, including the plaintext value.
*/
export interface DecryptedCredential extends CredentialMeta {
/** Plaintext secret value — handle with care */
value: string;
}