Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change SignatureMethod to be asynchronous #15

Open
wants to merge 1 commit into
base: fork/nbspou
Choose a base branch
from

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