This commit is contained in:
Raven Scott
2026-04-26 05:48:11 -04:00
parent 76055bccf0
commit 30e6cfc2ff
6 changed files with 289 additions and 4 deletions
@@ -34,3 +34,24 @@ test('login prompts when passphrase arg missing', async (t) => {
t.is(unlocked, 'secret-pass')
t.is(logs.length, 0)
})
test('login requests masked shell prompt when readLine exists', async (t) => {
const run = await loadLoginBin()
/** @type {unknown} */
let capturedOpts = null
let unlocked = ''
const ctx = {
console: { log: () => {}, error: () => {} },
readLine: async (_prompt, opts) => {
capturedOpts = opts
return 'secret-from-shell'
},
applyRegister: async () => {},
applyUnlock: async (p) => {
unlocked = p
}
}
await run(ctx, ['login'])
t.alike(capturedOpts, { mask: true })
t.is(unlocked, 'secret-from-shell')
})