sr25519 0.1.0 sr25519: ^0.1.0 copied to clipboard
A starting point for sr25519 library
sr25519 #
Imports #
import 'dart:convert';
import 'package:merlin/merlin.dart' as merlin;
import 'package:sr25519/sr25519.dart';
Example #
void main() {
final msg = utf8.encode('hello friends');
final signingCtx = utf8.encode('example');
final merlin.Transcript signingTranscript = Sr25519.newSigningContext(signingCtx, msg);
final merlin.Transcript verifyTranscript = Sr25519.newSigningContext(signingCtx, msg);
final keypair = Sr25519.generateKeyPair();
final (priv, pub) = (keypair.secretKey, keypair.publicKey);
final Signature sig = priv.sign(signingTranscript);
final (ok, _) = pub.verify(sig, verifyTranscript);
assert(ok == true);
}