refactor: organize backend by business responsibility

This commit is contained in:
2026-09-13 13:52:57 +03:00
parent 7fde3ece6e
commit 8ba005346d
145 changed files with 3027 additions and 2346 deletions
@@ -0,0 +1,19 @@
import { TbankCrypto } from './tbank.crypto';
describe('TbankCrypto', () => {
it('round-trips a token and rejects a malformed key', () => {
const crypto = TbankCrypto.fromBase64(
'MDEyMzQ1Njc4OWFiY2RlZjAxMjM0NTY3ODlhYmNkZWY=',
);
const encrypted = crypto.encrypt('secret-token');
const replacement = crypto.encrypt('secret-token');
expect(encrypted).not.toContain('secret-token');
expect(replacement).not.toBe(encrypted);
expect(crypto.decrypt(encrypted)).toBe('secret-token');
expect(crypto.decrypt(replacement)).toBe('secret-token');
expect(() => TbankCrypto.fromBase64('invalid')).toThrow(
'Invalid token encryption key',
);
});
});