halkyon_base: a Serverpod module for sign-in, accounts and instance basics

What every Halkyon server has, taken from Halkyon Learn's: anonymous,
GitHub and email-code sign-in with their endpoints, an account's ways
in and its deletion, the pruning of abandoned anonymous people, of
sign-up attempts and of expired codes, and the instance's basics (the
sign-in ways offered, the source link, the minimum app build, where
people's data and its backups are). Endpoints sit under the nickname
`base`. A host configures it in one place before its pod starts: its
name for the mails, its source link, its minimum build, and hooks that
delete its own data with a person.

The tables keep Learn's names, columns and indexes, so a host moving
onto the module migrates nothing but version rows. Server package under
the SSPL, client under the AGPL, as Learn's are.

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-19 14:28:09 +02:00
commit af1de799f4
Signed by: raisondetredev
GPG key ID: 07F6FCF405488B64

View file

@ -0,0 +1,44 @@
import 'package:halkyon_base_server/base.dart';
import 'package:test/test.dart';
void main() {
group("Where the operator says the instance's data is", () {
test("is a country's code or the European Union's", () {
expect(dataLocationFrom('CH'), 'CH');
expect(dataLocationFrom('EU'), 'EU');
});
test('is read in either case, around spaces', () {
expect(dataLocationFrom(' ch '), 'CH');
});
test('is nothing where it is unset, empty or no code', () {
expect(dataLocationFrom(null), isNull);
expect(dataLocationFrom(''), isNull);
expect(dataLocationFrom('Switzerland'), isNull);
expect(dataLocationFrom('C1'), isNull);
});
test('is never "none": the data is somewhere', () {
expect(dataLocationFrom('none'), isNull);
});
});
group('Where the operator says its backups are', () {
test("is a country's code or the European Union's", () {
expect(backupLocationFrom('ch'), 'CH');
expect(backupLocationFrom('EU'), 'EU');
});
test('may be none, in either case', () {
expect(backupLocationFrom('none'), noBackups);
expect(backupLocationFrom('NONE'), noBackups);
});
test('is nothing where it is unset, empty or no code', () {
expect(backupLocationFrom(null), isNull);
expect(backupLocationFrom(''), isNull);
expect(backupLocationFrom('Hetzner'), isNull);
});
});
}