sign method
Signs bytes.
Example
In this example, we use Ed25519:
import 'package:cryptography/cryptography.dart';
Future<void> main() async {
final signedMessage = [1,2,3];
final ed25519 = Ed25519();
final keyPair = await ed25519.newKeyPair();
final signature = await ed25519.sign(
signedMessage,
keyPair: keyPair,
);
// ...
final isRealSignature = await ed25519.verify(
signedMessage,
signature: signature,
);
print('Signature verification result: $isRealSignature');
}
Implementation
@override
Future<Signature> sign(
List<int> input, {
required KeyPair keyPair,
}) async {
final keyPairData = await keyPair.extract();
return signSync(
input,
keyPairData: keyPairData,
);
}