Skip to content

Conversation

@xvrh
Copy link

@xvrh xvrh commented Mar 24, 2021

This pull request change the signature of SignatureMethod callback to accept returning a Future

A lot of packages implements the crypto algorithms with an asynchronous API. I would like to implement the RSA-SHA1 signature method with webcrypto like this:

import 'package:webcrypto/webcrypto.dart';

void main() {
  final rsaSha1 = SignatureMethod('RSA-SHA1', (String key, String text) async {
    var privateKey =
        await RsassaPkcs1V15PrivateKey.importPkcs8Key(_privateKey, Hash.sha1);
    return base64Encode(await privateKey.signBytes(text.codeUnits));
  });
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant