secure_session 1.0.1 copy "secure_session: ^1.0.1" to clipboard
secure_session: ^1.0.1 copied to clipboard

A secure session manager for Dart.

example/lib/example.dart

import 'dart:io';

import 'package:secure_session/secure_session.dart';

Future<void> main(List<String> arguments) async {
  final server = await HttpServer.bind(InternetAddress.anyIPv4, 8080);
  print('Listening on localhost:${server.port}');

  await for (HttpRequest request in server) {
    final secureSession = SecureSession(keyPath: 'test_key');
    secureSession.init(request.cookies, request.session);
    secureSession.write('John Doe');
    request.response.write(secureSession.read());
    await request.response.close();
  }
}