fix(app): no sheet is left busy by an error nothing expected

An instance's salt of another length made the device's cryptography throw
an ArgumentError, a wrapping's nonce a RangeError, and libsodium or the
keyring may throw their own; none was a refusal, so the step's error
escaped and the sheet stayed busy, which can't be closed. halkyon_keys
now checks the lengths of what comes from elsewhere before libsodium sees
it (KeyRefusal.malformed: a salt, a wrapping, a sealed key's box, a sealed
payload), the device's cryptography turns anything else into the general
failure, and so does every password cubit, the error logged by its type
alone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
This commit is contained in:
Tizian 「ティツィアーン」 2026-10-21 14:41:28 +02:00
commit cf69e62ad4
Signed by: raisondetredev
GPG key ID: 07F6FCF405488B64

View file

@ -308,4 +308,28 @@ void main() {
expect(answer.clientProof.lengthInBytes, 32);
expect(answer.verifiesServer(ByteData(32)), isFalse);
});
test('what an instance sends of the wrong length fails the step, never '
'escaping it', () async {
expect(
crypto.unlock(
'correct horse battery staple',
salt: Uint8List(15),
costs: account.setup.costs,
),
failsWith(PasswordProblem.failed),
);
// After the password proved right: the instance isn't trusted.
final unlocked = await unlock('correct horse battery staple');
expect(
open(
unlocked,
protocol.WrappedKeys(
nonce: ByteData(23),
cipherText: account.setup.passwordKeys.cipherText,
),
),
failsWith(PasswordProblem.instanceUnproven),
);
});
}