@authon/react-native-wallet 0.0.0-stage → 0.1.0

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.
Files changed (159) hide show
  1. package/README.md +221 -2
  2. package/android/build.gradle +40 -0
  3. package/android/consumer-rules.pro +10 -0
  4. package/android/src/main/AndroidManifest.xml +4 -0
  5. package/android/src/main/java/dev/authon/reactnative/wallet/AuthonWalletModule.kt +181 -0
  6. package/android/src/vendor/GENERATED.md +4 -0
  7. package/android/src/vendor/kotlin/dev/authon/sdk/wallet/AuthonWallet.kt +191 -0
  8. package/android/src/vendor/kotlin/dev/authon/sdk/wallet/Bytes.kt +74 -0
  9. package/android/src/vendor/kotlin/dev/authon/sdk/wallet/CredentialManagerPasskeys.kt +192 -0
  10. package/android/src/vendor/kotlin/dev/authon/sdk/wallet/DeviceStore.kt +170 -0
  11. package/android/src/vendor/kotlin/dev/authon/sdk/wallet/DialogWalletApprover.kt +141 -0
  12. package/android/src/vendor/kotlin/dev/authon/sdk/wallet/Eip712.kt +176 -0
  13. package/android/src/vendor/kotlin/dev/authon/sdk/wallet/EvmAccount.kt +45 -0
  14. package/android/src/vendor/kotlin/dev/authon/sdk/wallet/EvmTransaction.kt +180 -0
  15. package/android/src/vendor/kotlin/dev/authon/sdk/wallet/GfTables.kt +44 -0
  16. package/android/src/vendor/kotlin/dev/authon/sdk/wallet/HdWallet.kt +130 -0
  17. package/android/src/vendor/kotlin/dev/authon/sdk/wallet/Http.kt +82 -0
  18. package/android/src/vendor/kotlin/dev/authon/sdk/wallet/JsValues.kt +83 -0
  19. package/android/src/vendor/kotlin/dev/authon/sdk/wallet/KeystoreDeviceStore.kt +232 -0
  20. package/android/src/vendor/kotlin/dev/authon/sdk/wallet/Prf.kt +111 -0
  21. package/android/src/vendor/kotlin/dev/authon/sdk/wallet/Proof.kt +134 -0
  22. package/android/src/vendor/kotlin/dev/authon/sdk/wallet/Shamir.kt +106 -0
  23. package/android/src/vendor/kotlin/dev/authon/sdk/wallet/SignSummary.kt +335 -0
  24. package/android/src/vendor/kotlin/dev/authon/sdk/wallet/WalletApi.kt +353 -0
  25. package/android/src/vendor/kotlin/dev/authon/sdk/wallet/WalletError.kt +58 -0
  26. package/android/src/vendor/kotlin/dev/authon/sdk/wallet/WalletOps.kt +449 -0
  27. package/android/src/vendor/kotlin/dev/authon/sdk/wallet/WalletTypes.kt +71 -0
  28. package/build/authonContext.d.ts +19 -0
  29. package/build/authonContext.d.ts.map +1 -0
  30. package/build/authonContext.js +20 -0
  31. package/build/authonContext.js.map +1 -0
  32. package/build/client.d.ts +76 -0
  33. package/build/client.d.ts.map +1 -0
  34. package/build/client.js +349 -0
  35. package/build/client.js.map +1 -0
  36. package/build/errors.d.ts +18 -0
  37. package/build/errors.d.ts.map +1 -0
  38. package/build/errors.js +9 -0
  39. package/build/errors.js.map +1 -0
  40. package/build/index.d.ts +7 -0
  41. package/build/index.d.ts.map +1 -0
  42. package/build/index.js +4 -0
  43. package/build/index.js.map +1 -0
  44. package/build/native.d.ts +39 -0
  45. package/build/native.d.ts.map +1 -0
  46. package/build/native.js +12 -0
  47. package/build/native.js.map +1 -0
  48. package/build/types.d.ts +121 -0
  49. package/build/types.d.ts.map +1 -0
  50. package/build/types.js +3 -0
  51. package/build/types.js.map +1 -0
  52. package/build/useAuthonWallet.d.ts +25 -0
  53. package/build/useAuthonWallet.d.ts.map +1 -0
  54. package/build/useAuthonWallet.js +77 -0
  55. package/build/useAuthonWallet.js.map +1 -0
  56. package/expo-module.config.json +9 -0
  57. package/ios/AuthonReactNativeWallet.podspec +37 -0
  58. package/ios/AuthonWalletModule.swift +190 -0
  59. package/ios/vendor/AuthonWallet/AuthonWallet.swift +212 -0
  60. package/ios/vendor/AuthonWallet/Crypto/BIP39Wordlist.swift +262 -0
  61. package/ios/vendor/AuthonWallet/Crypto/HDKey.swift +108 -0
  62. package/ios/vendor/AuthonWallet/Crypto/Secp256k1.swift +104 -0
  63. package/ios/vendor/AuthonWallet/Crypto/Shamir.swift +123 -0
  64. package/ios/vendor/AuthonWallet/EVM/Address.swift +57 -0
  65. package/ios/vendor/AuthonWallet/EVM/EvmAccount.swift +48 -0
  66. package/ios/vendor/AuthonWallet/EVM/Transaction.swift +165 -0
  67. package/ios/vendor/AuthonWallet/EVM/TypedData.swift +193 -0
  68. package/ios/vendor/AuthonWallet/Support/BigInteger.swift +220 -0
  69. package/ios/vendor/AuthonWallet/Support/Bytes.swift +89 -0
  70. package/ios/vendor/AuthonWallet/Support/JSONValue.swift +341 -0
  71. package/ios/vendor/AuthonWallet/UI/WalletApprover.swift +250 -0
  72. package/ios/vendor/AuthonWallet/Wallet/Backup.swift +69 -0
  73. package/ios/vendor/AuthonWallet/Wallet/DeviceStore.swift +351 -0
  74. package/ios/vendor/AuthonWallet/Wallet/Passkeys.swift +190 -0
  75. package/ios/vendor/AuthonWallet/Wallet/Proof.swift +143 -0
  76. package/ios/vendor/AuthonWallet/Wallet/Shares.swift +116 -0
  77. package/ios/vendor/AuthonWallet/Wallet/Summary.swift +342 -0
  78. package/ios/vendor/AuthonWallet/Wallet/WalletAPI.swift +350 -0
  79. package/ios/vendor/AuthonWallet/Wallet/WalletOps.swift +555 -0
  80. package/ios/vendor/AuthonWallet/WalletError.swift +54 -0
  81. package/ios/vendor/CKeccak/LICENSE +22 -0
  82. package/ios/vendor/CKeccak/README.md +27 -0
  83. package/ios/vendor/CKeccak/byte_order.h +59 -0
  84. package/ios/vendor/CKeccak/include/ckeccak.h +9 -0
  85. package/ios/vendor/CKeccak/memzero.c +75 -0
  86. package/ios/vendor/CKeccak/memzero.h +8 -0
  87. package/ios/vendor/CKeccak/options.h +99 -0
  88. package/ios/vendor/CKeccak/sha3.c +413 -0
  89. package/ios/vendor/CKeccak/sha3.h +89 -0
  90. package/ios/vendor/CSecp256k1/COPYING +19 -0
  91. package/ios/vendor/CSecp256k1/README.md +35 -0
  92. package/ios/vendor/CSecp256k1/build/precomputed_ecmult.c +3 -0
  93. package/ios/vendor/CSecp256k1/build/precomputed_ecmult_gen.c +3 -0
  94. package/ios/vendor/CSecp256k1/build/secp256k1.c +3 -0
  95. package/ios/vendor/CSecp256k1/include/secp256k1.h +899 -0
  96. package/ios/vendor/CSecp256k1/include/secp256k1_preallocated.h +134 -0
  97. package/ios/vendor/CSecp256k1/include/secp256k1_recovery.h +113 -0
  98. package/ios/vendor/CSecp256k1/src/assumptions.h +87 -0
  99. package/ios/vendor/CSecp256k1/src/checkmem.h +102 -0
  100. package/ios/vendor/CSecp256k1/src/ecdsa.h +21 -0
  101. package/ios/vendor/CSecp256k1/src/ecdsa_impl.h +304 -0
  102. package/ios/vendor/CSecp256k1/src/eckey.h +25 -0
  103. package/ios/vendor/CSecp256k1/src/eckey_impl.h +92 -0
  104. package/ios/vendor/CSecp256k1/src/ecmult.h +61 -0
  105. package/ios/vendor/CSecp256k1/src/ecmult_const.h +38 -0
  106. package/ios/vendor/CSecp256k1/src/ecmult_const_impl.h +399 -0
  107. package/ios/vendor/CSecp256k1/src/ecmult_gen.h +143 -0
  108. package/ios/vendor/CSecp256k1/src/ecmult_gen_impl.h +341 -0
  109. package/ios/vendor/CSecp256k1/src/ecmult_impl.h +853 -0
  110. package/ios/vendor/CSecp256k1/src/field.h +350 -0
  111. package/ios/vendor/CSecp256k1/src/field_10x26.h +57 -0
  112. package/ios/vendor/CSecp256k1/src/field_10x26_impl.h +1232 -0
  113. package/ios/vendor/CSecp256k1/src/field_5x52.h +62 -0
  114. package/ios/vendor/CSecp256k1/src/field_5x52_impl.h +522 -0
  115. package/ios/vendor/CSecp256k1/src/field_5x52_int128_impl.h +274 -0
  116. package/ios/vendor/CSecp256k1/src/field_impl.h +457 -0
  117. package/ios/vendor/CSecp256k1/src/group.h +212 -0
  118. package/ios/vendor/CSecp256k1/src/group_impl.h +974 -0
  119. package/ios/vendor/CSecp256k1/src/hash.h +44 -0
  120. package/ios/vendor/CSecp256k1/src/hash_impl.h +299 -0
  121. package/ios/vendor/CSecp256k1/src/hsort.h +33 -0
  122. package/ios/vendor/CSecp256k1/src/hsort_impl.h +125 -0
  123. package/ios/vendor/CSecp256k1/src/int128.h +90 -0
  124. package/ios/vendor/CSecp256k1/src/int128_impl.h +18 -0
  125. package/ios/vendor/CSecp256k1/src/int128_native.h +19 -0
  126. package/ios/vendor/CSecp256k1/src/int128_native_impl.h +94 -0
  127. package/ios/vendor/CSecp256k1/src/int128_struct.h +14 -0
  128. package/ios/vendor/CSecp256k1/src/int128_struct_impl.h +205 -0
  129. package/ios/vendor/CSecp256k1/src/modinv32.h +43 -0
  130. package/ios/vendor/CSecp256k1/src/modinv32_impl.h +725 -0
  131. package/ios/vendor/CSecp256k1/src/modinv64.h +47 -0
  132. package/ios/vendor/CSecp256k1/src/modinv64_impl.h +780 -0
  133. package/ios/vendor/CSecp256k1/src/modules/recovery/main_impl.h +159 -0
  134. package/ios/vendor/CSecp256k1/src/precomputed_ecmult.c +16456 -0
  135. package/ios/vendor/CSecp256k1/src/precomputed_ecmult.h +38 -0
  136. package/ios/vendor/CSecp256k1/src/precomputed_ecmult_gen.c +1779 -0
  137. package/ios/vendor/CSecp256k1/src/precomputed_ecmult_gen.h +26 -0
  138. package/ios/vendor/CSecp256k1/src/scalar.h +105 -0
  139. package/ios/vendor/CSecp256k1/src/scalar_4x64.h +19 -0
  140. package/ios/vendor/CSecp256k1/src/scalar_4x64_impl.h +1000 -0
  141. package/ios/vendor/CSecp256k1/src/scalar_8x32.h +19 -0
  142. package/ios/vendor/CSecp256k1/src/scalar_8x32_impl.h +816 -0
  143. package/ios/vendor/CSecp256k1/src/scalar_impl.h +321 -0
  144. package/ios/vendor/CSecp256k1/src/scalar_low.h +24 -0
  145. package/ios/vendor/CSecp256k1/src/scalar_low_impl.h +206 -0
  146. package/ios/vendor/CSecp256k1/src/scratch.h +44 -0
  147. package/ios/vendor/CSecp256k1/src/scratch_impl.h +99 -0
  148. package/ios/vendor/CSecp256k1/src/secp256k1.c +831 -0
  149. package/ios/vendor/CSecp256k1/src/selftest.h +32 -0
  150. package/ios/vendor/CSecp256k1/src/util.h +451 -0
  151. package/ios/vendor/GENERATED.md +4 -0
  152. package/package.json +65 -3
  153. package/src/authonContext.ts +30 -0
  154. package/src/client.ts +375 -0
  155. package/src/errors.ts +52 -0
  156. package/src/index.ts +21 -0
  157. package/src/native.ts +50 -0
  158. package/src/types.ts +120 -0
  159. package/src/useAuthonWallet.ts +103 -0
