jwk_plus 0.2.4 jwk_plus: ^0.2.4 copied to clipboard
JWK (JSON Web Key) encoding and decoding (for package:cryptography).
Overview #
JWK plus (JSON Web Key) encoding and decoding. Designed to be used with package:cryptography_plus.
Licensed under the Apache License 2.0.
Getting started #
In pubspec.yaml
dependencies:
cryptography_plus: ^2.7.0
jwk_plus: ^0.2.4
Examples #
Encoding KeyPair #
import 'package:cryptography_plus/cryptography_plus.dart';
import 'package:jwk_plus/jwk_plus.dart';
Future<void> main() async {
final keyPair = await RsaPss().newKeyPair();
final jwk = Jwk.fromKeyPair(keyPair);
final json = jwk.toJson();
}
Decoding SecretKey #
import 'package:jwk_plus/jwk_plus.dart';
void main() {
final jwk = Jwk.fromJson({
'kty': 'OCT',
'alg': 'A128KW',
'k': 'GawgguFyGrWKav7AX4VKUg',
});
final secretKey = jwk.toSecretKey();
}