Skip to content

Commit

Permalink
refactor: Remove bip39 library (#86)
Browse files Browse the repository at this point in the history
  • Loading branch information
sleepdefic1t authored and faustbrian committed May 25, 2019
1 parent 3f20868 commit 8396209
Show file tree
Hide file tree
Showing 19 changed files with 12 additions and 306 deletions.
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
[submodule "src/lib/uECC"]
path = src/lib/uECC
url = https://github.com/kmackay/micro-ecc
[submodule "src/lib/bip39"]
path = src/lib/bip39
url = https://github.com/ciband/bip39.git
[submodule "test/lib/googletest"]
path = test/lib/googletest
url = https://github.com/google/googletest.git
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [0.5.0] - 2019-02-20

### Changed

- removed bip39 and mnemonic feature ([#86])

## [0.4.0] - 2019-05-20

### Changed
Expand Down
4 changes: 2 additions & 2 deletions docs/INSTALL_PLATFORMIO.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ or

also install platformio dependencies:
> install AUnit (2778), micro-ecc (1665) bip39 (5886) ArduinoJson@6.10.0 libraries
>```platformio lib -g install 2778 1665 5886 ArduinoJson@6.10.0```
> install AUnit (2778), micro-ecc (1665) ArduinoJson@6.10.0 libraries
>```platformio lib -g install 2778 1665 ArduinoJson@6.10.0```
#

Expand Down
12 changes: 0 additions & 12 deletions docs/cpp.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,18 +68,6 @@ message.verify();

## Identities

### Passphrase

#### Generate a default passphrase with 12 words in English
```cpp
const auto passphrase = Ark::Crypto::Identies::Mnemonic::generate();
```

#### Generate a passphrase with the given language and 24 words
```cpp
const auto passphrase = Ark::Crypto::Identies::Mnemonic::generate(24, Ark::Crypto::Identies::Language::en);
```

### Address

#### Get an address from a passphrase
Expand Down
5 changes: 0 additions & 5 deletions examples/cmake_example/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,6 @@ int main(int argc, char* argv[]) {
std::cout << "\tVerified: " << std::boolalpha << message.verify() << '\n';
std::cout << '\n';

// Mnemonic
const auto new_passphrase = Ark::Crypto::Identities::Mnemonic::generate();
std::cout << "Generated Mnemonic: " << new_passphrase << '\n';
std::cout << '\n';

// Address - from passphrase
const uint8_t networkVersion = 0x1E;
auto address = Address::fromPassphrase(passphrase, networkVersion);
Expand Down
5 changes: 0 additions & 5 deletions examples/platformio_example/src/main.ino
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,6 @@ void loop() {
Serial.print("\tVerified: "); Serial.print(message.verify()); Serial.println();
Serial.println();

// Mnemonic
const auto new_passphrase = Ark::Crypto::Identities::Mnemonic::generate();
Serial.print("Generated Mnemonic: "); Serial.print(new_passphrase.c_str()); Serial.println();
Serial.println();

// Address - from passphrase
const uint8_t networkVersion = 0x1E;
auto address = Address::fromPassphrase(passphrase, networkVersion);
Expand Down
20 changes: 0 additions & 20 deletions extras/ARDUINO_IDE.sh
Original file line number Diff line number Diff line change
Expand Up @@ -115,15 +115,6 @@ if [[ -d ${INCLUDE_DIR} ]]; then
mkdir ${SRC_ENCODING_DIR}
mv ${INCLUDE_HELPERS_DIR}/encoding/hex.h ${SRC_ENCODING_DIR}

## 'bip39' library is not supported in Arduino
echo -e "Backing up and removing 'mnemonic.h'.\n"
mkdir ${EXTRAS_BACKUP_DIR}
mkdir ${EXTRAS_IDENTITIES_DIR}
mv ${INCLUDE_IDENTITIES_DIR}/mnemonic.h ${EXTRAS_IDENTITIES_DIR}
mv ${SRC_IDENTITIES_DIR}/mnemonic.cpp ${EXTRAS_IDENTITIES_DIR}
echo "// this is a dummy file" >> ${SRC_IDENTITIES_DIR}/mnemonic.h
echo "// this is a dummy file" >> ${SRC_IDENTITIES_DIR}/mnemonic.cpp

echo -e "Moving 'identites' headers.\n"
mv ${INCLUDE_IDENTITIES_DIR}/address.h ${SRC_IDENTITIES_DIR}
mv ${INCLUDE_IDENTITIES_DIR}/privatekey.h ${SRC_IDENTITIES_DIR}
Expand All @@ -144,7 +135,6 @@ if [[ -d ${INCLUDE_DIR} ]]; then

echo -e "Backing up, moving, and removing relevant modules from the 'lib' directory.\n"
mv ${SRC_LIB_DIR}/ArduinoJson ${EXTRAS_BACKUP_DIR}
mv ${SRC_LIB_DIR}/bip39 ${EXTRAS_BACKUP_DIR}
mv ${SRC_LIB_DIR}/uECC ${EXTRAS_BACKUP_DIR}
mv ${SRC_LIB_DIR}/bcl ${SRC_DIR}
mv ${SRC_LIB_DIR}/date ${SRC_DIR}
Expand Down Expand Up @@ -196,7 +186,6 @@ else

echo -e "Moving 'identities' headers.\n"
mv ${SRC_IDENTITIES_DIR}/address.h ${INCLUDE_IDENTITIES_DIR}
mv ${SRC_IDENTITIES_DIR}/mnemonic.h ${INCLUDE_IDENTITIES_DIR}
mv ${SRC_IDENTITIES_DIR}/privatekey.h ${INCLUDE_IDENTITIES_DIR}
mv ${SRC_IDENTITIES_DIR}/publickey.h ${INCLUDE_IDENTITIES_DIR}
mv ${SRC_IDENTITIES_DIR}/wif.h ${INCLUDE_IDENTITIES_DIR}
Expand All @@ -213,18 +202,9 @@ else
mv ${SRC_TRANSACTIONS_DIR}/serializer.h ${INCLUDE_TRANSACTIONS_DIR}
mv ${SRC_TRANSACTIONS_DIR}/transaction.h ${INCLUDE_TRANSACTIONS_DIR}

## 'bip39' library is not supported in Arduino
echo -e "Restoring 'mnemonic.h'.\n"
rm -rf ${SRC_IDENTITIES_DIR}/mnemonic.h
rm -rf ${SRC_IDENTITIES_DIR}/mnemonic.cpp
mv ${EXTRAS_IDENTITIES_DIR}/mnemonic.h ${INCLUDE_IDENTITIES_DIR}
mv ${EXTRAS_IDENTITIES_DIR}/mnemonic.cpp ${SRC_IDENTITIES_DIR}
rm -rf ${EXTRAS_IDENTITIES_DIR}/mnemonic.cpp

echo -e "Restoring the 'lib' directory.\n"
mkdir ${SRC_LIB_DIR}
mv ${EXTRAS_BACKUP_DIR}/ArduinoJson ${SRC_LIB_DIR}
mv ${EXTRAS_BACKUP_DIR}/bip39 ${SRC_LIB_DIR}
mv ${EXTRAS_BACKUP_DIR}/uECC ${SRC_LIB_DIR}
mv ${SRC_DIR}/bcl ${SRC_LIB_DIR}
mv ${SRC_DIR}/date ${SRC_LIB_DIR}
Expand Down
1 change: 0 additions & 1 deletion keywords.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ Fees KEYWORD1
Types KEYWORD1

Address KEYWORD1
Mnemonic KEYWORD1
PrivateKey KEYWORD1
PublicKey KEYWORD1
WIF KEYWORD1
Expand Down
5 changes: 1 addition & 4 deletions library.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"type": "git",
"url": "https://github.com/ArkEcosystem/Cpp-Crypto.git"
},
"version": "0.4.0",
"version": "0.5.0",
"authors": [
{
"name": "Ark Ecosystem",
Expand All @@ -21,9 +21,6 @@
{
"name": "micro-ecc"
},
{
"name": "bip39"
},
{
"name": "ArduinoJson"
}
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=Ark-Cpp-Crypto
version=0.4.0
version=0.5.0
author=Ark Ecosystem
maintainer=Ark Ecosystem
sentence=A simple Cryptography Implementation in C++ for the ARK Blockchain.
Expand Down
2 changes: 1 addition & 1 deletion platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ description = "A simple Cryptography Implementation in C++ for the ARK Blockchai
lib_ldf_mode = off
lib_deps = micro-ecc, bip39@^1.1, ArduinoJson@6.10.0, BIP66
build_flags = -I./src/ -I./src/lib -I./src/include/cpp-crypto
src_filter = +<*> -<.git/> -<examples/> -<lib/ArduinoJson> -<lib/bip39> -<lib/uECC> -<CMakeFiles> -<lib/BIP66>
src_filter = +<*> -<.git/> -<examples/> -<lib/ArduinoJson>-<lib/uECC> -<CMakeFiles> -<lib/BIP66>
upload_speed = 921600

[env:esp8266]
Expand Down
6 changes: 0 additions & 6 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ cmake_minimum_required(VERSION 3.2.2)

project(Ark-Cpp-Crypto-lib C CXX)

add_subdirectory(lib/bip39/src)

set(BIP66_SRC
${PROJECT_SOURCE_DIR}/lib/BIP66/src/bip66.cpp
)
Expand All @@ -31,7 +29,6 @@ set(COMMON_SRC
configuration/network.cpp
helpers/crypto.cpp
identities/address.cpp
identities/mnemonic.cpp
identities/privatekey.cpp
identities/publickey.cpp
identities/wif.cpp
Expand Down Expand Up @@ -60,7 +57,6 @@ include_directories(${cpp_crypto_build_include_dirs})
include_directories(${PROJECT_SOURCE_DIR}/lib/)
include_directories(${PROJECT_SOURCE_DIR}/lib/ArduinoJson)
include_directories(${PROJECT_SOURCE_DIR}/lib/bcl)
include_directories(${PROJECT_SOURCE_DIR}/lib/bip39)
include_directories(${PROJECT_SOURCE_DIR}/lib/rfc6979)
include_directories(${PROJECT_SOURCE_DIR}/lib/uECC)
include_directories(${PROJECT_SOURCE_DIR}/lib/BIP66/src)
Expand All @@ -69,8 +65,6 @@ target_include_directories( ${PROJECT_NAME}
PUBLIC ${cpp_crypto_build_include_dirs}
)

target_link_libraries(${PROJECT_NAME} PRIVATE bip39)

if (MSVC)
target_link_libraries(${PROJECT_NAME} PUBLIC crypt32)
endif()
43 changes: 0 additions & 43 deletions src/identities/mnemonic.cpp

This file was deleted.

1 change: 0 additions & 1 deletion src/include/cpp-crypto/arkCrypto.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
#include "enums/types.h"

#include "identities/address.h"
#include "identities/mnemonic.h"
#include "identities/privatekey.h"
#include "identities/publickey.h"
#include "identities/wif.h"
Expand Down
30 changes: 0 additions & 30 deletions src/include/cpp-crypto/identities/mnemonic.h

This file was deleted.

1 change: 0 additions & 1 deletion src/lib/bip39
Submodule bip39 deleted from ea4224
1 change: 0 additions & 1 deletion test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ set (TEST_SRC
${PROJECT_SOURCE_DIR}/enums/fees.cpp
${PROJECT_SOURCE_DIR}/enums/types.cpp
${PROJECT_SOURCE_DIR}/identities/address.cpp
${PROJECT_SOURCE_DIR}/identities/mnemonic.cpp
${PROJECT_SOURCE_DIR}/identities/privatekey.cpp
${PROJECT_SOURCE_DIR}/identities/publickey.cpp
${PROJECT_SOURCE_DIR}/identities/wif.cpp
Expand Down
Loading

0 comments on commit 8396209

Please sign in to comment.