cryptography
cryptography copied to clipboard
Context: Found this candidate, but the arguments don't match. factory RsaPss(
Trying to usage this example: https://pub.dev/documentation/cryptography/latest/cryptography/RsaPss-class.html
import 'package:cryptography/cryptography.dart';
Future<void> main() async {
final algorithm = RsaPss(
hashAlgorithm: Sha256(),
);
// Generate a key pair
final keyPair = await algorithm.newKeyPair();
// Sign a message
final message = <int>[1,2,3];
final signature = await algorithm.sign(
message,
keyPair: keyPair,
);
print('Signature bytes: ${signature.bytes}');
print('Public key: ${signature.publicKey.bytes}');
// Anyone can verify the signature
final isSignatureCorrect = await algorithm.verify(
message,
signature: signature,
);
}
But i got this error:
lib/services/crypto.dart:4:27: Error: Too few positional arguments: 1 required, 0 given.
final algorithm = RsaPss(
^
../../flutter/.pub-cache/hosted/pub.dartlang.org/cryptography-2.0.5/lib/src/cryptography/algorithms.dart:1183:11: Context: Found this candidate, but the arguments don't match.
factory RsaPss(
From VScode
The named parameter 'hashAlgorithm' isn't defined.
Try correcting the name to an existing named parameter's name, or defining a named parameter with the name 'hashAlgorithm'.
Dart version 2.16.0 AMD64 macOS cryptography version 2.0.5
Is the doc wrong or the dart sdk?