#### PR Dependency Tree * **PR #15060** 👈 This tree was auto-generated by [Charcoal](https://github.com/danerwilliams/charcoal) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * OpenApp native sign-in and native session exchange (JWT) for mobile & desktop. * Centralized short-lived auth challenge store for one-time tokens. * Encrypted per-endpoint token storage and native token handlers (Android, iOS, Electron). * **Improvements** * Richer auth-method reporting (password, magic link, OAuth, passkey) and improved sign-in flows. * Hardened magic-link, OAuth, and session issuance; JWT-backed sessions and websocket JWT support. * UX tweaks: form-based password submit, OTP autocomplete, adjusted captcha flow. * **Bug Fixes** * Expanded tests and auth-state resets to avoid cross-test leakage. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
57 lines
1.4 KiB
TypeScript
57 lines
1.4 KiB
TypeScript
import ava from 'ava';
|
|
|
|
import { verifyEmailDomainRecords } from '../../core/auth/email-domain';
|
|
|
|
const test = ava;
|
|
|
|
test('should verify email domain records', async t => {
|
|
const ok = await verifyEmailDomainRecords(
|
|
'user@example.com',
|
|
{
|
|
resolveMx: async () => [{ exchange: 'mx.example.com', priority: 10 }],
|
|
resolveTxt: async domain =>
|
|
domain === '_dmarc.example.com'
|
|
? [['v=DMARC1; p=none']]
|
|
: [['v=spf1 include:_spf.example.com ~all']],
|
|
},
|
|
100
|
|
);
|
|
|
|
t.true(ok);
|
|
});
|
|
|
|
test('should verify split txt record chunks', async t => {
|
|
const ok = await verifyEmailDomainRecords(
|
|
'user@example.com',
|
|
{
|
|
resolveMx: async () => [{ exchange: 'mx.example.com', priority: 10 }],
|
|
resolveTxt: async domain =>
|
|
domain === '_dmarc.example.com'
|
|
? [['v=DM', 'ARC1; p=none']]
|
|
: [['v=spf', '1 include:_spf.example.com ~all']],
|
|
},
|
|
100
|
|
);
|
|
|
|
t.true(ok);
|
|
});
|
|
|
|
test('should fail closed when email domain lookup times out', async t => {
|
|
const ok = await verifyEmailDomainRecords(
|
|
'user@example.com',
|
|
{
|
|
resolveMx: async () =>
|
|
new Promise(resolve =>
|
|
setTimeout(
|
|
() => resolve([{ exchange: 'mx.example.com', priority: 10 }]),
|
|
50
|
|
)
|
|
),
|
|
resolveTxt: async () => [['v=spf1 include:_spf.example.com ~all']],
|
|
},
|
|
1
|
|
);
|
|
|
|
t.false(ok);
|
|
});
|