platform/test/auth_token_test.dart

16 lines
450 B
Dart
Raw Normal View History

2016-09-21 23:09:23 +00:00
import "package:angel_auth/src/auth_token.dart";
import "package:crypto/crypto.dart";
import "package:test/test.dart";
main() async {
final Hmac hmac = new Hmac(sha256, "angel_auth".codeUnits);
test("sample serialization", () {
var token = new AuthToken(ipAddress: "localhost", userId: "thosakwe");
var jwt = token.serialize(hmac);
print(jwt);
var parsed = new AuthToken.validate(jwt, hmac);
print(parsed.toJson());
});
}