Skip to content

Commit

Permalink
v2.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
mrtnetwork committed Mar 16, 2024
1 parent 03bda5d commit 60afa2f
Show file tree
Hide file tree
Showing 148 changed files with 1,621 additions and 809 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## 2.1.0
- Implements classes for signing and verifying transaction digests.
- Introduces classes for signing and verifying transaction digests, with support for Cardano.
- Adds a new class for encoding and decoding ADA addresses, covering enterprise, pointer, base, reward, shelly, and shelly legacy address formats.
- Fixes an issue with CBOR decoding of negative integers in web environments.

## 2.0.1
- dart format .

Expand Down
9 changes: 1 addition & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,6 @@

Discover a versatile and powerful cryptographic toolkit, carefully crafted in pure Dart to serve developers, businesses, and blockchain enthusiasts across multiple platforms. This package offers a wide array of essential features, including encoding/decoding for various data formats, support for numerous blockchain addresses, robust cryptographic algorithms, mnemonic management, and more – all without relying on external dependencies. Whether you're securing private keys, interacting with blockchain networks, or ensuring data integrity, this cross-platform solution simplifies your crypto journey. Experience a comprehensive set of tools designed to meet your diverse encoding, cryptography, and blockchain needs on iOS, Android, the web, Linux, and beyond.

This comprehensive package has been shaped by the influence of several key sources, culminating in its development for Dart.

