tweetnacl 0.3.1

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • new54

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

example/tweetnacl_example.dart

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

void testSignDetached(String seedStr) {
  print("seed:@${DateTime.now().millisecondsSinceEpoch}");

  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);
  print("\ndetached...@${DateTime.now().millisecondsSinceEpoch}");
  Uint8List signature = s1.detached(bytes);
  print("...detached@${DateTime.now().millisecondsSinceEpoch}");

  Signature s2 = Signature(kp.publicKey, null);
  print("\nverify...@${DateTime.now().millisecondsSinceEpoch}");
  bool result = s2.detached_verify(bytes,  signature);
  print("...verify@${DateTime.now().millisecondsSinceEpoch}");

  assert(result == true);
}

void main() {
  testSignDetached("ac49000da11249ea3510941703a7e21a39837c4d2d5300daebbd532df20f8135");
  testSignDetached("e56f0eef73ade8f79bc1d16a99cbc5e4995afd8c14adb49410ecd957aecc8d02");
}

Use this package as a library

1. Depend on it

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


dependencies:
  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
Popularity:
Describes how popular the package is relative to other packages. [more]
23
Health:
Code health derived from static analysis. [more]
89
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
80
Overall:
Weighted score of the above. [more]
54
Learn more about scoring.

We analyzed this package on Dec 5, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.1.0
  • pana: 0.12.7

Platforms

Detected platforms: Flutter, web, other

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

Health issues and suggestions

Document public APIs (-9.76 points)

120 out of 123 API elements (library, class, field or method) have no adequate dartdoc content. Good documentation improves code readability and discoverability through search.

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

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

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.

line 3186 col 7: Name types using UpperCamelCase.

Maintenance suggestions

The description is too short. (-20 points)

Add more detail about the package, what it does and what is its target use case. Try to write at least 60 characters.

Dependencies

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