From 1dc148a3f81f29b58ad3ec5dfbfed4e604e0d15c Mon Sep 17 00:00:00 2001 From: Moe Date: Thu, 28 Apr 2022 17:54:56 +0700 Subject: [PATCH] Add getSession mechanism --- lib/data/auth.dart | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 lib/data/auth.dart diff --git a/lib/data/auth.dart b/lib/data/auth.dart new file mode 100644 index 0000000..7761a30 --- /dev/null +++ b/lib/data/auth.dart @@ -0,0 +1,11 @@ +import 'dart:convert'; + +String getSession(userId, sessionToken) { + var sessionData = { + "user_id": userId, + "session_token": sessionToken + }; + var sessionRaw = jsonEncode(sessionData).toString(); + var sessionEncoded = base64.encode(utf8.encode(sessionRaw)); + return sessionEncoded; +} \ No newline at end of file