- python [bip_utils](https://github.com/ebellocchia/bip_utils)
- python [ecdsa](https://github.com/tlsfuzzer/python-ecdsa)
- rust [schnorrkel](https://github.com/w3f/schnorrkel)
- js [stablelib](https://github.com/StableLib/stablelib)
- rust [strobe](https://github.com/rozbb/strobe-rs)

## Features

**Encoding and Decoding:**
Expand Down Expand Up @@ -141,6 +133,7 @@ These features make your package a comprehensive solution for encoding, cryptogr
- Tron (EDDSA)
- Solana (EDDSA)
- XRP (EDDSA, ECDSA)
- Solana (EDDSA, EDDSA Khalow)

**Example: Explore Our Toolkit**

Expand Down
178 changes: 89 additions & 89 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,99 +1,99 @@
// ignore_for_file: avoid_print

import 'package:example/test/address/ada_shelly/ada_shelly.dart';
import 'package:example/test/address/algo/algo_test.dart';
import 'package:example/test/address/aptos/aptos_test.dart';
import 'package:example/test/address/atom/atom_test.dart';
import 'package:example/test/address/avax/avax_test.dart';
import 'package:example/test/address/bch_p2pkh/bch_p2pkh_test.dart';
import 'package:example/test/address/bch_p2sh/bch_p2sh_test.dart';
import 'package:example/test/address/egld/egld_test.dart';
import 'package:example/test/address/eos/eos_test.dart';
import 'package:example/test/address/ergo/ergo_test.dart';
import 'package:example/test/address/eth/eth_test.dart';
import 'package:example/test/address/fil/fil_test.dart';
import 'package:example/test/address/icx/icx_test.dart';
import 'package:example/test/address/inj/inj_test.dart';
import 'package:example/test/address/nano/nano_test.dart';
import 'package:example/test/address/neo/neo_test.dart';
import 'package:example/test/address/okex/okex_test.dart';
import 'package:example/test/address/one/one_test.dart';
import 'package:example/test/address/p2pkh/p2pkh_test.dart';
import 'package:example/test/address/p2sh/p2sh_test.dart';
import 'package:example/test/address/p2tr/p2tr_test.dart';
import 'package:example/test/address/p2wpkh/p2wpkh_test.dart';
import 'package:example/test/address/sol/sol_test.dart';
import 'package:example/test/address/substrate/substrate_test.dart';
import 'package:example/test/address/algo/algo.dart';
import 'package:example/test/address/aptos/aptos.dart';
import 'package:example/test/address/atom/atom.dart';
import 'package:example/test/address/avax/avax.dart';
import 'package:example/test/address/bch_p2pkh/bch_p2pkh.dart';
import 'package:example/test/address/bch_p2sh/bch_p2sh.dart';
import 'package:example/test/address/egld/egld.dart';
import 'package:example/test/address/eos/eos.dart';
import 'package:example/test/address/ergo/ergo.dart';
import 'package:example/test/address/eth/eth.dart';
import 'package:example/test/address/fil/fil.dart';
import 'package:example/test/address/icx/icx.dart';
import 'package:example/test/address/inj/inj.dart';
import 'package:example/test/address/nano/nano.dart';
import 'package:example/test/address/neo/neo.dart';
import 'package:example/test/address/okex/okex.dart';
import 'package:example/test/address/one/one.dart';
import 'package:example/test/address/p2pkh/p2pkh.dart';
import 'package:example/test/address/p2sh/p2sh.dart';
import 'package:example/test/address/p2tr/p2tr.dart';
import 'package:example/test/address/p2wpkh/p2wpkh.dart';
import 'package:example/test/address/sol/sol.dart';
import 'package:example/test/address/substrate/substrate.dart';
import 'package:example/test/address/trx/trx_test.dart';
import 'package:example/test/address/xlm/xml_test.dart';
import 'package:example/test/address/xmr/xmr_test.dart';
import 'package:example/test/address/xrp/xrp_test.dart';
import 'package:example/test/address/xtz/xtz_test.dart';
import 'package:example/test/address/zil/zil_test.dart';
import 'package:example/test/algorand/mnemonic_test.dart';
import 'package:example/test/base58/base58_test.dart';
import 'package:example/test/base58/base58_xmr_test.dart';
import 'package:example/test/bech32/bch_bech32_test.dart';
import 'package:example/test/bech32/bech32_test.dart';
import 'package:example/test/bech32/segwit_bech32_test.dart';
import 'package:example/test/bip/bip32/ed25519/ed25519_test.dart';
import 'package:example/test/bip/bip32/ed25519_blake2b/ed25519_blake2b_test.dart';
import 'package:example/test/bip/bip32/ed25519_khalow/ed25519_khalow_test.dart';
import 'package:example/test/bip/bip32/nist256p1/nist256p1_test.dart';
import 'package:example/test/bip/bip32/secp256k1/secp256k1_test.dart';
import 'package:example/test/bip/bip38/bip38_addr_test.dart';
import 'package:example/test/bip/bip38/bip38_ec_test.dart';
import 'package:example/test/bip/bip38/bip38_no_ec_test.dart';
import 'package:example/test/bip/bip39/bip39_test.dart';
import 'package:example/test/bip/bip44/bip44_test.dart';
import 'package:example/test/bip/bip49/bip49_test.dart';
import 'package:example/test/bip/bip84/bip84_test.dart';
import 'package:example/test/bip/bip86/bip86_test.dart';
import 'package:example/test/cardano/bip32/icarus_test.dart';
import 'package:example/test/cardano/bip32/legacy_test.dart';
import 'package:example/test/cardano/byron/byron_lagacy_test.dart';
import 'package:example/test/cardano/cip1852/cip1852_test.dart';
import 'package:example/test/cardano/mnemonic/mnemonic_test.dart';
import 'package:example/test/cardano/shelly/shelly_test.dart';
import 'package:example/test/cbor_test.dart';
import 'package:example/test/crypto/aes/aes_ctr_test.dart';
import 'package:example/test/crypto/blake2b/blake2b_test.dart';
import 'package:example/test/crypto/chacha20_poly1305/chacha20_poly1305_test.dart';
import 'package:example/test/crypto/crc32/crc32_test.dart';
import 'package:example/test/crypto/hmac/hmac_test.dart';
import 'package:example/test/crypto/keccack/keccack_test.dart';
import 'package:example/test/crypto/md4/md4_test.dart';
import 'package:example/test/crypto/md5/md5_test.dart';
import 'package:example/test/crypto/pbkdf2/pbkdf2_test.dart';
import 'package:example/test/crypto/ripemd/ripemd_test.dart';
import 'package:example/test/crypto/scrypt/scrypt_test.dart';
import 'package:example/test/crypto/sha1/sha1_test.dart';
import 'package:example/test/crypto/sha256/sha256_test.dart';
import 'package:example/test/crypto/sha3/sha3_test.dart';
import 'package:example/test/crypto/sha512/sha512_test.dart';
import 'package:example/test/crypto/sha512_256/sha512_256_test.dart';
import 'package:example/test/crypto/shake/shake_test.dart';
import 'package:example/test/crypto/x_modem_crc/x_modem_crc_test.dart';
import 'package:example/test/ecdsa/ed_test.dart';
import 'package:example/test/ecdsa/projective_test.dart';
import 'package:example/test/elctrum/mnemonic/mnemonic_test.dart';
import 'package:example/test/elctrum/v1/v1_test.dart';
import 'package:example/test/elctrum/v2/v2_test.dart';
import 'package:example/test/monero/mnemonic/monero_mnemonic_test.dart';
import 'package:example/test/monero/monero_test.dart';
import 'package:example/test/schnorrkel/derive_test.dart';
import 'package:example/test/schnorrkel/schnorrkel_key_test.dart';
import 'package:example/test/schnorrkel/sign_test.dart';
import 'package:example/test/schnorrkel/vrf_test.dart';
import 'package:example/test/address/xlm/xml.dart';
import 'package:example/test/address/xmr/xmr.dart';
import 'package:example/test/address/xrp/xrp.dart';
import 'package:example/test/address/xtz/xtz.dart';
import 'package:example/test/address/zil/zil.dart';
import 'package:example/test/algorand/mnemonic.dart';
import 'package:example/test/base58/base58.dart';
import 'package:example/test/base58/base58_xmr.dart';
import 'package:example/test/bech32/bch_bech32.dart';
import 'package:example/test/bech32/bech32.dart';
import 'package:example/test/bech32/segwit_bech32.dart';
import 'package:example/test/bip/bip32/ed25519/ed25519.dart';
import 'package:example/test/bip/bip32/ed25519_blake2b/ed25519_blake2b.dart';
import 'package:example/test/bip/bip32/ed25519_khalow/ed25519_khalow.dart';
import 'package:example/test/bip/bip32/nist256p1/nist256p1.dart';
import 'package:example/test/bip/bip32/secp256k1/secp256k1.dart';
import 'package:example/test/bip/bip38/bip38_addr.dart';
import 'package:example/test/bip/bip38/bip38_ec.dart';
import 'package:example/test/bip/bip38/bip38_no_ec.dart';
import 'package:example/test/bip/bip39/bip39.dart';
import 'package:example/test/bip/bip44/bip44.dart';
import 'package:example/test/bip/bip49/bip49.dart';
import 'package:example/test/bip/bip84/bip84.dart';
import 'package:example/test/bip/bip86/bip86.dart';
import 'package:example/test/cardano/bip32/icarus.dart';
import 'package:example/test/cardano/bip32/legacy.dart';
import 'package:example/test/cardano/byron/byron_lagacy.dart';
import 'package:example/test/cardano/cip1852/cip1852.dart';
import 'package:example/test/cardano/mnemonic/mnemonic.dart';
import 'package:example/test/cardano/shelly/shelly.dart';
import 'package:example/test/cbor.dart';
import 'package:example/test/crypto/aes/aes_ctr.dart';
import 'package:example/test/crypto/blake2b/blake2b.dart';
import 'package:example/test/crypto/chacha20_poly1305/chacha20_poly1305.dart';
import 'package:example/test/crypto/crc32/crc32.dart';
import 'package:example/test/crypto/hmac/hmac.dart';
import 'package:example/test/crypto/keccack/keccack.dart';
import 'package:example/test/crypto/md4/md4.dart';
import 'package:example/test/crypto/md5/md5.dart';
import 'package:example/test/crypto/pbkdf2/pbkdf2.dart';
import 'package:example/test/crypto/ripemd/ripemd.dart';
import 'package:example/test/crypto/scrypt/scrypt.dart';
import 'package:example/test/crypto/sha1/sha1.dart';
import 'package:example/test/crypto/sha256/sha256.dart';
import 'package:example/test/crypto/sha3/sha3.dart';
import 'package:example/test/crypto/sha512/sha512.dart';
import 'package:example/test/crypto/sha512_256/sha512_256.dart';
import 'package:example/test/crypto/shake/shake.dart';
import 'package:example/test/crypto/x_modem_crc/x_modem_crc.dart';
import 'package:example/test/ecdsa/ed.dart';
import 'package:example/test/ecdsa/projective.dart';
import 'package:example/test/elctrum/mnemonic/mnemonic.dart';
import 'package:example/test/elctrum/v1/v1.dart';
import 'package:example/test/elctrum/v2/v2.dart';
import 'package:example/test/monero/mnemonic/monero_mnemonic.dart';
import 'package:example/test/monero/monero.dart';
import 'package:example/test/schnorrkel/derive.dart';
import 'package:example/test/schnorrkel/schnorrkel_key.dart';
import 'package:example/test/schnorrkel/sign.dart';
import 'package:example/test/schnorrkel/vrf.dart';
import 'package:example/test/secure_storage_test.dart';
import 'package:example/test/ss58/ss58_test.dart';
import 'package:example/test/substrate/scale_test.dart';
import 'package:example/test/substrate/substrate_test.dart';
import 'package:example/test/uuid_test.dart';
import 'package:example/test/wif/wif_test.dart';
import 'package:example/test/ss58/ss58.dart';
import 'package:example/test/substrate/scale.dart';
import 'package:example/test/substrate/substrate.dart';
import 'package:example/test/uuid.dart';
import 'package:example/test/wif/wif.dart';
import 'package:flutter/material.dart';

import 'test/address/near/near_test.dart';
import 'test/address/near/near.dart';

/// for test in different ENV
/// The package is created in Pure Dart and this test contains thousands of tests,
Expand Down
2 changes: 1 addition & 1 deletion example/lib/test/address/ada_byron/byron.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'package:blockchain_utils/bip/address/ada_byron_addr.dart';
import 'package:blockchain_utils/bip/address/ada/ada_byron_addr.dart';
import 'package:blockchain_utils/compare/compare.dart';
import 'package:blockchain_utils/binary/utils.dart';
import 'byron_test_vector.dart' as byron;
Expand Down
5 changes: 3 additions & 2 deletions example/lib/test/address/ada_shelly/ada_shelly.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'package:blockchain_utils/bip/address/ada_shelley_addr.dart';
import 'package:blockchain_utils/bip/address/decoders.dart';
import 'package:blockchain_utils/bip/address/encoders.dart';
import 'package:example/test/quick_hex.dart';
import 'package:blockchain_utils/binary/utils.dart';
import 'test_vector.dart';
Expand All @@ -16,7 +17,7 @@ void adaShellyAddrTest() {
}
for (final i in t.testVector) {
final params = Map<String, dynamic>.from(i["params"]);
final netTag = AdaShelleyAddrNetworkTags.values.firstWhere((element) =>
final netTag = ADANetwork.values.firstWhere((element) =>
element.name.toLowerCase() ==
(params["net_tag"] as String).toLowerCase());

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion example/lib/test/address/trx/trx_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import 'package:blockchain_utils/bip/address/trx_addr.dart';
import 'package:example/test/quick_hex.dart';
import 'package:blockchain_utils/binary/utils.dart';

import 'test_vector.dart' show testVecotr;
import 'test.dart' show testVecotr;

void trxAddressTest() {
for (final i in testVecotr) {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ void cborTest() {
assert(const CborIntValue(-1).encode().toHex() == "20");
assert(const CborIntValue(1000000000000000).encode().toHex() ==
"1b00038d7ea4c68000");
assert(CborInt64Value(BigInt.from(-1000000000000000)).encode().toHex() ==
assert(CborSafeIntValue(BigInt.from(-1000000000000000)).encode().toHex() ==
"3b00038d7ea4c67fff");
assert(CborBigIntValue(BigInt.parse("1")).encode().toHex() == "c24101");
assert(CborBigIntValue(BigInt.parse("-1")).encode().toHex() == "c340");
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -142,18 +142,18 @@ void _testEncoding() {
void _testKeys() {
final pr =
EDDSAPrivateKey(Curves.generatorED25519, Uint8List(32), () => SHA512());
assert(pr.publicKey().point.toBytes().toHex() ==
assert(pr.publicKey.point.toBytes().toHex() ==
"3b6a27bcceb6a42d62a3a8d02a6f0d73653215771de243a63ac048a18b59da29");
final sig = pr.sign(Uint8List(32), () => SHA512());
final verify = pr.publicKey().verify(Uint8List(32), sig, () => SHA512());
final verify = pr.publicKey.verify(Uint8List(32), sig, () => SHA512());
assert(verify);
}

void _testEDBlake2bKeys() {
final pr =
EDDSAPrivateKey(Curves.generatorED25519, Uint8List(32), () => BLAKE2b());
final sig = pr.sign(Uint8List(32), () => BLAKE2b());
final verify = pr.publicKey().verify(Uint8List(32), sig, () => BLAKE2b());
final verify = pr.publicKey.verify(Uint8List(32), sig, () => BLAKE2b());
assert(verify);
}

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ packages:
path: ".."
relative: true
source: path
version: "1.6.0"
version: "2.1.0"
boolean_selector:
dependency: transitive
description:
Expand Down
Loading

0 comments on commit 60afa2f

Please sign in to comment.