tezster_dart 1.0.0

  • Readme
  • Changelog
  • Example
  • Installing
  • 61

tezster_dart #

Star on GitHub License: MIT Github issues

Tezster banner A library for building decentralized applications in Flutter, currently focused on the Tezos platform. Tezster_dart package contains all the function that is required to build tezos application.

What is Tezos #

Tezos is a decentralized blockchain that governs itself by establishing a true digital commonwealth. It facilitates formal verification, a technique which mathematically proves the correctness of the code governing transactions and boosts the security of the most sensitive or financially weighted smart contracts.

Features #

  • Tezos wallet utilities.
    • Generate mnemonics.
    • Generate keys from mnemonic.
    • Generate keys from mnemonics and passphrase.
    • Sign Operation Group.
    • Unlock fundraiser identity.

Getting started #

Check out the example directory for a sample app for using Tezster_dart.

Import using #

import 'package:tezster_dart/tezster_dart.dart';

Usage #

  • Generate mnemonic
String mnemonic = TezsterDart.generateMnemonic(); // sustain laugh capital drop brush artist ahead blossom bread spring motor other mountain thumb volcano engine shed guilt famous loud force hundred same brave
  • Generate keys from mnemonic
List<String> keys = await TezsterDart.getKeysFromMnemonic(mnemonic: "Your Mnemonic");

/* [edskRdVS5H9YCRAG8yqZkX2nUTbGcaDqjYgopkJwRuPUnYzCn3t9ZGksncTLYe33bFjq29pRhpvjQizCCzmugMGhJiXezixvdC,
   edpkuLog552hecagkykJ3fTvop6grTMhfZY4TWbvchDWdYyxCHcrQL,
   tz1g85oYHLFKDpNfDHPeBUbi3S7pUsgCB28q] */
  • Create / Unlock identity from mnemonic and passphrase.
List<String> identityWithMnemonic = await TezsterDart.getKeysFromMnemonicAndPassphrase(
      mnemonic: "your mnemonic",
      passphrase: "pa$\$w0rd");

/* [edskS9kdgvCWDiZL1yP1qH5xLCWYHQub4qibfU8DQZjv7wX7BskxSsL6h9j1yDYJ7Y9jDbMULNmfLhw9vBJPqDw3TeVHHd34w7,
    edpkuRr9yHChSt2MTWHCeHe2JM3zJZxHgj8vEANwb8WENrZbLxYzbx,
    tz1hTe7oxtQr67dg6dWfTX3V44oPY7pzkFZS] */
  • Sign operation with private key and forged operation
List<String> signOperationGroup = await TezsterDart.signOperationGroup(
    privateKey: "edskRdV..... .XezixvdA",
    forgedOperation: "713cb068fe.... .b940ee");

/* [edsigtrBnsjSngfP6LULUDeo84eJVks4LWReYrZBUjKQNJjhVsG7bksqZ7CKnRePMceMe3vgRHHbyd2CqRdC8iEAK5NcyNn4iEB,
    713cb068fe3ac078351727eb5c34279e22b75b0cf4dc0a8d3d599e27031db136040cb9f9da085607c05cac1ca4c62a3f3cfb
    8146aa9b7f631e52f877a1d363474404da8130b0b940ee8c7ce5bf2968c1204c1c4b2ba98bcbd08fc4ad3cad706d39ac55e4
    dd61fde5a8496840ce2d377389a4ca7842bf613d3f096fda819c26e43adfb0cad1336a430d] */
  • Unlock fundraiser identity.
List<String> identityFundraiser = await TezsterDart.unlockFundraiserIdentity(
    mnemonic: "your mnemonic",
    email: "test@example.com",
    password: "pa$\$w0rd");

/* [edskRzNDm2dpqe2yd5zYAw1vmjr8sAwMubfcXajxdCNNr4Ud39BoppeqMAzoCPmb14mzfXRhjtydQjCbqU2VzWrsq6JP4D9GVb,
    edpkvASxrq16v5Awxpz4XPTA2d6QFaCL8expPrPNcVgVbWxT84Kdw2,
    tz1hhkSbaocSWm3wawZUuUdX57L3maSH16Pv] */

NOTE: Use stable version of flutter to avoid package conflicts.


Feature requests and bugs #

Please file feature requests and bugs at the issue tracker. If you want to contribute to this libary, please submit a Pull Request.

[1.0.0] #

Initial version of library.

  • Functions added:
    • Generate mnemonics.
    • Generate keys from mnemonic.
    • Generate keys from mnemonics and passphrase.
    • Sign Operation Group.
    • Unlock fundraiser identity.

example/lib/main.dart

// All the functions are called in initState(){}
// For reference please check Debug console for outputs.
// Just run the project you must see the print statement outputs in debug console. It may take few seconds to reflect the output.

// NOTE: please get the tezster_dart package under pubspec.yaml before running the project

