exportJsonWebKey abstract method

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

Export AesCbcSecretKey as JSON Web Key.

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 new random AES-256 secret key.
final key = await AesCbcSecretKey.generate(256);

// Export the secret key.
final jwk = await key.exportJsonWebKey();

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

Implementation

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