sr25519 0.4.1 copy "sr25519: ^0.4.1" to clipboard
sr25519: ^0.4.1 copied to clipboard

A sr25519 cryptography library in pure Dart

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);
  }
1
likes
140
points
1.08k
downloads

Publisher

verified publisherpolkadart.dev

Weekly Downloads

A sr25519 cryptography library in pure Dart

Homepage
Repository (GitHub)
View/report issues

Documentation

API reference

License

Apache-2.0 (license)

Dependencies

collection, convert, cryptography, merlin, ristretto255, substrate_bip39

More

Packages that depend on sr25519