import 'package:flutter/material.dart';
import 'package:tezster_dart/tezster_dart.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {

  example() async {
  //Generate mnemonic
    String mnemonic = TezsterDart.generateMnemonic(); // strength is optional, by default it's 256 ==> Generates 24 words.
    print("mnemonic ===> $mnemonic");
  //mnemonic ===> 24 random words, [If strength parameter is changed the words length differs.]
  
  //Generate keys from mnemonic
    List<String> keys = await TezsterDart.getKeysFromMnemonic(
        mnemonic: "luxury bulb roast timber sense stove sugar sketch goddess host meadow decorate gather salmon funny person canoe daring machine network camp moment wrong dice",
    );
    print("keys ===> $keys");
  //keys ===> [privateKey, publicKey, publicKeyHash]
  //Accessing: private key ===> keys[0] | public key ===> keys[1] | public Key Hash ===> identity[2] all of type string
  
  //Create / Unlock identity from mnemonic and passphrase.
    List<String> identity = await TezsterDart.getKeysFromMnemonicAndPassphrase(
      mnemonic:
          "cannon rabbit obvious drama slogan net acoustic donor core acoustic clinic poem travel plunge winter",
      passphrase: "5tjpU0cimq",
    );
    print("identity ===> $identity");
  // identityWithMnemonic ===> [privateKey, publicKey, publicKeyHash]
  // Accessing: private key ===> identity[0] | public key ===> identity[1] | public Key Hash ===> identity[2] all of type string.

  //Sign operation with public-Key and forged operation
    List<String> signOpGrp = await TezsterDart.signOperationGroup(
      privateKey: "edskRdVS5H9YCRAG8yqZkX2nUTbGcaDqjYgopkJwRuPUnYzCn3t9ZGksncTLYe33bFjq29pRhpvjQizCCzmugMGhJiXezixvdC",
      forgedOperation: "713cb068fe3ac078351727eb5c34279e22b75b0cf4dc0a8d3d599e27031db136040cb9f9da085607c05cac1ca4c62a3f3cfb8146aa9b7f631e52f877a1d363474404da8130b0b940ee",
    );
    print("signOperationGroup ===> $signOpGrp");
  //signOperationGroup ===> [hexSignature, signedOpBytes]
  //Accessing: hex signature ===> signOpGrp[0] | signed Operation bytes ===> signOpGrp[1] all of type string

  //Unlock fundraiser identity.
    List<String> identityFundraiser = await TezsterDart.unlockFundraiserIdentity(
      mnemonic:
          "cannon rabbit obvious drama slogan net acoustic donor core acoustic clinic poem travel plunge winter",
      email: "lkbpoife.tobqgidu@tezos.example.org",
      passphrase: "5tjpU0cimq",
    );
    print("identityFundraiser ===> $identityFundraiser");
  //identityFundraiser ===> [privateKey, publicKey, publicKeyHash]
  //Accessing: private key ===> identityFundraiser[0] | public key ===> identityFundraiser[1] | public Key Hash ===> identityFundraiser[2] all of type string.
  }

  @override
  void initState() {
    super.initState();
    example();
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      home: Scaffold(
        body: Padding(
          padding: EdgeInsets.all(8.0),
          child: Center(
            child: Text(
              "Welcome to Tezster_dart package.\n Please check the debug console for the outputs",
              textAlign: TextAlign.center,
            ),
          ),
        ),
      ),
    );
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  tezster_dart: ^1.0.0

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support 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:tezster_dart/tezster_dart.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
27
Health:
Code health derived from static analysis. [more]
99
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
90
Overall:
Weighted score of the above. [more]
61
Learn more about scoring.

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

  • Dart: 2.8.4
  • pana: 0.13.14
  • Flutter: 1.17.5

Analysis suggestions

Package does not support Flutter platform linux

Because:

  • package:tezster_dart/tezster_dart.dart that imports:
  • package:flutter_sodium/flutter_sodium.dart that declares support for platforms: android, ios

Package does not support Flutter platform macos

Because:

  • package:tezster_dart/tezster_dart.dart that imports:
  • package:flutter_sodium/flutter_sodium.dart that declares support for platforms: android, ios

Package does not support Flutter platform web

Because:

  • package:tezster_dart/tezster_dart.dart that imports:
  • package:flutter_sodium/flutter_sodium.dart that declares support for platforms: android, ios

Package does not support Flutter platform windows

Because:

  • package:tezster_dart/tezster_dart.dart that imports:
  • package:flutter_sodium/flutter_sodium.dart that declares support for platforms: android, ios

Package not compatible with SDK dart

Because:

  • tezster_dart that is a package requiring null.

Health issues and suggestions

Document public APIs. (-1 points)

13 out of 13 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.

Format lib/tezster_dart.dart.

Run flutter format to format lib/tezster_dart.dart.

Maintenance issues and suggestions

Support latest dependencies. (-10 points)

The version constraint in pubspec.yaml does not support the latest published versions for 1 dependency (flutter_sodium).

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.6.0 <3.0.0
bip39 ^1.0.3 1.0.3
blake2b ^0.1.2 0.1.2
bs58check ^1.0.1 1.0.1
convert ^2.1.1 2.1.1
crypto ^2.1.4 2.1.5
flutter 0.0.0
flutter_sodium ^0.0.11 0.0.11 0.1.0
password_hash ^2.0.0 2.0.0
unorm_dart ^0.1.2 0.1.2
Transitive dependencies
charcode 1.1.3
collection 1.14.12 1.14.13
fixnum 0.10.11
hex 0.1.2
meta 1.1.8 1.2.2
pointycastle 1.0.2
sky_engine 0.0.99
typed_data 1.1.6 1.2.0
vector_math 2.0.8 2.1.0-nullsafety
Dev dependencies
flutter_test