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

A simple library for signing and verifying JWTs in Dart lang.

example/t_jwt_example.dart

import 'package:t_jwt/t_jwt.dart';

void main() {
  JWT jwt = JWT('secret');

  Map<String, String> header = {
    'alg': 'HS256',
    'typ': 'JWT'
  };

  Map<String, String>  payload = {
    'name': 'Topography Digital',
    'username': 'topography.digital',
  };

  DateTime expiresAt = DateTime.now().add(Duration(days: 1));

  String signed = jwt.sign(header, payload, expiresAt);

  bool isVerified = jwt.verify(signed);

  print(signed);
  print(isVerified);
}
1
likes
120
pub points
0%
popularity

Publisher

unverified uploader

A simple library for signing and verifying JWTs in Dart lang.

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (LICENSE)

Dependencies

crypto

More

Packages that depend on t_jwt