bs58check 1.0.1

bs58check #

A straight forward implementation of base58check extending upon bs58 for Flutter writing in Dart.

Inspired by bitcoinjs

Example #

import 'package:bs58check/bs58check.dart' as bs58check;

Uint8List decoded = bs58check.decode('5Kd3NBUAdUnhyzenEwVLy9pBKxSwXvE9FMPyR4UKZvpe6E3AgLr');

print(decoded);
// => [128, 237, 219, 220, 17, 104, 241, 218, 234, 219, 211, 228, 76, 30, 63, 143, 90, 40, 76, 32, 41, 247, 138, 210, 106, 249, 133, 131, 164, 153, 222, 91, 25]

print(HEX.encode(decoded));
// => 80eddbdc1168f1daeadbd3e44c1e3f8f5a284c2029f78ad26af98583a499de5b19

print(bs58check.encode(decoded));
// => 5Kd3NBUAdUnhyzenEwVLy9pBKxSwXvE9FMPyR4UKZvpe6E3AgLr


// for fun
print(bs58check.getAddress('AnDoan'));
// => 1AnDoannV16NE8AQ74obrTNf6i2jbahYadr

1.0.1 #

  • Initial version, created by anicdh

example/bs58check_example.dart

import '../lib/bs58check.dart' as bs58check;
import 'dart:typed_data';
import 'package:hex/hex.dart';
main() {
  Uint8List decoded = bs58check.decode('5Kd3NBUAdUnhyzenEwVLy9pBKxSwXvE9FMPyR4UKZvpe6E3AgLr');
  print(decoded);
  print(HEX.encode(decoded));
  print(bs58check.encode(decoded));
  print(bs58check.getAddress('AnDoan'));
}

Use this package as a library

1. Depend on it

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


dependencies:
  bs58check: ^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:bs58check/bs58check.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
74
Health:
Code health derived from static analysis. [more]
99
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
87
Learn more about scoring.

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

  • Dart: 2.4.0
  • pana: 0.12.19

Platforms

Detected platforms: Flutter, web, other

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

Health suggestions

Fix lib/src/utils/base.dart. (-1 points)

Analysis of lib/src/utils/base.dart reported 2 hints:

line 17 col 9: Use isEmpty instead of length

line 47 col 9: Use isEmpty instead of length

Format lib/src/bs58check_base.dart.

Run dartfmt to format lib/src/bs58check_base.dart.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.58.0 <3.0.0
crypto ^2.0.3 2.0.6
hex ^0.1.2 0.1.2
Transitive dependencies
charcode 1.1.2
collection 1.14.11
convert 2.1.1
typed_data 1.1.6
Dev dependencies
test ^1.0.0

Admin