getToken static method
Implementation
static String getToken(String data, DateTime live, String secretKey) {
String header = _ecnrypt(jsonEncode({
"alg":"HS256","typ":"JWT"
}), secretKey);
String payload = _ecnrypt(jsonEncode({
"data": data,
"live": live.toIso8601String()
}), secretKey);
String signature = _ecnrypt(base64Url.encode(Hmac(sha256, utf8.encode(secretKey)).convert("$header.$payload".codeUnits).bytes), secretKey);
return "$header.$payload.$signature";
}