(passphrase: string)
| 203 | * Load the encryption key from salt + passphrase. |
| 204 | */ |
| 205 | export function loadKey(passphrase: string): Uint8Array { |
| 206 | if (!existsSync(SALT_PATH)) { |
| 207 | console.error("SharedContext not initialized. Run `sharedcontext init` first."); |
| 208 | process.exit(1); |
| 209 | } |
| 210 | const salt = new Uint8Array(readFileSync(SALT_PATH)); |
| 211 | return deriveKey(passphrase, salt); |
| 212 | } |
| 213 | |
| 214 | /** |
| 215 | * Load the identity private key (decrypts identity.enc with the derived key). |
no test coverage detected