File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -206,6 +206,28 @@ abstract class EcdhPrivateKey {
206
206
207
207
Future <Uint8List > exportPkcs8Key ();
208
208
209
+ /// Export the [EcdhPrivateKey] as a [JSON Web Key][1] .
210
+ ///
211
+ /// {@macro exportJsonWebKey:returns}
212
+ ///
213
+ /// **Example**
214
+ /// ```dart
215
+ /// import 'dart:convert';
216
+ /// import 'package:webcrypto/webcrypto.dart';
217
+ ///
218
+ /// Future<void> main() async {
219
+ /// // Alice generates a key-pair
220
+ /// final kpA = await EcdhPrivateKey.generateKey(EllipticCurve.p256);
221
+ ///
222
+ /// // Export the private key as a JSON Web Key.
223
+ /// final exportedPrivateKey = await kpA.privateKey.exportJsonWebKey();
224
+ ///
225
+ /// // The Map returned by `exportJsonWebKey()` can be converted to JSON with
226
+ /// // `jsonEncode` from `dart:convert`.
227
+ /// print(jsonEncode(exportedPrivateKey));
228
+ /// }
229
+ /// ```
230
+ /// [1] : https://www.rfc-editor.org/rfc/rfc7518.html#section-6.2
209
231
Future <Map <String , dynamic >> exportJsonWebKey ();
210
232
}
211
233
You can’t perform that action at this time.
0 commit comments