tweetnacl 0.3.1

  • Example
  • Installing
  • Versions
  • 78

A library for Dart developers.

Usage #

A simple usage example:

import 'package:tweetnacl/tweetnacl.dart';
import "dart:convert";
import 'dart:typed_data';

void main(){
  KeyPair kp = Signature.keyPair();
  print("secretKey: \"${TweetNaclFast.hexEncodeToString(kp.secretKey)}\"");
  print("publicKey: \"${TweetNaclFast.hexEncodeToString(kp.publicKey)}\"");

  Uint8List bytes = utf8.encode("test string");
  Signature s1 = Signature(null, kp.secretKey);
  Uint8List signature = s1.detached(bytes);
  print("signature: \"${TweetNaclFast.hexEncodeToString(signature)}\"");

  Signature s2 = Signature(kp.publicKey, null);
  bool result = s2.detached_verify(bytes,  signature);
  print("verify: \"${result}\"");

Features and bugs #

Please file feature requests and bugs at the issue tracker.

0.3.1 #

  • Initial version, created by Jeff Lee


import 'package:tweetnacl/tweetnacl.dart';
import "dart:convert";
import 'dart:typed_data';

void testSignDetached(String seedStr) {

  List<int> seed = TweetNaclFast.hexDecode(seedStr);
  KeyPair kp = Signature.keyPair_fromSeed(seed);

  String testString = "test string";
  Uint8List bytes = utf8.encode(testString);

  Signature s1 = Signature(null, kp.secretKey);
  Uint8List signature = s1.detached(bytes);

  Signature s2 = Signature(kp.publicKey, null);
  bool result = s2.detached_verify(bytes,  signature);

  assert(result == true);

void main() {

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  tweetnacl: ^0.3.1

2. Install it

You can install packages from the command line:

with pub:

$ pub get

with Flutter:

$ flutter packages get

Alternatively, your editor might support pub get or flutter packages get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:tweetnacl/tweetnacl.dart';
Version Uploaded Documentation Archive
0.3.1 Nov 20, 2018 Go to the documentation of tweetnacl 0.3.1 Download tweetnacl 0.3.1 archive
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Apr 22, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.2.0
  • pana: 0.12.14


Detected platforms: Flutter, web, other

No platform restriction found in primary library package:tweetnacl/tweetnacl.dart.

Health issues and suggestions

Document public APIs. (-0.33 points)

128 out of 131 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.

Fix lib/src/tweetnacl_base.dart. (-1.49 points)

Analysis of lib/src/tweetnacl_base.dart reported 3 hints:

line 561 col 30: Use isNotEmpty instead of length

line 1444 col 9: The value of the local variable 'i' isn't used.

line 1455 col 9: The value of the local variable 'i' isn't used.

Maintenance suggestions

The package description is too short. (-12 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0 <3.0.0
convert ^2.0.2 2.1.1
fixnum ^0.10.9 0.10.9
Transitive dependencies
charcode 1.1.2
typed_data 1.1.6
Dev dependencies
test ^1.0.0