@onekeyfe/react-native-lite-card 6.7.0-4 → 6.7.0-40
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -2
- package/ReactNativeLiteCard.podspec +31 -2
- package/android/build.gradle +8 -0
- package/android/consumer-rules.pro +4 -0
- package/android/src/main/cpp/CMakeLists.txt +6 -2
- package/android/src/main/java/com/onekeyfe/reactnativelitecard/ReactNativeLiteCardModule.kt +60 -49
- package/android/src/main/java/com/onekeyfe/reactnativelitecard/nfc/gpchannel/GPChannelNatives.kt +7 -7
- package/android/src/main/java/com/onekeyfe/reactnativelitecard/onekeyLite/OnekeyLiteCard.kt +117 -39
- package/android/src/main/java/com/onekeyfe/reactnativelitecard/onekeyLite/entitys/SendResponse.kt +6 -3
- package/android/src/main/java/com/onekeyfe/reactnativelitecard/onekeyLite/nfc/CommandGenerator.kt +24 -2
- package/android/src/main/java/com/onekeyfe/reactnativelitecard/onekeyLite/nfc/Connection.kt +46 -19
- package/android/src/main/java/com/onekeyfe/reactnativelitecard/onekeyLite/nfc/GPCAPDUGenerator.kt +2 -2
- package/ios/Classes/OKLiteCommand/OKLiteCommandTool.m +38 -1
- package/ios/Classes/OKNFCBridge.mm +24 -1
- package/ios/Classes/OKNFTLite/OKLiteV1.m +20 -10
- package/ios/Classes/OKNFTLite/OKLiteV2.m +13 -5
- package/ios/Classes/OKNFTLite/OKNFCManager.h +2 -2
- package/ios/Classes/OKNFTLite/OKNFCManager.m +110 -18
- package/ios/ReactNativeLiteCard.mm +23 -11
- package/lib/module/index.js +4 -4
- package/lib/typescript/src/NativeReactNativeLiteCard.d.ts +4 -4
- package/lib/typescript/src/index.d.ts +2 -2
- package/package.json +8 -8
- package/sdk/CMakeLists.txt +121 -0
- package/sdk/README.md +190 -0
- package/sdk/android/implJni.cpp +216 -0
- package/sdk/deps/jsoncpp/LICENSE +55 -0
- package/sdk/deps/jsoncpp/include/CMakeLists.txt +2 -0
- package/sdk/deps/jsoncpp/include/json/allocator.h +98 -0
- package/sdk/deps/jsoncpp/include/json/assertions.h +54 -0
- package/sdk/deps/jsoncpp/include/json/autolink.h +25 -0
- package/sdk/deps/jsoncpp/include/json/config.h +187 -0
- package/sdk/deps/jsoncpp/include/json/features.h +61 -0
- package/sdk/deps/jsoncpp/include/json/forwards.h +37 -0
- package/sdk/deps/jsoncpp/include/json/json.h +15 -0
- package/sdk/deps/jsoncpp/include/json/reader.h +411 -0
- package/sdk/deps/jsoncpp/include/json/value.h +888 -0
- package/sdk/deps/jsoncpp/include/json/version.h +20 -0
- package/sdk/deps/jsoncpp/include/json/writer.h +357 -0
- package/sdk/deps/jsoncpp/src/lib_json/CMakeLists.txt +117 -0
- package/sdk/deps/jsoncpp/src/lib_json/json_reader.cpp +2060 -0
- package/sdk/deps/jsoncpp/src/lib_json/json_tool.h +114 -0
- package/sdk/deps/jsoncpp/src/lib_json/json_value.cpp +1661 -0
- package/sdk/deps/jsoncpp/src/lib_json/json_valueiterator.inl +167 -0
- package/sdk/deps/jsoncpp/src/lib_json/json_writer.cpp +1233 -0
- package/sdk/deps/jsoncpp/src/lib_json/version.h.in +20 -0
- package/sdk/deps/trezor-crypto/AUTHORS +2 -0
- package/sdk/deps/trezor-crypto/LICENSE +22 -0
- package/sdk/deps/trezor-crypto/include/TrezorCrypto/TrezorCrypto.h +29 -0
- package/sdk/deps/trezor-crypto/include/TrezorCrypto/address.h +44 -0
- package/sdk/deps/trezor-crypto/include/TrezorCrypto/aes.h +224 -0
- package/sdk/deps/trezor-crypto/include/TrezorCrypto/base32.h +49 -0
- package/sdk/deps/trezor-crypto/include/TrezorCrypto/base58.h +58 -0
- package/sdk/deps/trezor-crypto/include/TrezorCrypto/bignum.h +169 -0
- package/sdk/deps/trezor-crypto/include/TrezorCrypto/bip32.h +114 -0
- package/sdk/deps/trezor-crypto/include/TrezorCrypto/bip39.h +66 -0
- package/sdk/deps/trezor-crypto/include/TrezorCrypto/blake256.h +61 -0
- package/sdk/deps/trezor-crypto/include/TrezorCrypto/blake2b.h +50 -0
- package/sdk/deps/trezor-crypto/include/TrezorCrypto/blake2s.h +49 -0
- package/sdk/deps/trezor-crypto/include/TrezorCrypto/cash_addr.h +109 -0
- package/sdk/deps/trezor-crypto/include/TrezorCrypto/chacha20poly1305/ecrypt-config.h +316 -0
- package/sdk/deps/trezor-crypto/include/TrezorCrypto/chacha20poly1305/ecrypt-sync.h +289 -0
- package/sdk/deps/trezor-crypto/include/TrezorCrypto/chacha20poly1305/ecrypt-types.h +53 -0
- package/sdk/deps/trezor-crypto/include/TrezorCrypto/chacha20poly1305/poly1305-donna.h +28 -0
- package/sdk/deps/trezor-crypto/include/TrezorCrypto/chacha20poly1305.h +27 -0
- package/sdk/deps/trezor-crypto/include/TrezorCrypto/cmac.h +44 -0
- package/sdk/deps/trezor-crypto/include/TrezorCrypto/curves.h +60 -0
- package/sdk/deps/trezor-crypto/include/TrezorCrypto/ecdsa.h +112 -0
- package/sdk/deps/trezor-crypto/include/TrezorCrypto/ed25519-donna/curve25519-donna-32bit.h +87 -0
- package/sdk/deps/trezor-crypto/include/TrezorCrypto/ed25519-donna/curve25519-donna-helpers.h +30 -0
- package/sdk/deps/trezor-crypto/include/TrezorCrypto/ed25519-donna/ed25519-blake2b.h +21 -0
- package/sdk/deps/trezor-crypto/include/TrezorCrypto/ed25519-donna/ed25519-donna-32bit-tables.h +25 -0
- package/sdk/deps/trezor-crypto/include/TrezorCrypto/ed25519-donna/ed25519-donna-basepoint-table.h +10 -0
- package/sdk/deps/trezor-crypto/include/TrezorCrypto/ed25519-donna/ed25519-donna-impl-base.h +110 -0
- package/sdk/deps/trezor-crypto/include/TrezorCrypto/ed25519-donna/ed25519-donna-portable.h +32 -0
- package/sdk/deps/trezor-crypto/include/TrezorCrypto/ed25519-donna/ed25519-donna.h +60 -0
- package/sdk/deps/trezor-crypto/include/TrezorCrypto/ed25519-donna/ed25519-keccak.h +21 -0
- package/sdk/deps/trezor-crypto/include/TrezorCrypto/ed25519-donna/ed25519-sha3.h +21 -0
- package/sdk/deps/trezor-crypto/include/TrezorCrypto/ed25519-donna/modm-donna-32bit.h +87 -0
- package/sdk/deps/trezor-crypto/include/TrezorCrypto/ed25519-donna.h +60 -0
- package/sdk/deps/trezor-crypto/include/TrezorCrypto/ed25519.h +42 -0
- package/sdk/deps/trezor-crypto/include/TrezorCrypto/endian.h +132 -0
- package/sdk/deps/trezor-crypto/include/TrezorCrypto/groestl.h +104 -0
- package/sdk/deps/trezor-crypto/include/TrezorCrypto/hasher.h +90 -0
- package/sdk/deps/trezor-crypto/include/TrezorCrypto/hmac.h +60 -0
- package/sdk/deps/trezor-crypto/include/TrezorCrypto/memzero.h +16 -0
- package/sdk/deps/trezor-crypto/include/TrezorCrypto/monero/base58.h +42 -0
- package/sdk/deps/trezor-crypto/include/TrezorCrypto/monero/monero.h +13 -0
- package/sdk/deps/trezor-crypto/include/TrezorCrypto/monero/range_proof.h +30 -0
- package/sdk/deps/trezor-crypto/include/TrezorCrypto/monero/serialize.h +15 -0
- package/sdk/deps/trezor-crypto/include/TrezorCrypto/monero/xmr.h +67 -0
- package/sdk/deps/trezor-crypto/include/TrezorCrypto/nano.h +56 -0
- package/sdk/deps/trezor-crypto/include/TrezorCrypto/nem.h +199 -0
- package/sdk/deps/trezor-crypto/include/TrezorCrypto/nist256p1.h +35 -0
- package/sdk/deps/trezor-crypto/include/TrezorCrypto/pbkdf2.h +64 -0
- package/sdk/deps/trezor-crypto/include/TrezorCrypto/rand.h +44 -0
- package/sdk/deps/trezor-crypto/include/TrezorCrypto/rc4.h +37 -0
- package/sdk/deps/trezor-crypto/include/TrezorCrypto/rfc6979.h +40 -0
- package/sdk/deps/trezor-crypto/include/TrezorCrypto/ripemd160.h +28 -0
- package/sdk/deps/trezor-crypto/include/TrezorCrypto/ripple/base58.h +45 -0
- package/sdk/deps/trezor-crypto/include/TrezorCrypto/schnorr.h +48 -0
- package/sdk/deps/trezor-crypto/include/TrezorCrypto/script.h +30 -0
- package/sdk/deps/trezor-crypto/include/TrezorCrypto/scrypt.h +68 -0
- package/sdk/deps/trezor-crypto/include/TrezorCrypto/secp256k1.h +59 -0
- package/sdk/deps/trezor-crypto/include/TrezorCrypto/sha2.h +125 -0
- package/sdk/deps/trezor-crypto/include/TrezorCrypto/sha3.h +86 -0
- package/sdk/deps/trezor-crypto/include/TrezorCrypto/sodium/keypair.h +20 -0
- package/sdk/deps/trezor-crypto/include/TrezorCrypto/sodium/private/ed25519_ref10.h +85 -0
- package/sdk/deps/trezor-crypto/include/TrezorCrypto/sodium/private/ed25519_ref10_fe_25_5.h +43 -0
- package/sdk/deps/trezor-crypto/include/TrezorCrypto/sodium/private/fe_25_5/constants.h +29 -0
- package/sdk/deps/trezor-crypto/include/TrezorCrypto/sodium/private/fe_25_5/fe.h +25 -0
- package/sdk/deps/trezor-crypto/src/address.c +87 -0
- package/sdk/deps/trezor-crypto/src/aes/aes_modes.c +959 -0
- package/sdk/deps/trezor-crypto/src/aes/aescrypt.c +307 -0
- package/sdk/deps/trezor-crypto/src/aes/aeskey.c +560 -0
- package/sdk/deps/trezor-crypto/src/aes/aesopt.h +784 -0
- package/sdk/deps/trezor-crypto/src/aes/aestab.c +418 -0
- package/sdk/deps/trezor-crypto/src/aes/aestab.h +173 -0
- package/sdk/deps/trezor-crypto/src/base32.c +233 -0
- package/sdk/deps/trezor-crypto/src/base58.c +298 -0
- package/sdk/deps/trezor-crypto/src/bignum.c +808 -0
- package/sdk/deps/trezor-crypto/src/bip32.c +852 -0
- package/sdk/deps/trezor-crypto/src/bip39.c +266 -0
- package/sdk/deps/trezor-crypto/src/bip39_english.h +2074 -0
- package/sdk/deps/trezor-crypto/src/blake256.c +235 -0
- package/sdk/deps/trezor-crypto/src/blake2_common.h +39 -0
- package/sdk/deps/trezor-crypto/src/blake2b.c +333 -0
- package/sdk/deps/trezor-crypto/src/blake2s.c +318 -0
- package/sdk/deps/trezor-crypto/src/cash_addr.c +195 -0
- package/sdk/deps/trezor-crypto/src/chacha20poly1305/chacha20poly1305.c +60 -0
- package/sdk/deps/trezor-crypto/src/chacha20poly1305/chacha_merged.c +246 -0
- package/sdk/deps/trezor-crypto/src/chacha20poly1305/ecrypt-machine.h +49 -0
- package/sdk/deps/trezor-crypto/src/chacha20poly1305/ecrypt-portable.h +275 -0
- package/sdk/deps/trezor-crypto/src/chacha20poly1305/poly1305-donna-32.h +219 -0
- package/sdk/deps/trezor-crypto/src/chacha20poly1305/poly1305-donna.c +179 -0
- package/sdk/deps/trezor-crypto/src/chacha20poly1305/rfc7539.c +48 -0
- package/sdk/deps/trezor-crypto/src/chacha20poly1305/rfc7539.h +10 -0
- package/sdk/deps/trezor-crypto/src/check_mem.h +30 -0
- package/sdk/deps/trezor-crypto/src/cmac.c +342 -0
- package/sdk/deps/trezor-crypto/src/curves.c +48 -0
- package/sdk/deps/trezor-crypto/src/ecdsa.c +1355 -0
- package/sdk/deps/trezor-crypto/src/ed25519-donna/README.md +183 -0
- package/sdk/deps/trezor-crypto/src/ed25519-donna/curve25519-donna-32bit.c +681 -0
- package/sdk/deps/trezor-crypto/src/ed25519-donna/curve25519-donna-helpers.c +66 -0
- package/sdk/deps/trezor-crypto/src/ed25519-donna/curve25519-donna-scalarmult-base.c +67 -0
- package/sdk/deps/trezor-crypto/src/ed25519-donna/curve25519-donna-scalarmult-base.h +8 -0
- package/sdk/deps/trezor-crypto/src/ed25519-donna/ed25519-blake2b.c +8 -0
- package/sdk/deps/trezor-crypto/src/ed25519-donna/ed25519-donna-32bit-tables.c +63 -0
- package/sdk/deps/trezor-crypto/src/ed25519-donna/ed25519-donna-basepoint-table.c +261 -0
- package/sdk/deps/trezor-crypto/src/ed25519-donna/ed25519-donna-impl-base.c +722 -0
- package/sdk/deps/trezor-crypto/src/ed25519-donna/ed25519-hash-custom-blake2b.h +23 -0
- package/sdk/deps/trezor-crypto/src/ed25519-donna/ed25519-hash-custom-keccak.h +23 -0
- package/sdk/deps/trezor-crypto/src/ed25519-donna/ed25519-hash-custom-sha3.h +23 -0
- package/sdk/deps/trezor-crypto/src/ed25519-donna/ed25519-hash-custom.h +23 -0
- package/sdk/deps/trezor-crypto/src/ed25519-donna/ed25519-keccak.c +8 -0
- package/sdk/deps/trezor-crypto/src/ed25519-donna/ed25519-sha3.c +8 -0
- package/sdk/deps/trezor-crypto/src/ed25519-donna/ed25519.c +311 -0
- package/sdk/deps/trezor-crypto/src/ed25519-donna/modm-donna-32bit.c +517 -0
- package/sdk/deps/trezor-crypto/src/groestl.c +783 -0
- package/sdk/deps/trezor-crypto/src/groestl_internal.h +419 -0
- package/sdk/deps/trezor-crypto/src/hasher.c +186 -0
- package/sdk/deps/trezor-crypto/src/hmac.c +179 -0
- package/sdk/deps/trezor-crypto/src/memzero.c +6 -0
- package/sdk/deps/trezor-crypto/src/monero/base58.c +245 -0
- package/sdk/deps/trezor-crypto/src/monero/int-util.h +77 -0
- package/sdk/deps/trezor-crypto/src/monero/range_proof.c +115 -0
- package/sdk/deps/trezor-crypto/src/monero/serialize.c +54 -0
- package/sdk/deps/trezor-crypto/src/monero/xmr.c +136 -0
- package/sdk/deps/trezor-crypto/src/nano.c +151 -0
- package/sdk/deps/trezor-crypto/src/nem.c +569 -0
- package/sdk/deps/trezor-crypto/src/nist256p1.c +63 -0
- package/sdk/deps/trezor-crypto/src/nist256p1.table +1664 -0
- package/sdk/deps/trezor-crypto/src/options.h +43 -0
- package/sdk/deps/trezor-crypto/src/pbkdf2.c +177 -0
- package/sdk/deps/trezor-crypto/src/rand.c +51 -0
- package/sdk/deps/trezor-crypto/src/rc4.c +56 -0
- package/sdk/deps/trezor-crypto/src/ripemd160.c +343 -0
- package/sdk/deps/trezor-crypto/src/ripple/base58.c +76 -0
- package/sdk/deps/trezor-crypto/src/schnorr.c +208 -0
- package/sdk/deps/trezor-crypto/src/script.c +64 -0
- package/sdk/deps/trezor-crypto/src/scrypt.c +343 -0
- package/sdk/deps/trezor-crypto/src/secp256k1.c +160 -0
- package/sdk/deps/trezor-crypto/src/secp256k1.table +1664 -0
- package/sdk/deps/trezor-crypto/src/setup.py +38 -0
- package/sdk/deps/trezor-crypto/src/sha2.c +1314 -0
- package/sdk/deps/trezor-crypto/src/sha3.c +395 -0
- package/sdk/deps/trezor-crypto/src/shell.nix +6 -0
- package/sdk/deps/trezor-crypto/src/sodium/keypair.c +63 -0
- package/sdk/deps/trezor-crypto/src/sodium/private/ed25519_ref10.c +481 -0
- package/sdk/deps/trezor-crypto/src/sodium/private/ed25519_ref10_fe_25_5.c +885 -0
- package/sdk/deps/trezor-crypto/src/sodium/private/fe_25_5/fe.c +237 -0
- package/sdk/gpc/include/scp03/scp03.hpp +80 -0
- package/sdk/gpc/include/scp11/scp11.hpp +492 -0
- package/sdk/gpc/include/scp11/scp11c.hpp +58 -0
- package/sdk/gpc/include/tag.h +68 -0
- package/sdk/gpc/include/tlv.hpp +94 -0
- package/sdk/gpc/include/tlvparse.hpp +24 -0
- package/sdk/gpc/src/scp03.cpp +243 -0
- package/sdk/gpc/src/scp11.cpp +798 -0
- package/sdk/gpc/src/scp11c.cpp +136 -0
- package/sdk/gpc/src/tlv.cpp +159 -0
- package/sdk/gpc/src/tlvparse.c +174 -0
- package/{framework/GPChannelSDKCore.xcframework/ios-arm64/GPChannelSDKCore.framework/Headers → sdk/include}/GPChannelSDK.h +0 -0
- package/sdk/include/GPChannelSDKCore.h +10 -0
- package/sdk/include/context/BaseContext.h +56 -0
- package/sdk/include/device/ApduBuilder.hpp +72 -0
- package/sdk/include/mSIGNA/stdutils/uchar_vector.h +36 -0
- package/sdk/include/utility/Apdu.hpp +172 -0
- package/sdk/include/utility/Debug.hpp +3 -0
- package/sdk/include/utility/util.h +104 -0
- package/sdk/scripts/generate-source-id.rb +22 -0
- package/sdk/source-id-manifest.txt +19 -0
- package/sdk/source-id.cmake +31 -0
- package/sdk/src/ApduBuilder.cpp +332 -0
- package/sdk/src/GPChannelSDK.cpp +258 -0
- package/sdk/src/random.c +25 -0
- package/sdk/src/version.c +3 -0
- package/sdk/tests/android/GPChannelProxy.java +55 -0
- package/sdk/tests/android_verify.py +124 -0
- package/sdk/tests/safety.cpp +757 -0
- package/sdk/tests/verify.py +284 -0
- package/src/NativeReactNativeLiteCard.ts +4 -2
- package/src/index.tsx +14 -3
- package/android/src/main/jniLibs/arm64-v8a/libgpchannelNDK.so +0 -0
- package/android/src/main/jniLibs/armeabi-v7a/libgpchannelNDK.so +0 -0
- package/framework/GPChannelSDKCore.xcframework/Info.plist +0 -52
- package/framework/GPChannelSDKCore.xcframework/ios-arm64/GPChannelSDKCore.framework/GPChannelSDKCore +0 -0
- package/framework/GPChannelSDKCore.xcframework/ios-arm64/GPChannelSDKCore.framework/Headers/GPChannelSDKCore.h +0 -19
- package/framework/GPChannelSDKCore.xcframework/ios-arm64/GPChannelSDKCore.framework/Info.plist +0 -0
- package/framework/GPChannelSDKCore.xcframework/ios-arm64/GPChannelSDKCore.framework/Modules/module.modulemap +0 -7
- package/framework/GPChannelSDKCore.xcframework/ios-arm64/GPChannelSDKCore.framework/_CodeSignature/CodeResources +0 -147
- package/framework/GPChannelSDKCore.xcframework/ios-arm64_x86_64-simulator/GPChannelSDKCore.framework/GPChannelSDKCore +0 -0
- package/framework/GPChannelSDKCore.xcframework/ios-arm64_x86_64-simulator/GPChannelSDKCore.framework/Headers/GPChannelSDK.h +0 -315
- package/framework/GPChannelSDKCore.xcframework/ios-arm64_x86_64-simulator/GPChannelSDKCore.framework/Headers/GPChannelSDKCore.h +0 -19
- package/framework/GPChannelSDKCore.xcframework/ios-arm64_x86_64-simulator/GPChannelSDKCore.framework/Info.plist +0 -0
- package/framework/GPChannelSDKCore.xcframework/ios-arm64_x86_64-simulator/GPChannelSDKCore.framework/Modules/module.modulemap +0 -7
- package/framework/GPChannelSDKCore.xcframework/ios-arm64_x86_64-simulator/GPChannelSDKCore.framework/_CodeSignature/CodeResources +0 -147
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2013-2014 Tomas Dzetkulic
|
|
3
|
+
* Copyright (c) 2013-2014 Pavol Rusnak
|
|
4
|
+
*
|
|
5
|
+
* Permission is hereby granted, free of charge, to any person obtaining
|
|
6
|
+
* a copy of this software and associated documentation files (the "Software"),
|
|
7
|
+
* to deal in the Software without restriction, including without limitation
|
|
8
|
+
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
9
|
+
* and/or sell copies of the Software, and to permit persons to whom the
|
|
10
|
+
* Software is furnished to do so, subject to the following conditions:
|
|
11
|
+
*
|
|
12
|
+
* The above copyright notice and this permission notice shall be included
|
|
13
|
+
* in all copies or substantial portions of the Software.
|
|
14
|
+
*
|
|
15
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
16
|
+
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
18
|
+
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES
|
|
19
|
+
* OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
|
20
|
+
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
21
|
+
* OTHER DEALINGS IN THE SOFTWARE.
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
#ifndef __BIP32_H__
|
|
25
|
+
#define __BIP32_H__
|
|
26
|
+
|
|
27
|
+
#include <stdint.h>
|
|
28
|
+
#include <stdlib.h>
|
|
29
|
+
#include <stdbool.h>
|
|
30
|
+
#include <TrezorCrypto/ecdsa.h>
|
|
31
|
+
#include <TrezorCrypto/ed25519.h>
|
|
32
|
+
|
|
33
|
+
#ifdef __cplusplus
|
|
34
|
+
extern "C" {
|
|
35
|
+
#endif
|
|
36
|
+
|
|
37
|
+
typedef struct {
|
|
38
|
+
const char *bip32_name; // string for generating BIP32 xprv from seed
|
|
39
|
+
const ecdsa_curve *params; // ecdsa curve parameters, null for ed25519
|
|
40
|
+
|
|
41
|
+
HasherType hasher_base58;
|
|
42
|
+
HasherType hasher_sign;
|
|
43
|
+
HasherType hasher_pubkey;
|
|
44
|
+
HasherType hasher_script;
|
|
45
|
+
} curve_info;
|
|
46
|
+
|
|
47
|
+
typedef struct {
|
|
48
|
+
uint32_t depth;
|
|
49
|
+
uint32_t child_num;
|
|
50
|
+
uint8_t chain_code[32];
|
|
51
|
+
|
|
52
|
+
uint8_t private_key[32];
|
|
53
|
+
uint8_t private_key_extension[32];
|
|
54
|
+
|
|
55
|
+
uint8_t public_key[33];
|
|
56
|
+
const curve_info *curve;
|
|
57
|
+
} HDNode;
|
|
58
|
+
|
|
59
|
+
int hdnode_from_xpub(uint32_t depth, uint32_t child_num, const uint8_t *chain_code, const uint8_t *public_key, const char *curve, HDNode *out);
|
|
60
|
+
|
|
61
|
+
int hdnode_from_xprv(uint32_t depth, uint32_t child_num, const uint8_t *chain_code, const uint8_t *private_key, const char *curve, HDNode *out);
|
|
62
|
+
|
|
63
|
+
int hdnode_from_seed(const uint8_t *seed, int seed_len, const char *curve, HDNode *out);
|
|
64
|
+
|
|
65
|
+
#define hdnode_private_ckd_prime(X, I) hdnode_private_ckd((X), ((I) | 0x80000000))
|
|
66
|
+
|
|
67
|
+
int hdnode_private_ckd(HDNode *inout, uint32_t i);
|
|
68
|
+
|
|
69
|
+
int hdnode_private_ckd_cardano(HDNode *inout, uint32_t i);
|
|
70
|
+
int hdnode_from_seed_cardano(const uint8_t *pass, int pass_len, const uint8_t *seed, int seed_len, HDNode *out);
|
|
71
|
+
|
|
72
|
+
int hdnode_public_ckd_cp(const ecdsa_curve *curve, const curve_point *parent, const uint8_t *parent_chain_code, uint32_t i, curve_point *child, uint8_t *child_chain_code);
|
|
73
|
+
|
|
74
|
+
int hdnode_public_ckd(HDNode *inout, uint32_t i);
|
|
75
|
+
|
|
76
|
+
void hdnode_public_ckd_address_optimized(const curve_point *pub, const uint8_t *chain_code, uint32_t i, uint32_t version, HasherType hasher_pubkey, HasherType hasher_base58, char *addr, int addrsize, int addrformat);
|
|
77
|
+
|
|
78
|
+
uint32_t hdnode_fingerprint(HDNode *node);
|
|
79
|
+
|
|
80
|
+
void hdnode_fill_public_key(HDNode *node);
|
|
81
|
+
|
|
82
|
+
// JuBiter-defined
|
|
83
|
+
int pubkey_get_ethereum_pubkeyhash(const uint8_t *uncompressed_pubkey, size_t uncompressed_pubkey_len, uint8_t *pubkeyhash);
|
|
84
|
+
// JuBiter-modified
|
|
85
|
+
int hdnode_get_ethereum_pubkeyhash(const HDNode *node, uint8_t *pubkeyhash);
|
|
86
|
+
// JuBiter-defined
|
|
87
|
+
int hdnode_get_tron_pubkeyhash(const HDNode *node, uint8_t *pubkeyhash);
|
|
88
|
+
|
|
89
|
+
int hdnode_get_nem_address(HDNode *node, uint8_t version, char *address);
|
|
90
|
+
int hdnode_get_nem_shared_key(const HDNode *node, const ed25519_public_key peer_public_key, const uint8_t *salt, ed25519_public_key mul, uint8_t *shared_key);
|
|
91
|
+
int hdnode_nem_encrypt(const HDNode *node, const ed25519_public_key public_key, const uint8_t *iv, const uint8_t *salt, const uint8_t *payload, size_t size, uint8_t *buffer);
|
|
92
|
+
int hdnode_nem_decrypt(const HDNode *node, const ed25519_public_key public_key, uint8_t *iv, const uint8_t *salt, const uint8_t *payload, size_t size, uint8_t *buffer);
|
|
93
|
+
|
|
94
|
+
int hdnode_sign(HDNode *node, const uint8_t *msg, uint32_t msg_len, HasherType hasher_sign, uint8_t *sig, uint8_t *pby, int (*is_canonical)(uint8_t by, uint8_t sig[64]));
|
|
95
|
+
int hdnode_sign_digest(HDNode *node, const uint8_t *digest, uint8_t *sig, uint8_t *pby, int (*is_canonical)(uint8_t by, uint8_t sig[64]));
|
|
96
|
+
|
|
97
|
+
int hdnode_get_shared_key(const HDNode *node, const uint8_t *peer_public_key, uint8_t *session_key, int *result_size);
|
|
98
|
+
|
|
99
|
+
int hdnode_serialize_public(const HDNode *node, uint32_t fingerprint, uint32_t version, char *str, int strsize);
|
|
100
|
+
|
|
101
|
+
int hdnode_serialize_private(const HDNode *node, uint32_t fingerprint, uint32_t version, char *str, int strsize);
|
|
102
|
+
|
|
103
|
+
int hdnode_deserialize(const char *str, uint32_t version_public, uint32_t version_private, const char *curve, HDNode *node, uint32_t *fingerprint);
|
|
104
|
+
|
|
105
|
+
void hdnode_get_address_raw(HDNode *node, uint32_t version, uint8_t *addr_raw);
|
|
106
|
+
void hdnode_get_address(HDNode *node, uint32_t version, char *addr, int addrsize);
|
|
107
|
+
|
|
108
|
+
const curve_info *get_curve_by_name(const char *curve_name);
|
|
109
|
+
|
|
110
|
+
#ifdef __cplusplus
|
|
111
|
+
} /* extern "C" */
|
|
112
|
+
#endif
|
|
113
|
+
|
|
114
|
+
#endif
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2013-2014 Tomas Dzetkulic
|
|
3
|
+
* Copyright (c) 2013-2014 Pavol Rusnak
|
|
4
|
+
*
|
|
5
|
+
* Permission is hereby granted, free of charge, to any person obtaining
|
|
6
|
+
* a copy of this software and associated documentation files (the "Software"),
|
|
7
|
+
* to deal in the Software without restriction, including without limitation
|
|
8
|
+
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
9
|
+
* and/or sell copies of the Software, and to permit persons to whom the
|
|
10
|
+
* Software is furnished to do so, subject to the following conditions:
|
|
11
|
+
*
|
|
12
|
+
* The above copyright notice and this permission notice shall be included
|
|
13
|
+
* in all copies or substantial portions of the Software.
|
|
14
|
+
*
|
|
15
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
16
|
+
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
18
|
+
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES
|
|
19
|
+
* OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
|
20
|
+
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
21
|
+
* OTHER DEALINGS IN THE SOFTWARE.
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
#ifndef __BIP39_H__
|
|
25
|
+
#define __BIP39_H__
|
|
26
|
+
|
|
27
|
+
#include <stdint.h>
|
|
28
|
+
|
|
29
|
+
#ifdef __cplusplus
|
|
30
|
+
extern "C" {
|
|
31
|
+
#endif
|
|
32
|
+
|
|
33
|
+
#define BIP39_PBKDF2_ROUNDS 2048
|
|
34
|
+
|
|
35
|
+
/// Generates a random mnemonic phrase with the given strength in bits.
|
|
36
|
+
///
|
|
37
|
+
/// \param strength mnemonic strength in bits. Must be a multiple of 32 between 128 and 256.
|
|
38
|
+
/// \param mnemonic [out] mnemonic phrase, must have capacity for 240 bytes.
|
|
39
|
+
/// \returns whether a mnemonic phrase was generated.
|
|
40
|
+
bool mnemonic_generate(int strength, char* mnemonic);
|
|
41
|
+
|
|
42
|
+
/// Generates a mnemonic phrase from the provided data.
|
|
43
|
+
///
|
|
44
|
+
/// \param data array of data bytes.
|
|
45
|
+
/// \param len data array size.
|
|
46
|
+
/// \param mnemonic [out] mnemonic phrase, must have capacity for 240 bytes.
|
|
47
|
+
/// \returns whether a mnemonic phrase was generated.
|
|
48
|
+
bool mnemonic_from_data(const uint8_t *data, size_t len, char* mnemonic);
|
|
49
|
+
|
|
50
|
+
int mnemonic_check(const char *mnemonic);
|
|
51
|
+
|
|
52
|
+
int mnemonic_to_entropy(const char *mnemonic, uint8_t *entropy);
|
|
53
|
+
|
|
54
|
+
// passphrase must be at most 256 characters otherwise it would be truncated
|
|
55
|
+
void mnemonic_to_seed(const char *mnemonic, const char *passphrase, uint8_t seed[512 / 8], void (*progress_callback)(uint32_t current, uint32_t total));
|
|
56
|
+
|
|
57
|
+
// passphrase must be at most 256 characters otherwise it would be truncated
|
|
58
|
+
void mnemonic_to_mini_secret(const char *mnemonic, const char *passphrase, uint8_t mini_secret[32], void (*progress_callback)(uint32_t current, uint32_t total));
|
|
59
|
+
|
|
60
|
+
const char * const *mnemonic_wordlist(void);
|
|
61
|
+
|
|
62
|
+
#ifdef __cplusplus
|
|
63
|
+
} /* extern "C" */
|
|
64
|
+
#endif
|
|
65
|
+
|
|
66
|
+
#endif
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
// Copyright (c) 2014-2017, The Monero Project
|
|
2
|
+
//
|
|
3
|
+
// All rights reserved.
|
|
4
|
+
//
|
|
5
|
+
// Redistribution and use in source and binary forms, with or without modification, are
|
|
6
|
+
// permitted provided that the following conditions are met:
|
|
7
|
+
//
|
|
8
|
+
// 1. Redistributions of source code must retain the above copyright notice, this list of
|
|
9
|
+
// conditions and the following disclaimer.
|
|
10
|
+
//
|
|
11
|
+
// 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
|
12
|
+
// of conditions and the following disclaimer in the documentation and/or other
|
|
13
|
+
// materials provided with the distribution.
|
|
14
|
+
//
|
|
15
|
+
// 3. Neither the name of the copyright holder nor the names of its contributors may be
|
|
16
|
+
// used to endorse or promote products derived from this software without specific
|
|
17
|
+
// prior written permission.
|
|
18
|
+
//
|
|
19
|
+
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
|
20
|
+
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
|
21
|
+
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
|
22
|
+
// THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
23
|
+
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
|
24
|
+
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
25
|
+
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
|
26
|
+
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
|
|
27
|
+
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
28
|
+
//
|
|
29
|
+
// Parts of this file are originally copyright (c) 2012-2013 The Cryptonote developers
|
|
30
|
+
|
|
31
|
+
#ifndef __BLAKE256_H__
|
|
32
|
+
#define __BLAKE256_H__
|
|
33
|
+
|
|
34
|
+
#include <stdint.h>
|
|
35
|
+
#include <stddef.h>
|
|
36
|
+
|
|
37
|
+
#ifdef __cplusplus
|
|
38
|
+
extern "C" {
|
|
39
|
+
#endif
|
|
40
|
+
|
|
41
|
+
#define BLAKE256_DIGEST_LENGTH 32
|
|
42
|
+
#define BLAKE256_BLOCK_LENGTH 64
|
|
43
|
+
|
|
44
|
+
typedef struct {
|
|
45
|
+
uint32_t h[8], s[4], t[2];
|
|
46
|
+
size_t buflen;
|
|
47
|
+
uint8_t nullt;
|
|
48
|
+
uint8_t buf[64];
|
|
49
|
+
} BLAKE256_CTX;
|
|
50
|
+
|
|
51
|
+
void blake256_Init(BLAKE256_CTX *);
|
|
52
|
+
void blake256_Update(BLAKE256_CTX *, const uint8_t *, size_t);
|
|
53
|
+
void blake256_Final(BLAKE256_CTX *, uint8_t *);
|
|
54
|
+
|
|
55
|
+
void blake256(const uint8_t *, size_t, uint8_t *);
|
|
56
|
+
|
|
57
|
+
#ifdef __cplusplus
|
|
58
|
+
} /* extern "C" */
|
|
59
|
+
#endif
|
|
60
|
+
|
|
61
|
+
#endif /* __BLAKE256_H__ */
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
#ifndef __BLAKE2B_H__
|
|
2
|
+
#define __BLAKE2B_H__
|
|
3
|
+
|
|
4
|
+
#include <stdint.h>
|
|
5
|
+
#include <stddef.h>
|
|
6
|
+
|
|
7
|
+
#ifdef __cplusplus
|
|
8
|
+
extern "C" {
|
|
9
|
+
#endif
|
|
10
|
+
|
|
11
|
+
enum blake2b_constant
|
|
12
|
+
{
|
|
13
|
+
BLAKE2B_BLOCKBYTES = 128,
|
|
14
|
+
BLAKE2B_OUTBYTES = 64,
|
|
15
|
+
BLAKE2B_KEYBYTES = 64,
|
|
16
|
+
BLAKE2B_SALTBYTES = 16,
|
|
17
|
+
BLAKE2B_PERSONALBYTES = 16
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
typedef struct __blake2b_state
|
|
21
|
+
{
|
|
22
|
+
uint64_t h[8];
|
|
23
|
+
uint64_t t[2];
|
|
24
|
+
uint64_t f[2];
|
|
25
|
+
uint8_t buf[BLAKE2B_BLOCKBYTES];
|
|
26
|
+
size_t buflen;
|
|
27
|
+
size_t outlen;
|
|
28
|
+
uint8_t last_node;
|
|
29
|
+
} blake2b_state;
|
|
30
|
+
|
|
31
|
+
#define BLAKE2B_CTX blake2b_state
|
|
32
|
+
#define BLAKE2B_BLOCK_LENGTH BLAKE2B_BLOCKBYTES
|
|
33
|
+
#define BLAKE2B_DIGEST_LENGTH BLAKE2B_OUTBYTES
|
|
34
|
+
#define BLAKE2B_KEY_LENGTH BLAKE2B_KEYBYTES
|
|
35
|
+
|
|
36
|
+
int blake2b_Init(blake2b_state *S, size_t outlen);
|
|
37
|
+
int blake2b_InitKey(blake2b_state *S, size_t outlen, const void *key, size_t keylen);
|
|
38
|
+
int blake2b_InitPersonal(blake2b_state *S, size_t outlen, const void *personal, size_t personal_len);
|
|
39
|
+
int blake2b_Update(blake2b_state *S, const void *pin, size_t inlen);
|
|
40
|
+
int blake2b_Final(blake2b_state *S, void *out, size_t outlen);
|
|
41
|
+
|
|
42
|
+
int blake2b(const uint8_t *msg, uint32_t msg_len, void *out, size_t outlen);
|
|
43
|
+
int blake2b_Personal(const uint8_t *msg, uint32_t msg_len, const void *personal, size_t personal_len, void *out, size_t outlen);
|
|
44
|
+
int blake2b_Key(const uint8_t *msg, uint32_t msg_len, const void *key, size_t keylen, void *out, size_t outlen);
|
|
45
|
+
|
|
46
|
+
#ifdef __cplusplus
|
|
47
|
+
} /* extern "C" */
|
|
48
|
+
#endif
|
|
49
|
+
|
|
50
|
+
#endif
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
#ifndef __BLAKE2S_H__
|
|
2
|
+
#define __BLAKE2S_H__
|
|
3
|
+
|
|
4
|
+
#include <stdint.h>
|
|
5
|
+
#include <stddef.h>
|
|
6
|
+
|
|
7
|
+
#ifdef __cplusplus
|
|
8
|
+
extern "C" {
|
|
9
|
+
#endif
|
|
10
|
+
|
|
11
|
+
enum blake2s_constant
|
|
12
|
+
{
|
|
13
|
+
BLAKE2S_BLOCKBYTES = 64,
|
|
14
|
+
BLAKE2S_OUTBYTES = 32,
|
|
15
|
+
BLAKE2S_KEYBYTES = 32,
|
|
16
|
+
BLAKE2S_SALTBYTES = 8,
|
|
17
|
+
BLAKE2S_PERSONALBYTES = 8
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
typedef struct __blake2s_state
|
|
21
|
+
{
|
|
22
|
+
uint32_t h[8];
|
|
23
|
+
uint32_t t[2];
|
|
24
|
+
uint32_t f[2];
|
|
25
|
+
uint8_t buf[BLAKE2S_BLOCKBYTES];
|
|
26
|
+
uint32_t buflen;
|
|
27
|
+
uint8_t outlen;
|
|
28
|
+
uint8_t last_node;
|
|
29
|
+
} blake2s_state;
|
|
30
|
+
|
|
31
|
+
#define BLAKE2S_CTX blake2s_state
|
|
32
|
+
#define BLAKE2S_BLOCK_LENGTH BLAKE2S_BLOCKBYTES
|
|
33
|
+
#define BLAKE2S_DIGEST_LENGTH BLAKE2S_OUTBYTES
|
|
34
|
+
#define BLAKE2S_KEY_LENGTH BLAKE2S_KEYBYTES
|
|
35
|
+
|
|
36
|
+
int blake2s_Init(blake2s_state *S, size_t outlen);
|
|
37
|
+
int blake2s_InitKey(blake2s_state *S, size_t outlen, const void *key, size_t keylen);
|
|
38
|
+
int blake2s_InitPersonal(blake2s_state *S, size_t outlen, const void *personal, size_t personal_len);
|
|
39
|
+
int blake2s_Update(blake2s_state *S, const void *pin, size_t inlen);
|
|
40
|
+
int blake2s_Final(blake2s_state *S, void *out, size_t outlen);
|
|
41
|
+
|
|
42
|
+
int blake2s(const uint8_t *msg, uint32_t msg_len, void *out, size_t outlen);
|
|
43
|
+
int blake2s_Key(const uint8_t *msg, uint32_t msg_len, const void *key, size_t keylen, void *out, size_t outlen);
|
|
44
|
+
|
|
45
|
+
#ifdef __cplusplus
|
|
46
|
+
} /* extern "C" */
|
|
47
|
+
#endif
|
|
48
|
+
|
|
49
|
+
#endif
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/* Copyright (c) 2017 Jochen Hoenicke, Pieter Wuille
|
|
2
|
+
*
|
|
3
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
5
|
+
* in the Software without restriction, including without limitation the rights
|
|
6
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
7
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
8
|
+
* furnished to do so, subject to the following conditions:
|
|
9
|
+
*
|
|
10
|
+
* The above copyright notice and this permission notice shall be included in
|
|
11
|
+
* all copies or substantial portions of the Software.
|
|
12
|
+
*
|
|
13
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
18
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
19
|
+
* THE SOFTWARE.
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
#ifndef _CASH_ADDR_H_
|
|
23
|
+
#define _CASH_ADDR_H_ 1
|
|
24
|
+
|
|
25
|
+
#include <stdint.h>
|
|
26
|
+
|
|
27
|
+
#ifdef __cplusplus
|
|
28
|
+
extern "C" {
|
|
29
|
+
#endif
|
|
30
|
+
|
|
31
|
+
/** Encode a Cashaddr address
|
|
32
|
+
*
|
|
33
|
+
* Out: output: Pointer to a buffer of size 105 + strlen(hrp) that will be
|
|
34
|
+
* updated to contain the null-terminated address.
|
|
35
|
+
* In: hrp: Pointer to the null-terminated human readable part to use
|
|
36
|
+
* (chain/network specific).
|
|
37
|
+
* prog: Data bytes for the hash (between 21 and 65 bytes).
|
|
38
|
+
* prog_len: Number of data bytes in prog.
|
|
39
|
+
* Returns 1 if successful.
|
|
40
|
+
*/
|
|
41
|
+
int cash_addr_encode(
|
|
42
|
+
char *output,
|
|
43
|
+
const char *hrp,
|
|
44
|
+
const uint8_t *prog,
|
|
45
|
+
size_t prog_len
|
|
46
|
+
);
|
|
47
|
+
|
|
48
|
+
/** Decode a CashAddr address
|
|
49
|
+
*
|
|
50
|
+
* Out: prog: Pointer to a buffer of size 65 that will be updated to
|
|
51
|
+
* contain the witness program bytes.
|
|
52
|
+
* prog_len: Pointer to a size_t that will be updated to contain the length
|
|
53
|
+
* of bytes in prog.
|
|
54
|
+
* hrp: Pointer to the null-terminated human readable part that is
|
|
55
|
+
* expected (chain/network specific).
|
|
56
|
+
* addr: Pointer to the null-terminated address.
|
|
57
|
+
* Returns 1 if successful.
|
|
58
|
+
*/
|
|
59
|
+
int cash_addr_decode(
|
|
60
|
+
uint8_t* prog,
|
|
61
|
+
size_t* prog_len,
|
|
62
|
+
const char* hrp,
|
|
63
|
+
const char* addr
|
|
64
|
+
);
|
|
65
|
+
|
|
66
|
+
/** Encode a Cash string
|
|
67
|
+
*
|
|
68
|
+
* Out: output: Pointer to a buffer of size strlen(hrp) + data_len + 8 that
|
|
69
|
+
* will be updated to contain the null-terminated Cash string.
|
|
70
|
+
* In: hrp : Pointer to the null-terminated human readable part.
|
|
71
|
+
* data : Pointer to an array of 5-bit values.
|
|
72
|
+
* data_len: Length of the data array.
|
|
73
|
+
* Returns 1 if successful.
|
|
74
|
+
*/
|
|
75
|
+
int cash_encode(
|
|
76
|
+
char *output,
|
|
77
|
+
const char *hrp,
|
|
78
|
+
const uint8_t *data,
|
|
79
|
+
size_t data_len
|
|
80
|
+
);
|
|
81
|
+
|
|
82
|
+
/** Decode a Cash string
|
|
83
|
+
*
|
|
84
|
+
* Out: hrp: Pointer to a buffer of size strlen(input) - 6. Will be
|
|
85
|
+
* updated to contain the null-terminated human readable part.
|
|
86
|
+
* data: Pointer to a buffer of size strlen(input) - 8 that will
|
|
87
|
+
* hold the encoded 5-bit data values.
|
|
88
|
+
* data_len: Pointer to a size_t that will be updated to be the number
|
|
89
|
+
* of entries in data.
|
|
90
|
+
* In: input: Pointer to a null-terminated Cash string.
|
|
91
|
+
* Returns 1 if succesful.
|
|
92
|
+
*/
|
|
93
|
+
int cash_decode(
|
|
94
|
+
char *hrp,
|
|
95
|
+
uint8_t *data,
|
|
96
|
+
size_t *data_len,
|
|
97
|
+
const char *input
|
|
98
|
+
);
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
int cash_addr_to_data(uint8_t *output, size_t *output_len, const uint8_t *data, size_t data_len);
|
|
102
|
+
|
|
103
|
+
int cash_data_to_addr(uint8_t* witdata, size_t* witdata_len, const uint8_t* data, size_t data_len);
|
|
104
|
+
|
|
105
|
+
#ifdef __cplusplus
|
|
106
|
+
} /* extern "C" */
|
|
107
|
+
#endif
|
|
108
|
+
|
|
109
|
+
#endif
|