ed25519_hd_key 1.0.1

  • Readme
  • Changelog
  • Example
  • Installing
  • 80

ed25519 HD Key #

Key Derivation for ed25519

Ported from ed25519-hd-key js library

SLIP-0010 - Specification

Usage #

import "package:hex/hex.dart";
import "package:ed25519_hd_key/ed25519_hd_key.dart";

void main() {
  String hexSeed =
      'fffcf9f6f3f0edeae7e4e1dedbd8d5d2cfccc9c6c3c0bdbab7b4b1aeaba8a5a29f9c999693908d8a8784817e7b7875726f6c696663605d5a5754514e4b484542';
  KeyData master = ED25519_HD_KEY.getMasterKeyFromSeed(hexSeed);
  print(HEX.encode(master.key)); // 171cb88b1b3c1db25add599712e36245d75bc65a1a5c9e18d76f9f2b1eab4012
  print(HEX.encode(master.chainCode)); // ef70a74db9c3a5af931b5fe73ed8e1a53464133654fd55e7a66f8570b8e33c3b

  KeyData data = ED25519_HD_KEY.derivePath("m/0'/2147483647'", hexSeed);
  var pb = ED25519_HD_KEY.getBublickKey(data.key);
  print(HEX.encode(data.key)); // ea4f5bfe8694d8bb74b7b59404632fd5968b774ed545e810de9c32a4fb4192f4
  print(HEX.encode(data.chainCode)); // 138f0b2551bcafeca6ff2aa88ba8ed0ed8de070841f0c4ef0165df8181eaad7f
  print(HEX.encode(pb)); // 005ba3b9ac6e90e83effcd25ac4e58a1365a9e35a3d3ae5eb07b9e4d90bcf7506d
}

References #

SLIP-0010

BIP-0032

BIP-0044

Changelog #

1.0.1 (2019-01-24) #

  • add CHANGELOG
  • add example

1.0.0 (2019-01-24) #

  • initial version

example/ed25519_hd_key.dart

import "package:hex/hex.dart";
import "package:ed25519_hd_key/ed25519_hd_key.dart";

void main() {
  String hexSeed =
      'fffcf9f6f3f0edeae7e4e1dedbd8d5d2cfccc9c6c3c0bdbab7b4b1aeaba8a5a29f9c999693908d8a8784817e7b7875726f6c696663605d5a5754514e4b484542';
  KeyData master = ED25519_HD_KEY.getMasterKeyFromSeed(hexSeed);
  print(HEX.encode(master.key));
  print(HEX.encode(master.chainCode));

  KeyData data = ED25519_HD_KEY.derivePath("m/0'/2147483647'", hexSeed);
  print(HEX.encode(data.key));
  print(HEX.encode(data.chainCode));
  var pb = ED25519_HD_KEY.getBublickKey(data.key);
  print(HEX.encode(pb));
}

Use this package as a library

1. Depend on it

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


dependencies:
  ed25519_hd_key: ^1.0.1

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter pub get

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

3. Import it

Now in your Dart code, you can use:


import 'package:ed25519_hd_key/ed25519_hd_key.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
68
Health:
Code health derived from static analysis. [more]
98
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
82
Overall:
Weighted score of the above. [more]
80
Learn more about scoring.

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

  • Dart: 2.6.0
  • pana: 0.12.21

Platforms

Detected platforms: Flutter, web, other

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

Health issues and suggestions

Document public APIs. (-1 points)

10 out of 10 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/base.dart. (-1.49 points)

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

line 3 col 46: Use lowercase_with_underscores when specifying a library prefix.

line 60 col 7: DO use curly braces for all flow control structures.

line 73 col 24: Avoid const keyword.

Maintenance suggestions

The package description is too short. (-18 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.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0 <3.0.0
hex ^0.1.2 0.1.2
pointycastle ^1.0.0 1.0.2
tweetnacl ^0.3.1 0.3.2
Transitive dependencies
charcode 1.1.2
convert 2.1.1
fixnum 0.10.11
typed_data 1.1.6
Dev dependencies
test ^1.0.0