jwt 0.1.4

JSON Web Token #

JSON Web Token (JWT) is a compact URL-safe means of representing claims to be transferred between two parties. The claims in a JWT are encoded as a JavaScript Object Notation (JSON) object that is used as the payload of a JSON Web Signature (JWS) structure or as the plaintext of a JSON Web Encryption (JWE) structure, enabling the claims to be digitally signed or MACed and/or encrypted.

The JWT spec is implemented as a standard Dart Codec.

Example usage #

import 'package:jwt/json_web_token.dart';

// Encode (i.e. sign) a payload into a JWT token.

final jwt = new JsonWebTokenCodec(secret: "My secret key");
final payload = {
  'iss': 'joe',
  'exp': 1300819380,
  'http://example.com/is_root': true
final token = jwt.encode(payload);

// Validate a token.


// Decode (i.e. extract) the payload from a JWT token.

final payload = jwt.decode(token);

Status #

The API is not stable. The intend is to strictly follow Dart conventions, i.e. make the API as 'dartish' as possible while maintaining simplicity. We are open to any suggestions towards that goal.

Credits #

Copyright (c) 2014 George Moschovitis george.moschovitis@gmail.com.

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  jwt: ^0.1.4

2. Install it

You can install packages from the command line:

with pub:

$ pub get

Alternatively, your editor might support pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:jwt/base64.dart';
import 'package:jwt/base64url.dart';
import 'package:jwt/json_web_signature.dart';
import 'package:jwt/json_web_token.dart';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

The package version is not analyzed, because it does not support Dart 2. Until this is resolved, the package will receive a health and maintenance score of 0.

Analysis issues and suggestions

Support Dart 2 in pubspec.yaml.

The SDK constraint in pubspec.yaml doesn't allow the Dart 2.0.0 release. For information about upgrading it to be Dart 2 compatible, please see https://dart.dev/dart-2#migration.