exportJsonWebKey abstract method

Future<Map<String, dynamic>> exportJsonWebKey()

Export RSASSA-PKCS1-v1_5 public key in JSON Web Key format.

The output will be given as Map, String, List the same way jsonDecode from dart:convert represents decoded JSON values.

Example

import 'package:webcrypto/webcrypto.dart';
import 'dart:convert' show jsonEncode;

// Generate a key-pair.
final keyPair = await RsassaPkcs1V15PrivateKey.generateKey(
  4096,
  BigInt.from(65537),
  Hash.sha256,
);

// Export the public key.
final jwk = await keypair.publicKey.exportJsonWebKey();

// The Map returned by `exportJsonWebKey()` can be converted to JSON with
// `jsonEncode` from `dart:convert`, this will print something like:
// {"kty": "RSA", "alg": "RS256", ...}
print(jsonEncode(jwk));

Implementation

Future<Map<String, dynamic>> exportJsonWebKey();