corsac_jwt
2.0.2, released a year ago by memspace.app
Lightweight implementation of JSON Web Tokens (JWT) for Dart and Flutter.
What it does
Allows you to create, sign, parse, and validate JSON Web Tokens (JWT) using various algorithms like HS256, RS256, and ES256. It provides builders for claims and tools to verify token signatures and validate standard claims such as expiration and issuer.
AI-written summary of version 2.0.2, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need to generate and sign JWTs in your Dart backend or client application.
- You need to parse and verify incoming JWT signatures and validate their claims.
Skip it when
- You require complex auth provider integrations (like Firebase or OAuth client flows) rather than raw token handling.
Strengths
- Supports multiple signing algorithms (HS256, RS256, ES256).
- Lightweight and straightforward API for building, signing, and validating tokens.
Weaknesses
- Relies on manual verification and claim validation logic compared to full authentication SDKs.
Setup
- Kind
- Pure Dart
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 4
import 'package:corsac_jwt/corsac_jwt.dart';
void main() {
var builder = new JWTBuilder();
var token = builder
..issuer = 'https://api.foobar.com'
..expiresAt = new DateTime.now().add(new Duration(minutes: 3))
..setClaim('data', {'userId': 836})
..getToken();
var signer = new JWTHmacSha256Signer('sharedSecret');
var signedToken = builder.getSignedToken(signer);
var decodedToken = new JWT.parse(signedToken.toString());
print(decodedToken.verify(signer));
}Alternatives
Packages that do the same job and could replace corsac_jwt.
- dart_jsonwebtoken
A Dart library for creating, signing, decoding and verifying JSON Web Tokens (JWT).
81Compare - selective_disclosure_jwt
Dart SDK for working with Selective Disclosure JSON Web Tokens (SD-JWT)
58Compare - oauth2_client
Interact with OAuth2 servers and handle token storage and refreshing in Flutter.
92Compare - jwt_decode
A Dart package to decode JSON Web Tokens, check expiry dates, and verify expiration status.
50Compare
Works with
Packages commonly used together with corsac_jwt: ones it builds on, ones built on it, and its own family.
- cryptocorsac_jwt depends on itProvides SHA, MD5, and HMAC hashing functions for Dart.
- loggingcorsac_jwt depends on itProvides configurable logging with levels and stream listeners for Dart apps.
- pointycastlecorsac_jwt depends on itA Dart library providing a wide range of cryptographic algorithms and primitives.
- josecorsac_jwt depends on itJavascript Object Signing and Encryption library supporting JWE, JWS, JWK and JWT.