verifyStream abstract method

Future<bool> verifyStream(
  1. List<int> signature,
  2. Stream<List<int>> data
)

Verify signature of data using this RSASSA-PKCS1-v1_5 public key.

Returns true if the signature was made the private key matching this public key. This uses the Hash specified when the key was generated or imported.

Example

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

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

// Using privateKey Bob can sign a message for Alice.
final message = 'Hi Alice';
final signature = await keyPair.privateKey.signBytes(utf8.encode(message));

// Given publicKey and signature Alice can verify the message from Bob.
final isValid = await keypair.publicKey.verifyStream(
  signature,
  Stream.fromIterable([utf8.encode(message)]),
);
if (isValid) {
  print('Authentic message from Bob: $message');
}

Implementation

Future<bool> verifyStream(List<int> signature, Stream<List<int>> data);