-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix: Update PIO manifest Updated PIO manifest with dependencies and additional include directories. * feat: Add PIO example * chore: Rename extras to examples. * chore: update to new examples path * chore: Clean up non-existent directory references * chore: update examples Renamed PIO example to INO extension. Added explicit examples path to manifest. * fix: Update script with new examples path
- Loading branch information
1 parent
b0cc3aa
commit 54969a3
Showing
16 changed files
with
220 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
Submodule cpp-crypto
added at
5ad957
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
; PlatformIO Project Configuration File | ||
; | ||
; Build options: build flags, source filter | ||
; Upload options: custom upload port, speed and extra flags | ||
; Library options: dependencies, extra library storages | ||
; Advanced options: extra scripting | ||
; | ||
; Please visit documentation for the other options and examples | ||
; http://docs.platformio.org/page/projectconf.html | ||
|
||
|
||
[platformio] | ||
|
||
[env:esp8266] | ||
lib_deps = Ark-Cpp-Crypto | ||
platform = espressif8266 | ||
board = huzzah | ||
framework = arduino | ||
upload_speed = 921600 | ||
|
||
[env:esp32] | ||
lib_deps = Ark-Cpp-Crypto | ||
platform = espressif32 | ||
board = esp32dev | ||
framework = arduino | ||
upload_speed = 921600 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
#include "arkCrypto.h" | ||
|
||
#include <string> | ||
#include <vector> | ||
#include <cstdint> | ||
|
||
#include <arduino.h> | ||
|
||
void setup() { | ||
Serial.begin(115200); | ||
|
||
while (!Serial) { delay(100); }; | ||
// ^for the Arduino Leonardo/Micro only | ||
} | ||
|
||
void loop() { | ||
const auto text = "Computer science is no more about computers than astronomy is about telescopes."; | ||
const auto passphrase = "viable weasel wage promote praise inflict jaguar tackle color unusual exclude direct"; | ||
|
||
// Message - sign | ||
Ark::Crypto::Utils::Message message; | ||
message.sign(text, passphrase); | ||
|
||
Serial.println("Message"); | ||
Serial.print("\tText: "); Serial.print(text); Serial.println(); | ||
Serial.print("\tPassphrase: "); Serial.print(passphrase); Serial.println(); | ||
Serial.print("\tJson: "); Serial.print(message.toJson().c_str()); Serial.println(); | ||
Serial.println(); | ||
|
||
// Message - verify | ||
auto publicKey = PublicKey::fromHex("0275776018638e5c40f1b922901e96cac2caa734585ef302b4a2801ee9a338a456"); | ||
auto signature = HexToBytes("3044022021704f2adb2e4a10a3ddc1d7d64552b8061c05f6d12a168c69091c75581d611402200edf37689d2786fc690af9f0f6fa1f629c95695039f648a6d455484302402e93"); | ||
|
||
message = Ark::Crypto::Utils::Message( | ||
text, | ||
publicKey, | ||
signature | ||
); | ||
|
||
Serial.println("Message"); | ||
Serial.print("\tJson: "); Serial.print(message.toJson().c_str()); Serial.println(); | ||
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); | ||
Serial.println("Address from passphrase"); | ||
Serial.print("\tPassphrase: "); Serial.print(passphrase); Serial.println(); | ||
Serial.print("\tNetwork Version: 0x"); Serial.print(static_cast<uint16_t>(networkVersion)); Serial.println(); | ||
Serial.print("\tAddress: "); Serial.print(address.toString().c_str()); Serial.println(); | ||
Serial.println(); | ||
|
||
// Address - from publickey | ||
publicKey = PublicKey("029fdf41a7d69d8efc7b236c21b9509a23d862ea4ed8b13a56e31eee58dbfd97b4"); | ||
address = Address::fromPublicKey(publicKey, networkVersion); | ||
Serial.println("Address from public key"); | ||
Serial.print("\tPublic Key: "); Serial.print(publicKey.toString().c_str()); Serial.println(); | ||
Serial.print("\tAddress: "); Serial.print(address.toString().c_str()); Serial.println(); | ||
Serial.println(); | ||
|
||
// Address - from privatekey | ||
PrivateKey privateKey("950981ce17df662dbc1d25305f8597a71309fb8f7232203a0944477e2534b021"); | ||
address = Address::fromPrivateKey(privateKey, networkVersion); | ||
Serial.println("Address from private key"); | ||
Serial.print("\tPrivate Key: "); Serial.print(privateKey.toString().c_str()); Serial.println(); | ||
Serial.print("\tAddress: "); Serial.print(address.toString().c_str()); Serial.println(); | ||
Serial.println(); | ||
|
||
// Address - validate | ||
address = Address("DStZXkgpEjxbG355nQ26vnkp95p24U9tsV"); | ||
auto isValidAddress = Address::validate(address, networkVersion); | ||
Serial.println("Valid Address"); | ||
Serial.print("\tAddress: "); Serial.print(address.toString().c_str()); Serial.println(); | ||
Serial.print("\t Valid Address: "); Serial.print(isValidAddress); Serial.println(); | ||
Serial.println(); | ||
|
||
// Private Key - from passphrase | ||
privateKey = PrivateKey::fromPassphrase(passphrase); | ||
Serial.println("Private Key from passprase"); | ||
Serial.print("\tPassphrase: "); Serial.print(passphrase); Serial.println(); | ||
Serial.print("\tPrivate Key: "); Serial.print(privateKey.toString().c_str()); Serial.println(); | ||
Serial.println(); | ||
|
||
// Private Key - object from hex | ||
privateKey = PrivateKey::fromHex("950981ce17df662dbc1d25305f8597a71309fb8f7232203a0944477e2534b021"); | ||
Serial.println("Private Key from hex"); | ||
Serial.println("\tHex: 950981ce17df662dbc1d25305f8597a71309fb8f7232203a0944477e2534b021"); | ||
Serial.print("\tPrivate Key: "); Serial.print(privateKey.toString().c_str()); Serial.println(); | ||
Serial.println(); | ||
|
||
// Public Key - from passphrase | ||
publicKey = PublicKey::fromPassphrase(passphrase); | ||
Serial.println("Public Key from passprase"); | ||
Serial.print("\tPassphrase: "); Serial.print(passphrase); Serial.println(); | ||
Serial.print("\tPublic Key: "); Serial.print(publicKey.toString().c_str()); Serial.println(); | ||
Serial.println(); | ||
|
||
// Public Key - object from hex | ||
publicKey = PublicKey::fromHex("029fdf41a7d69d8efc7b236c21b9509a23d862ea4ed8b13a56e31eee58dbfd97b4"); | ||
Serial.println("Public Key from hex"); | ||
Serial.println("\tHex: 029fdf41a7d69d8efc7b236c21b9509a23d862ea4ed8b13a56e31eee58dbfd97b4"); | ||
Serial.print("\tPublic Key: "); Serial.print(publicKey.toString().c_str()); Serial.println(); | ||
Serial.println(); | ||
|
||
// WIF - from passphrase | ||
const uint8_t wifByte = 0xaa; | ||
auto wif = WIF::fromPassphrase(passphrase, wifByte); | ||
Serial.println("WIF from passphrase"); | ||
Serial.print("\tPassphrase: "); Serial.print(passphrase); Serial.println(); | ||
Serial.print("\tWIF Byte: "); Serial.print(static_cast<uint16_t>(wifByte)); Serial.println(); | ||
Serial.print("\tWIF: "); Serial.print(wif.toString().c_str()); Serial.println(); | ||
|
||
} |
Submodule cpp-crypto
deleted from
8d0c6c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,51 @@ | ||
{ | ||
"name": "Ark-Cpp-Crypto", | ||
"keywords": "ark ecosystem, crypto, blockchain, arduino", | ||
"description": "Cpp Wrapper for the Ark Ecosystem", | ||
"homepage": "https://github.com/ArkEcosystem/Cpp-Crypto", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/ArkEcosystem/Cpp-Crypto.git" | ||
"name": "Ark-Cpp-Crypto", | ||
"keywords": "ark ecosystem, crypto, blockchain, arduino", | ||
"description": "Cpp Wrapper for the Ark Ecosystem", | ||
"homepage": "https://github.com/ArkEcosystem/Cpp-Crypto", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/ArkEcosystem/Cpp-Crypto.git" | ||
}, | ||
"version": "0.1.0", | ||
"authors": [ | ||
{ | ||
"name": "Simon Downey", | ||
"email": "simon@ark.io", | ||
"url": "https://github.com/sleepdefic1t" | ||
}, | ||
"version": "0.1.0", | ||
"authors": [ | ||
{ | ||
"name": "Simon Downey", | ||
"email": "simon@ark.io", | ||
"url": "https://github.com/sleepdefic1t" | ||
}, | ||
{ | ||
"name": "Chris Johnson", | ||
"url": "https://github.com/ciband" | ||
}, | ||
{ | ||
"name": "supaiku0", | ||
"url": "https://github.com/supaiku0" | ||
} | ||
], | ||
"frameworks": "arduino", | ||
"platforms": "*" | ||
{ | ||
"name": "Chris Johnson", | ||
"url": "https://github.com/ciband" | ||
}, | ||
{ | ||
"name": "supaiku0", | ||
"url": "https://github.com/supaiku0" | ||
} | ||
], | ||
"frameworks": "arduino", | ||
"platforms": "*", | ||
"dependencies": [ | ||
{ | ||
"name": "micro-ecc" | ||
}, | ||
{ | ||
"name": "bip39" | ||
} | ||
], | ||
"export": { | ||
"include": [ | ||
"src/*" | ||
] | ||
}, | ||
"build": { | ||
"flags": [ | ||
"-I src/include/cpp-crypto" | ||
] | ||
}, | ||
"examples": [ | ||
"[Ee]xamples/platformio_example/*.ino", | ||
"[Ee]xamples/platformio_example/*.cpp", | ||
"[Ee]xamples/platformio_example/*.c" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule bip39
updated
6 files
+0 −4 | .codecov.yml | |
+3 −0 | .gitmodules | |
+0 −1 | README.md | |
+4 −9 | library.json | |
+1 −0 | src/lib/PicoSHA2 | |
+0 −377 | src/lib/PicoSHA2/picosha2.h |
Submodule googletest
updated
6 files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters