jwk
0.2.4, released 12 months ago by dint.dev
Encode and decode JSON Web Keys for use with the cryptography package
What it does
The jwk package provides a simple API to convert cryptographic key pairs and secret keys to and from JSON Web Key (JWK) format. It supports RSA, EC, and symmetric keys and works with the cryptography package for key generation and usage.
AI-written summary of version 0.2.4, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need to exchange keys in JWK format with external services
- You are using the cryptography package and want a convenient way to serialize keys
- You are implementing JWT or other protocols that require JWKs
Skip it when
- You are not using the cryptography package
- You need a different key format such as PEM or PKCS#8
Strengths
- Simple, declarative API
- Null safety and modern Dart support
- Supports RSA, EC, and symmetric keys
Weaknesses
- Only works with the cryptography package
- No key generation or advanced key management features
Setup
- Kind
- Pure Dart
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 2
import 'package:cryptography/cryptography.dart';
import 'package:jwk/jwk.dart';
Future<void> main() async {
final keyPair = await RsaPss().newKeyPair();
final jwk = Jwk.fromKeyPair(keyPair);
final json = jwk.toJson();
}Alternatives
Packages that do the same job and could replace jwk.
- cbor
A Dart library for RFC8949‑compliant CBOR encoding and decoding.
89Compare - pem
PEM encoding and decoding of textual keys and certificates following RFC 7468.
78Compare - webcrypto
Cross-platform implementation of Web Cryptography APIs for Dart.
89Compare - json_schema
Validate JSON data against JSON Schema drafts in Dart.
63Compare
Works with
Packages commonly used together with jwk: ones it builds on, ones built on it, and its own family.