@@ -0,0 +1,89 @@
1
+ /* sha3.h - an implementation of Secure Hash Algorithm 3 (Keccak).
2
+ * based on the
3
+ * The Keccak SHA-3 submission. Submission to NIST (Round 3), 2011
4
+ * by Guido Bertoni, Joan Daemen, Michaël Peeters and Gilles Van Assche
5
+ *
6
+ * Copyright: 2013 Aleksey Kravchenko <rhash.admin@gmail.com>
7
+ *
8
+ * Permission is hereby granted, free of charge, to any person obtaining a
9
+ * copy of this software and associated documentation files (the "Software"),
10
+ * to deal in the Software without restriction, including without limitation
11
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
12
+ * and/or sell copies of the Software, and to permit persons to whom the
13
+ * Software is furnished to do so.
14
+ *
15
+ * This program is distributed in the hope that it will be useful, but
16
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
17
+ * or FITNESS FOR A PARTICULAR PURPOSE. Use this program at your own risk!
18
+ */
19
+
20
+ #ifndef __SHA3_H__
21
+ #define __SHA3_H__
22
+
23
+ #include <stdint.h>
24
+ #include "options.h"
25
+
26
+ #ifdef __cplusplus
27
+ extern "C" {
28
+ #endif
29
+
30
+ #define sha3_224_hash_size 28
31
+ #define sha3_256_hash_size 32
32
+ #define sha3_384_hash_size 48
33
+ #define sha3_512_hash_size 64
34
+ #define sha3_max_permutation_size 25
35
+ #define sha3_max_rate_in_qwords 24
36
+
37
+ #define SHA3_224_BLOCK_LENGTH 144
38
+ #define SHA3_256_BLOCK_LENGTH 136
39
+ #define SHA3_384_BLOCK_LENGTH 104
40
+ #define SHA3_512_BLOCK_LENGTH 72
41
+
42
+ #define SHA3_224_DIGEST_LENGTH sha3_224_hash_size
43
+ #define SHA3_256_DIGEST_LENGTH sha3_256_hash_size
44
+ #define SHA3_384_DIGEST_LENGTH sha3_384_hash_size
45
+ #define SHA3_512_DIGEST_LENGTH sha3_512_hash_size
46
+
47
+ /**
48
+ * SHA3 Algorithm context.
49
+ */
50
+ typedef struct SHA3_CTX
51
+ {
52
+ /* 1600 bits algorithm hashing state */
53
+ uint64_t hash[sha3_max_permutation_size];
54
+ /* 1536-bit buffer for leftovers */
55
+ uint64_t message[sha3_max_rate_in_qwords];
56
+ /* count of bytes in the message[] buffer */
57
+ unsigned rest;
58
+ /* size of a message block processed at once */
59
+ unsigned block_size;
60
+ } SHA3_CTX;
61
+
62
+ /* methods for calculating the hash function */
63
+
64
+ void sha3_224_Init(SHA3_CTX *ctx);
65
+ void sha3_256_Init(SHA3_CTX *ctx);
66
+ void sha3_384_Init(SHA3_CTX *ctx);
67
+ void sha3_512_Init(SHA3_CTX *ctx);
68
+ void sha3_Update(SHA3_CTX *ctx, const unsigned char* msg, size_t size);
69
+ void sha3_Final(SHA3_CTX *ctx, unsigned char* result);
70
+
71
+ #if USE_KECCAK
72
+ #define keccak_224_Init sha3_224_Init
73
+ #define keccak_256_Init sha3_256_Init
74
+ #define keccak_384_Init sha3_384_Init
75
+ #define keccak_512_Init sha3_512_Init
76
+ #define keccak_Update sha3_Update
77
+ void keccak_Final(SHA3_CTX *ctx, unsigned char* result);
78
+ void keccak_256(const unsigned char* data, size_t len, unsigned char* digest);
79
+ void keccak_512(const unsigned char* data, size_t len, unsigned char* digest);
80
+ #endif
81
+
82
+ void sha3_256(const unsigned char* data, size_t len, unsigned char* digest);
83
+ void sha3_512(const unsigned char* data, size_t len, unsigned char* digest);
84
+
85
+ #ifdef __cplusplus
86
+ } /* extern "C" */
87
+ #endif /* __cplusplus */
88
+
89
+ #endif /* __SHA3_H__ */
@@ -0,0 +1,19 @@
1
+ Copyright (c) 2013 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.
@@ -0,0 +1,35 @@
1
+ # CSecp256k1
2
+
3
+ bitcoin-core/libsecp256k1 **v0.6.0** (MIT, see COPYING), vendored for AuthonWallet.
4
+
5
+ - Release tarball: https://github.com/bitcoin-core/secp256k1/archive/refs/tags/v0.6.0.tar.gz
6
+ - Tarball SHA-256: `785bb98e7d6705c51c8dfa8ac3af6aa2ccfa3774714d51c0b9e28fac1146e9f1`
7
+ - Copied unchanged: `include/secp256k1.h`, `include/secp256k1_recovery.h`, `include/secp256k1_preallocated.h`,
8
+ `src/secp256k1.c`, `src/precomputed_ecmult.c`, `src/precomputed_ecmult_gen.c`, the library headers in `src/`
9
+ and `src/modules/recovery/main_impl.h`. Benchmarks, tests, table generators and the other optional modules are left out.
10
+ - `build/*.c` are ours: each includes one upstream `.c` file unchanged and only silences Xcode's
11
+ `-Wshorten-64-to-32` warnings (SwiftPM `unsafeFlags` would make the package unusable as a dependency).
12
+ - Built with `ENABLE_MODULE_RECOVERY=1` and the library defaults (`ECMULT_WINDOW_SIZE=15`, `COMB_BLOCKS=11`, `COMB_TEETH=6`).
13
+
14
+ Signatures use the library's default nonce function (RFC 6979) and are normalized to low-s,
15
+ so they are byte-identical to viem/noble signatures.
16
+
17
+ ## Building outside SwiftPM (CocoaPods)
18
+
19
+ The folder is self-contained. The settings `Package.swift` uses:
20
+
21
+ - compile only `build/*.c` (they include `src/*.c`; compiling `src/*.c` as well duplicates every symbol);
22
+ keep `src/**/*.h` and `src/*.c` available as preserved paths;
23
+ - public headers: `include/secp256k1.h`, `include/secp256k1_recovery.h`, `include/secp256k1_preallocated.h`;
24
+ - preprocessor definition `ENABLE_MODULE_RECOVERY=1`; no other flags and no extra header search paths
25
+ (all includes are relative).
26
+
27
+ ```ruby
28
+ s.source_files = 'CSecp256k1/build/*.c', 'CSecp256k1/include/*.h'
29
+ s.public_header_files = 'CSecp256k1/include/*.h'
30
+ s.preserve_paths = 'CSecp256k1/src/**/*'
31
+ s.pod_target_xcconfig = { 'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) ENABLE_MODULE_RECOVERY=1' }
32
+ ```
33
+
34
+ The Swift sources import the module with `#if canImport(CSecp256k1)`, so they also build when the
35
+ headers come through the pod's umbrella header instead.
@@ -0,0 +1,3 @@
1
+ /* Compiles the unchanged upstream ../src/precomputed_ecmult.c with Xcode's extra warnings for 64-to-32 conversions silenced. */
2
+ #pragma clang diagnostic ignored "-Wshorten-64-to-32"
3
+ #include "../src/precomputed_ecmult.c"
@@ -0,0 +1,3 @@
1
+ /* Compiles the unchanged upstream ../src/precomputed_ecmult_gen.c with Xcode's extra warnings for 64-to-32 conversions silenced. */
2
+ #pragma clang diagnostic ignored "-Wshorten-64-to-32"
3
+ #include "../src/precomputed_ecmult_gen.c"
@@ -0,0 +1,3 @@
1
+ /* Compiles the unchanged upstream ../src/secp256k1.c with Xcode's extra warnings for 64-to-32 conversions silenced. */
2
+ #pragma clang diagnostic ignored "-Wshorten-64-to-32"
3
+ #include "../src/secp256k1.c"