- User model with Ed25519 keypair identity - Register/login on home server (creates keypair) - Join guest servers with signature verification - Public endpoints for cross-server identity - Channel and message CRUD - JWT authentication middleware Architecture: Home server model, no federation, client-driven sync
26 lines
612 B
Dart
26 lines
612 B
Dart
import 'dart:convert';
|
|
|
|
import 'package:relic/relic.dart';
|
|
|
|
import '../config/config.dart';
|
|
|
|
extension RequestHelper on Request {
|
|
/// Parses the request body as JSON
|
|
Future<Map<String, dynamic>> asJson() async {
|
|
final bodyText = await readAsString();
|
|
return jsonDecode(bodyText);
|
|
}
|
|
}
|
|
|
|
extension MapToBody on Map<String, dynamic> {
|
|
/// Converts a Map to a JSON Body
|
|
Body get toBody => Body.fromString(jsonEncode(this));
|
|
}
|
|
|
|
extension BodyHelper on Body {
|
|
/// Creates a JSON body from a Map
|
|
static Body fromJson(Map<String, dynamic> json) {
|
|
return Body.fromString(jsonEncode(json));
|
|
}
|
|
}
|