@qntx/wallet-native 0.13.0 → 0.14.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.
- package/README.md +184 -31
- package/WalletNative.podspec +11 -2
- package/android/CMakeLists.txt +7 -1
- package/android/build.gradle +4 -0
- package/android/src/main/AndroidManifest.xml +1 -2
- package/android/src/main/cpp/cpp-adapter.cpp +9 -0
- package/android/src/main/java/com/margelo/nitro/qntxwallet/CardReader.kt +316 -0
- package/android/src/main/java/com/margelo/nitro/qntxwallet/HybridGoogleDriveAuth.kt +142 -0
- package/android/src/main/java/com/margelo/nitro/qntxwallet/HybridSecureInputView.kt +25 -0
- package/android/src/main/java/com/margelo/nitro/qntxwallet/Keystore.kt +148 -9
- package/android/src/main/java/com/margelo/nitro/qntxwallet/SecureInputField.kt +422 -0
- package/android/src/main/java/com/margelo/nitro/qntxwallet/VaultAnchor.kt +90 -0
- package/android/src/main/java/com/margelo/nitro/qntxwallet/WalletNativePackage.java +10 -0
- package/cpp/host/CardReader.hpp +70 -0
- package/cpp/host/HybridKernelHost.cpp +90 -15
- package/cpp/host/HybridKernelHost.hpp +21 -5
- package/cpp/host/KernelFile.cpp +79 -15
- package/cpp/host/KernelFile.hpp +17 -6
- package/cpp/host/KernelSlot.hpp +103 -0
- package/cpp/host/Keystore.hpp +35 -11
- package/cpp/host/Lifecycle.cpp +11 -0
- package/cpp/host/Lifecycle.hpp +3 -0
- package/cpp/host/Passkey.hpp +8 -0
- package/cpp/host/SecureInput.cpp +233 -0
- package/cpp/host/SecureInput.hpp +103 -0
- package/cpp/host/VaultAnchor.cpp +39 -0
- package/cpp/host/VaultAnchor.hpp +28 -0
- package/cpp/host/VaultDirectory.hpp +1 -1
- package/cpp/platform/CardReaderAndroid.cpp +146 -0
- package/cpp/platform/CardReaderIos.mm +318 -0
- package/cpp/platform/KeystoreAndroid.cpp +48 -1
- package/cpp/platform/KeystoreIos.mm +109 -19
- package/cpp/platform/PasskeyAndroid.cpp +2 -0
- package/cpp/platform/PasskeyIos.mm +20 -18
- package/cpp/platform/QntxSecureInputField.h +24 -0
- package/cpp/platform/SecureInputAndroid.cpp +110 -0
- package/cpp/platform/SecureInputIos.mm +282 -0
- package/cpp/platform/VaultAnchorAndroid.cpp +76 -0
- package/cpp/platform/VaultAnchorIos.mm +76 -0
- package/cpp/runtime/KernelBackends.cpp +35 -28
- package/cpp/runtime/KernelBuffer.hpp +2 -5
- package/cpp/runtime/KernelCardReader.cpp +385 -0
- package/cpp/runtime/KernelCardReader.hpp +27 -0
- package/cpp/runtime/KernelGlobals.cpp +176 -63
- package/cpp/runtime/KernelGlobals.hpp +13 -7
- package/cpp/runtime/KernelJs.cpp +14 -0
- package/cpp/runtime/KernelJs.hpp +4 -0
- package/cpp/runtime/KernelKeystore.cpp +78 -2
- package/cpp/runtime/KernelKeystore.hpp +1 -0
- package/cpp/runtime/KernelPasskey.cpp +15 -12
- package/cpp/runtime/KernelRuntime.cpp +24 -7
- package/cpp/runtime/KernelRuntime.hpp +14 -6
- package/cpp/runtime/KernelSecureInput.cpp +154 -0
- package/cpp/runtime/KernelSecureInput.hpp +25 -0
- package/cpp/runtime/platform/KernelArgon2.cpp +34 -0
- package/cpp/runtime/platform/KernelArgon2.hpp +23 -0
- package/cpp/vendor/argon2/LICENSE +314 -0
- package/cpp/vendor/argon2/README.md +20 -0
- package/cpp/vendor/argon2/include/argon2.h +437 -0
- package/cpp/vendor/argon2/src/argon2.c +452 -0
- package/cpp/vendor/argon2/src/blake2/blake2-impl.h +156 -0
- package/cpp/vendor/argon2/src/blake2/blake2.h +89 -0
- package/cpp/vendor/argon2/src/blake2/blake2b.c +390 -0
- package/cpp/vendor/argon2/src/blake2/blamka-round-ref.h +56 -0
- package/cpp/vendor/argon2/src/core.c +648 -0
- package/cpp/vendor/argon2/src/core.h +228 -0
- package/cpp/vendor/argon2/src/encoding.c +463 -0
- package/cpp/vendor/argon2/src/encoding.h +57 -0
- package/cpp/vendor/argon2/src/ref.c +194 -0
- package/cpp/vendor/argon2/src/thread.c +57 -0
- package/cpp/vendor/argon2/src/thread.h +67 -0
- package/dist/cloud.d.mts +58 -0
- package/dist/cloud.mjs +114 -0
- package/dist/cloud.mjs.map +1 -0
- package/dist/index.d.mts +13 -4
- package/dist/index.mjs +89 -14
- package/dist/index.mjs.map +1 -1
- package/dist/secure-input.d.mts +24 -0
- package/dist/secure-input.mjs +25 -0
- package/dist/secure-input.mjs.map +1 -0
- package/ios/HybridCloudKitStore.swift +159 -0
- package/ios/HybridSecureInputView.swift +35 -0
- package/ios/cloud/CloudKitEnvelopeStore.swift +179 -0
- package/kernel/generated/kernel-entry.js +42170 -12741
- package/kernel/generated/kernel.manifest.json +17 -7
- package/nitrogen/generated/android/WalletNative+autolinking.cmake +7 -1
- package/nitrogen/generated/android/WalletNativeOnLoad.cpp +37 -2
- package/nitrogen/generated/android/c++/JFunc_void_SecureInputState.hpp +77 -0
- package/nitrogen/generated/android/c++/JHybridGoogleDriveAuthSpec.cpp +82 -0
- package/nitrogen/generated/android/c++/JHybridGoogleDriveAuthSpec.hpp +64 -0
- package/nitrogen/generated/android/c++/JHybridSecureInputViewSpec.cpp +70 -0
- package/nitrogen/generated/android/c++/JHybridSecureInputViewSpec.hpp +64 -0
- package/nitrogen/generated/android/c++/JSecureInputState.hpp +64 -0
- package/nitrogen/generated/android/c++/views/JHybridSecureInputViewStateUpdater.cpp +74 -0
- package/nitrogen/generated/android/c++/views/JHybridSecureInputViewStateUpdater.hpp +54 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/qntxwallet/Func_void_SecureInputState.kt +78 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/qntxwallet/HybridGoogleDriveAuthSpec.kt +61 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/qntxwallet/HybridSecureInputViewSpec.kt +67 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/qntxwallet/SecureInputState.kt +25 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/qntxwallet/views/HybridSecureInputViewManager.kt +96 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/qntxwallet/views/HybridSecureInputViewStateUpdater.kt +23 -0
- package/nitrogen/generated/ios/WalletNative-Swift-Cxx-Bridge.cpp +74 -1
- package/nitrogen/generated/ios/WalletNative-Swift-Cxx-Bridge.hpp +252 -3
- package/nitrogen/generated/ios/WalletNative-Swift-Cxx-Umbrella.hpp +21 -3
- package/nitrogen/generated/ios/WalletNativeAutolinking.mm +17 -1
- package/nitrogen/generated/ios/WalletNativeAutolinking.swift +22 -0
- package/nitrogen/generated/ios/c++/HybridCloudKitStoreSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridCloudKitStoreSpecSwift.hpp +116 -0
- package/nitrogen/generated/ios/c++/HybridSecureInputViewSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridSecureInputViewSpecSwift.hpp +83 -0
- package/nitrogen/generated/ios/c++/views/HybridSecureInputViewComponent.mm +144 -0
- package/nitrogen/generated/ios/swift/Func_void.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_SecureInputState.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_std__exception_ptr.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_std__optional_std__string_.swift +53 -0
- package/nitrogen/generated/ios/swift/Func_void_std__vector_std__string_.swift +46 -0
- package/nitrogen/generated/ios/swift/HybridCloudKitStoreSpec.swift +59 -0
- package/nitrogen/generated/ios/swift/HybridCloudKitStoreSpec_cxx.swift +230 -0
- package/nitrogen/generated/ios/swift/HybridSecureInputViewSpec.swift +55 -0
- package/nitrogen/generated/ios/swift/HybridSecureInputViewSpec_cxx.swift +164 -0
- package/nitrogen/generated/ios/swift/SecureInputState.swift +48 -0
- package/nitrogen/generated/shared/c++/HybridCloudKitStoreSpec.cpp +25 -0
- package/nitrogen/generated/shared/c++/HybridCloudKitStoreSpec.hpp +70 -0
- package/nitrogen/generated/shared/c++/HybridGoogleDriveAuthSpec.cpp +22 -0
- package/nitrogen/generated/shared/c++/HybridGoogleDriveAuthSpec.hpp +64 -0
- package/nitrogen/generated/shared/c++/HybridKernelHostSpec.cpp +1 -0
- package/nitrogen/generated/shared/c++/HybridKernelHostSpec.hpp +1 -0
- package/nitrogen/generated/shared/c++/HybridSecureInputViewSpec.cpp +22 -0
- package/nitrogen/generated/shared/c++/HybridSecureInputViewSpec.hpp +65 -0
- package/nitrogen/generated/shared/c++/SecureInputState.hpp +84 -0
- package/nitrogen/generated/shared/c++/views/HybridSecureInputViewComponent.cpp +34 -0
- package/nitrogen/generated/shared/c++/views/HybridSecureInputViewComponent.hpp +85 -0
- package/nitrogen/generated/shared/json/SecureInputViewConfig.json +10 -0
- package/package.json +24 -6
- package/scripts/compile-kernel.mjs +7 -3
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
#include "KernelGlobals.hpp"
|
|
2
2
|
|
|
3
3
|
#include "../host/KernelFile.hpp"
|
|
4
|
+
#include "../host/VaultAnchor.hpp"
|
|
4
5
|
|
|
5
6
|
#include "KernelBackends.hpp"
|
|
7
|
+
#include "KernelCardReader.hpp"
|
|
6
8
|
#include "KernelKeystore.hpp"
|
|
7
9
|
#include "KernelPasskey.hpp"
|
|
10
|
+
#include "KernelSecureInput.hpp"
|
|
8
11
|
#include "KernelBuffer.hpp"
|
|
9
12
|
#include "KernelJs.hpp"
|
|
13
|
+
#include "platform/KernelArgon2.hpp"
|
|
10
14
|
#include "platform/KernelPbkdf2.hpp"
|
|
11
15
|
|
|
12
16
|
#include <atomic>
|
|
@@ -23,10 +27,12 @@
|
|
|
23
27
|
|
|
24
28
|
#if defined(__APPLE__) || defined(__ANDROID__)
|
|
25
29
|
#include <pthread.h>
|
|
30
|
+
#include <time.h>
|
|
26
31
|
#include <unistd.h>
|
|
27
32
|
#elif defined(__linux__)
|
|
28
33
|
#include <cerrno>
|
|
29
34
|
#include <sys/random.h>
|
|
35
|
+
#include <time.h>
|
|
30
36
|
#include <unistd.h>
|
|
31
37
|
#endif
|
|
32
38
|
|
|
@@ -42,8 +48,38 @@ constexpr size_t kRandomLimit = 65536;
|
|
|
42
48
|
constexpr double kTimerDelayMax = 2147483647.0;
|
|
43
49
|
constexpr double kPbkdf2IterationsMax = 10000000.0;
|
|
44
50
|
constexpr size_t kPbkdf2LengthMax = 1024;
|
|
51
|
+
|
|
52
|
+
// Argon2id bounds: generous around the one cost the kernel asks for, tight
|
|
53
|
+
// enough that a script cannot make the worker allocate without limit.
|
|
54
|
+
constexpr double kArgon2MemoryKiBMin = 8.0;
|
|
55
|
+
constexpr double kArgon2MemoryKiBMax = 1048576.0;
|
|
56
|
+
constexpr double kArgon2PassesMax = 16.0;
|
|
57
|
+
constexpr double kArgon2LanesMax = 16.0;
|
|
58
|
+
constexpr double kArgon2LengthMin = 4.0;
|
|
59
|
+
constexpr double kArgon2LengthMax = 1024.0;
|
|
45
60
|
constexpr size_t kKdfQueueLimit = 8;
|
|
46
61
|
|
|
62
|
+
// __qntx.elapsed — the session clock behind the 24 h cap. It must keep running
|
|
63
|
+
// while the device is suspended, like the background lock does
|
|
64
|
+
// (cpp/platform/Lifecycle*): steady_clock on Android/Linux is CLOCK_MONOTONIC,
|
|
65
|
+
// which freezes in suspend (LifecycleAndroid.cpp's own comment), so read the
|
|
66
|
+
// suspend-inclusive clock directly. Apple CLOCK_MONOTONIC counts sleep
|
|
67
|
+
// (LifecycleIos.mm relies on the same). Timers stay on steady_clock — a timer
|
|
68
|
+
// delayed by suspend fires on wake, which is the intended policy.
|
|
69
|
+
double elapsedMillis() {
|
|
70
|
+
#if defined(__APPLE__)
|
|
71
|
+
return static_cast<double>(clock_gettime_nsec_np(CLOCK_MONOTONIC)) / 1e6;
|
|
72
|
+
#elif defined(__ANDROID__) || defined(__linux__)
|
|
73
|
+
timespec ts{};
|
|
74
|
+
::clock_gettime(CLOCK_BOOTTIME, &ts);
|
|
75
|
+
return static_cast<double>(ts.tv_sec) * 1e3 + static_cast<double>(ts.tv_nsec) / 1e6;
|
|
76
|
+
#else
|
|
77
|
+
return std::chrono::duration<double, std::milli>(
|
|
78
|
+
std::chrono::steady_clock::now().time_since_epoch())
|
|
79
|
+
.count();
|
|
80
|
+
#endif
|
|
81
|
+
}
|
|
82
|
+
|
|
47
83
|
void fillRandom(uint8_t* out, size_t size) {
|
|
48
84
|
#if defined(__APPLE__) || defined(__ANDROID__)
|
|
49
85
|
arc4random_buf(out, size);
|
|
@@ -64,16 +100,14 @@ void fillRandom(uint8_t* out, size_t size) {
|
|
|
64
100
|
#endif
|
|
65
101
|
}
|
|
66
102
|
|
|
67
|
-
// One process-wide worker runs every
|
|
68
|
-
// spawn unbounded derivation threads. The queue is bounded; the worker
|
|
69
|
-
// is intentionally leaked rather than joined (it parks on the condition
|
|
103
|
+
// One process-wide worker runs every key derivation, so concurrent kernels
|
|
104
|
+
// cannot spawn unbounded derivation threads. The queue is bounded; the worker
|
|
105
|
+
// thread is intentionally leaked rather than joined (it parks on the condition
|
|
70
106
|
// variable and holds no runtime state).
|
|
71
107
|
struct KdfJob {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
SecretBytes
|
|
75
|
-
uint32_t iterations;
|
|
76
|
-
size_t length;
|
|
108
|
+
// Owns its inputs as SecretBytes behind shared_ptr (std::function needs a
|
|
109
|
+
// copyable closure); whichever copy drops last wipes them.
|
|
110
|
+
std::function<SecretBytes()> derive;
|
|
77
111
|
std::shared_ptr<KernelPendingCall> call;
|
|
78
112
|
std::shared_ptr<KernelGlobalsState> state;
|
|
79
113
|
};
|
|
@@ -106,12 +140,11 @@ void kdfWorkerRun() {
|
|
|
106
140
|
SecretBytes derived;
|
|
107
141
|
std::string error;
|
|
108
142
|
try {
|
|
109
|
-
derived =
|
|
110
|
-
job.hash, job.password, job.salt, job.iterations, job.length);
|
|
143
|
+
derived = job.derive();
|
|
111
144
|
} catch (const std::exception& e) {
|
|
112
145
|
error = e.what();
|
|
113
146
|
} catch (...) {
|
|
114
|
-
error = "unknown
|
|
147
|
+
error = "unknown key derivation error";
|
|
115
148
|
}
|
|
116
149
|
if (!job.state->active->load(std::memory_order_acquire)) {
|
|
117
150
|
// Runtime torn down mid-derivation: drop the job; the parked call's
|
|
@@ -177,6 +210,30 @@ bool kdfSubmit(KdfJob job) {
|
|
|
177
210
|
return true;
|
|
178
211
|
}
|
|
179
212
|
|
|
213
|
+
// Parks `done` as a pending call and queues the derivation; a full queue
|
|
214
|
+
// answers through `done` on the kernel thread like any other failure.
|
|
215
|
+
void submitDerivation(
|
|
216
|
+
jsi::Runtime& rt,
|
|
217
|
+
const std::shared_ptr<KernelGlobalsState>& state,
|
|
218
|
+
const jsi::Value& done,
|
|
219
|
+
std::function<SecretBytes()> derive) {
|
|
220
|
+
auto call = std::make_shared<KernelPendingCall>();
|
|
221
|
+
call->done = done.asObject(rt).asFunction(rt);
|
|
222
|
+
state->pending.insert(call);
|
|
223
|
+
if (!kdfSubmit(KdfJob{std::move(derive), call, state})) {
|
|
224
|
+
state->enqueueTask([state, call](jsi::Runtime& rt) mutable {
|
|
225
|
+
auto parked = std::move(call->done);
|
|
226
|
+
state->pending.erase(call);
|
|
227
|
+
if (parked.has_value()) {
|
|
228
|
+
parked->call(
|
|
229
|
+
rt,
|
|
230
|
+
jsi::Value::undefined(),
|
|
231
|
+
jsi::Value(rt, jsi::String::createFromAscii(rt, "kdf queue full")));
|
|
232
|
+
}
|
|
233
|
+
});
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
|
|
180
237
|
void installPbkdf2(
|
|
181
238
|
jsi::Runtime& rt,
|
|
182
239
|
jsi::Object& qntx,
|
|
@@ -205,10 +262,11 @@ void installPbkdf2(
|
|
|
205
262
|
}
|
|
206
263
|
auto passwordView =
|
|
207
264
|
byteViewFromValue(rt, args[1], "__qntx.pbkdf2 password", intrinsics);
|
|
208
|
-
|
|
265
|
+
auto password =
|
|
266
|
+
std::make_shared<SecretBytes>(passwordView.data, passwordView.size);
|
|
209
267
|
auto saltView =
|
|
210
268
|
byteViewFromValue(rt, args[2], "__qntx.pbkdf2 salt", intrinsics);
|
|
211
|
-
|
|
269
|
+
auto salt = std::make_shared<SecretBytes>(saltView.data, saltView.size);
|
|
212
270
|
if (!args[5].isObject() || !args[5].asObject(rt).isFunction(rt)) {
|
|
213
271
|
throw jsi::JSError(
|
|
214
272
|
rt, "__qntx.pbkdf2 expects (hash, password, salt, iterations, length, done)");
|
|
@@ -217,30 +275,45 @@ void installPbkdf2(
|
|
|
217
275
|
integerInRange(rt, args[3], "__qntx.pbkdf2 iterations", 1, kPbkdf2IterationsMax));
|
|
218
276
|
const auto length = static_cast<size_t>(
|
|
219
277
|
integerInRange(rt, args[4], "__qntx.pbkdf2 length", 1, kPbkdf2LengthMax));
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
jsi::Value::undefined(),
|
|
240
|
-
jsi::Value(rt, jsi::String::createFromAscii(rt, "kdf queue full")));
|
|
241
|
-
}
|
|
242
|
-
});
|
|
278
|
+
submitDerivation(rt, state, args[5], [hash, password, salt, iterations, length] {
|
|
279
|
+
return kernelPbkdf2(hash, *password, *salt, iterations, length);
|
|
280
|
+
});
|
|
281
|
+
return jsi::Value::undefined();
|
|
282
|
+
}));
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
void installArgon2id(
|
|
286
|
+
jsi::Runtime& rt,
|
|
287
|
+
jsi::Object& qntx,
|
|
288
|
+
const std::shared_ptr<KernelGlobalsState>& state) {
|
|
289
|
+
qntx.setProperty(
|
|
290
|
+
rt,
|
|
291
|
+
"argon2id",
|
|
292
|
+
hostFn(rt, "argon2id", 7, [state](jsi::Runtime& rt, const jsi::Value&, const jsi::Value* args, size_t count) -> jsi::Value {
|
|
293
|
+
const char* usage =
|
|
294
|
+
"__qntx.argon2id expects (password, salt, memoryKiB, passes, lanes, length, done)";
|
|
295
|
+
if (count < 7 || !args[6].isObject() || !args[6].asObject(rt).isFunction(rt)) {
|
|
296
|
+
throw jsi::JSError(rt, usage);
|
|
243
297
|
}
|
|
298
|
+
const auto& intrinsics = *state->intrinsics;
|
|
299
|
+
auto passwordView =
|
|
300
|
+
byteViewFromValue(rt, args[0], "__qntx.argon2id password", intrinsics);
|
|
301
|
+
auto password =
|
|
302
|
+
std::make_shared<SecretBytes>(passwordView.data, passwordView.size);
|
|
303
|
+
auto saltView =
|
|
304
|
+
byteViewFromValue(rt, args[1], "__qntx.argon2id salt", intrinsics);
|
|
305
|
+
auto salt = std::make_shared<SecretBytes>(saltView.data, saltView.size);
|
|
306
|
+
const auto memoryKiB = static_cast<uint32_t>(integerInRange(
|
|
307
|
+
rt, args[2], "__qntx.argon2id memoryKiB", kArgon2MemoryKiBMin, kArgon2MemoryKiBMax));
|
|
308
|
+
const auto passes = static_cast<uint32_t>(
|
|
309
|
+
integerInRange(rt, args[3], "__qntx.argon2id passes", 1, kArgon2PassesMax));
|
|
310
|
+
const auto lanes = static_cast<uint32_t>(
|
|
311
|
+
integerInRange(rt, args[4], "__qntx.argon2id lanes", 1, kArgon2LanesMax));
|
|
312
|
+
const auto length = static_cast<size_t>(integerInRange(
|
|
313
|
+
rt, args[5], "__qntx.argon2id length", kArgon2LengthMin, kArgon2LengthMax));
|
|
314
|
+
submitDerivation(rt, state, args[6], [password, salt, memoryKiB, passes, lanes, length] {
|
|
315
|
+
return kernelArgon2id(*password, *salt, memoryKiB, passes, lanes, length);
|
|
316
|
+
});
|
|
244
317
|
return jsi::Value::undefined();
|
|
245
318
|
}));
|
|
246
319
|
}
|
|
@@ -356,9 +429,7 @@ void installKernelGlobals(
|
|
|
356
429
|
rt,
|
|
357
430
|
"elapsed",
|
|
358
431
|
hostFn(rt, "elapsed", 0, [](jsi::Runtime&, const jsi::Value&, const jsi::Value*, size_t) -> jsi::Value {
|
|
359
|
-
return jsi::Value(
|
|
360
|
-
std::chrono::steady_clock::now().time_since_epoch())
|
|
361
|
-
.count());
|
|
432
|
+
return jsi::Value(elapsedMillis());
|
|
362
433
|
}));
|
|
363
434
|
|
|
364
435
|
const auto makeSetTimer = [&state](jsi::Runtime& rt) -> jsi::Function {
|
|
@@ -382,10 +453,10 @@ void installKernelGlobals(
|
|
|
382
453
|
qntx.setProperty(rt, "setTimer", makeSetTimer(rt));
|
|
383
454
|
|
|
384
455
|
installPbkdf2(rt, qntx, state);
|
|
456
|
+
installArgon2id(rt, qntx, state);
|
|
385
457
|
|
|
386
458
|
// __qntx.frames — the W2b injection-table shape over the same plumbing:
|
|
387
|
-
// post
|
|
388
|
-
// when it refuses a frame on integrity grounds).
|
|
459
|
+
// post and onMessage.
|
|
389
460
|
auto frames = jsi::Object(rt);
|
|
390
461
|
frames.setProperty(
|
|
391
462
|
rt,
|
|
@@ -396,7 +467,7 @@ void installKernelGlobals(
|
|
|
396
467
|
}
|
|
397
468
|
auto buffer = args[0].asObject(rt).getArrayBuffer(rt);
|
|
398
469
|
const auto* data = buffer.data(rt);
|
|
399
|
-
state->postToHost(
|
|
470
|
+
state->postToHost(qntx::SecretBytes(data, buffer.size(rt)));
|
|
400
471
|
return jsi::Value::undefined();
|
|
401
472
|
}));
|
|
402
473
|
frames.setProperty(
|
|
@@ -409,23 +480,16 @@ void installKernelGlobals(
|
|
|
409
480
|
state->messageHandler = args[0].asObject(rt).asFunction(rt);
|
|
410
481
|
return jsi::Value::undefined();
|
|
411
482
|
}));
|
|
412
|
-
frames.setProperty(
|
|
413
|
-
rt,
|
|
414
|
-
"onIntegrityViolation",
|
|
415
|
-
hostFn(rt, "frames.onIntegrityViolation", 1, [state](jsi::Runtime& rt, const jsi::Value&, const jsi::Value* args, size_t count) -> jsi::Value {
|
|
416
|
-
if (count < 1 || !args[0].isObject() || !args[0].asObject(rt).isFunction(rt)) {
|
|
417
|
-
throw jsi::JSError(rt, "__qntx.frames.onIntegrityViolation expects a function");
|
|
418
|
-
}
|
|
419
|
-
state->integrityHandler = args[0].asObject(rt).asFunction(rt);
|
|
420
|
-
return jsi::Value::undefined();
|
|
421
|
-
}));
|
|
422
483
|
intrinsics->freeze.call(rt, jsi::Value(rt, frames));
|
|
423
484
|
qntx.setProperty(rt, "frames", jsi::Value(std::move(frames)));
|
|
424
485
|
|
|
425
486
|
// __qntx.file — one opaque file image: read() -> Uint8Array | undefined,
|
|
426
|
-
//
|
|
427
|
-
//
|
|
428
|
-
//
|
|
487
|
+
// replace(next, expected?) atomically swaps the file only when its current
|
|
488
|
+
// bytes equal `expected` (undefined = the file must not exist), returning
|
|
489
|
+
// false on a lost race so the file store fails `conflict` instead of
|
|
490
|
+
// clobbering a concurrent writer. The C++ primitive serializes writers under
|
|
491
|
+
// a flock and owns durability (temp + fsync + rename + dir fsync); failures
|
|
492
|
+
// throw so the file store rejects instead of silently degrading.
|
|
429
493
|
auto file = jsi::Object(rt);
|
|
430
494
|
file.setProperty(
|
|
431
495
|
rt,
|
|
@@ -440,23 +504,72 @@ void installKernelGlobals(
|
|
|
440
504
|
}));
|
|
441
505
|
file.setProperty(
|
|
442
506
|
rt,
|
|
443
|
-
"
|
|
444
|
-
hostFn(rt, "file.
|
|
507
|
+
"replace",
|
|
508
|
+
hostFn(rt, "file.replace", 2, [state](jsi::Runtime& rt, const jsi::Value&, const jsi::Value* args, size_t count) -> jsi::Value {
|
|
445
509
|
if (count < 1) {
|
|
446
|
-
throw jsi::JSError(rt, "__qntx.file.
|
|
510
|
+
throw jsi::JSError(rt, "__qntx.file.replace expects (next, expected?)");
|
|
447
511
|
}
|
|
448
|
-
const auto
|
|
449
|
-
byteViewFromValue(rt, args[0], "__qntx.file.
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
512
|
+
const auto next =
|
|
513
|
+
byteViewFromValue(rt, args[0], "__qntx.file.replace next", *state->intrinsics);
|
|
514
|
+
std::optional<std::vector<uint8_t>> expected;
|
|
515
|
+
if (count >= 2 && !args[1].isUndefined()) {
|
|
516
|
+
const auto expectedView = byteViewFromValue(
|
|
517
|
+
rt, args[1], "__qntx.file.replace expected", *state->intrinsics);
|
|
518
|
+
expected =
|
|
519
|
+
std::vector<uint8_t>(expectedView.data, expectedView.data + expectedView.size);
|
|
520
|
+
}
|
|
521
|
+
return jsi::Value(
|
|
522
|
+
kernelFileReplace(state->vaultDirectory, next.data, next.size, expected));
|
|
453
523
|
}));
|
|
454
524
|
intrinsics->freeze.call(rt, jsi::Value(rt, file));
|
|
455
525
|
qntx.setProperty(rt, "file", jsi::Value(std::move(file)));
|
|
456
526
|
|
|
527
|
+
// __qntx.anchor — the vault anchor behind platform.anchor: a few bytes of
|
|
528
|
+
// kernel state held outside the vault file (platform keystore) so a host
|
|
529
|
+
// that restores an older vault image cannot restore the revision floor or
|
|
530
|
+
// the failure counters with it. read() -> Uint8Array | undefined;
|
|
531
|
+
// replace(next, expected?) is the compare-and-swap the C++ side serializes
|
|
532
|
+
// under one process-wide mutex. Platform failures throw so the kernel maps
|
|
533
|
+
// them to `unavailable` instead of silently degrading.
|
|
534
|
+
auto anchor = jsi::Object(rt);
|
|
535
|
+
anchor.setProperty(
|
|
536
|
+
rt,
|
|
537
|
+
"read",
|
|
538
|
+
hostFn(rt, "anchor.read", 0, [state](jsi::Runtime& rt, const jsi::Value&, const jsi::Value*, size_t) -> jsi::Value {
|
|
539
|
+
const auto bytes = vaultAnchorRead();
|
|
540
|
+
if (!bytes.has_value()) {
|
|
541
|
+
return jsi::Value::undefined();
|
|
542
|
+
}
|
|
543
|
+
auto buffer = arrayBufferFromBytes(rt, bytes->data(), bytes->size());
|
|
544
|
+
return jsi::Value(rt, makeUint8Array(rt, *state->intrinsics, std::move(buffer)));
|
|
545
|
+
}));
|
|
546
|
+
anchor.setProperty(
|
|
547
|
+
rt,
|
|
548
|
+
"replace",
|
|
549
|
+
hostFn(rt, "anchor.replace", 2, [state](jsi::Runtime& rt, const jsi::Value&, const jsi::Value* args, size_t count) -> jsi::Value {
|
|
550
|
+
if (count < 1) {
|
|
551
|
+
throw jsi::JSError(rt, "__qntx.anchor.replace expects (next, expected?)");
|
|
552
|
+
}
|
|
553
|
+
const auto next =
|
|
554
|
+
byteViewFromValue(rt, args[0], "__qntx.anchor.replace next", *state->intrinsics);
|
|
555
|
+
std::optional<std::vector<uint8_t>> expected;
|
|
556
|
+
if (count >= 2 && !args[1].isUndefined()) {
|
|
557
|
+
const auto expectedView = byteViewFromValue(
|
|
558
|
+
rt, args[1], "__qntx.anchor.replace expected", *state->intrinsics);
|
|
559
|
+
expected =
|
|
560
|
+
std::vector<uint8_t>(expectedView.data, expectedView.data + expectedView.size);
|
|
561
|
+
}
|
|
562
|
+
return jsi::Value(
|
|
563
|
+
vaultAnchorReplace(next.data, next.size, expected));
|
|
564
|
+
}));
|
|
565
|
+
intrinsics->freeze.call(rt, jsi::Value(rt, anchor));
|
|
566
|
+
qntx.setProperty(rt, "anchor", jsi::Value(std::move(anchor)));
|
|
567
|
+
|
|
457
568
|
installKernelBackends(rt, qntx, *intrinsics);
|
|
458
569
|
installKernelKeystore(rt, qntx, state);
|
|
459
570
|
installKernelPasskey(rt, qntx, state);
|
|
571
|
+
installKernelCardReader(rt, qntx, state);
|
|
572
|
+
installKernelSecureInput(rt, qntx, state);
|
|
460
573
|
|
|
461
574
|
intrinsics->freeze.call(rt, jsi::Value(rt, qntx));
|
|
462
575
|
defineHiddenGlobal(rt, *intrinsics, "__qntx", jsi::Value(std::move(qntx)));
|
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
#include <jsi/jsi.h>
|
|
4
4
|
|
|
5
|
+
#include "../host/CardReader.hpp"
|
|
6
|
+
#include "KernelBuffer.hpp"
|
|
7
|
+
|
|
5
8
|
#include <atomic>
|
|
6
9
|
#include <chrono>
|
|
7
10
|
#include <cstdint>
|
|
@@ -33,12 +36,14 @@ struct KernelIntrinsics;
|
|
|
33
36
|
struct KernelGlobalsState {
|
|
34
37
|
// Directory the vault image file lives in — resolved by the host once per
|
|
35
38
|
// KernelRuntime::start (platformVaultDirectory on device builds) and passed
|
|
36
|
-
// to kernelFileRead/
|
|
39
|
+
// to kernelFileRead/kernelFileReplace by the __qntx.file lambdas. Kernel
|
|
37
40
|
// thread only after start().
|
|
38
41
|
std::string vaultDirectory;
|
|
39
42
|
|
|
40
43
|
// Copies the posted bytes out of the runtime and reports them to the host.
|
|
41
|
-
|
|
44
|
+
// The SecretBytes wipes itself on scope exit — the host's copy into the JS
|
|
45
|
+
// ArrayBuffer is the only one that outlives the call.
|
|
46
|
+
std::function<void(SecretBytes)> postToHost;
|
|
42
47
|
|
|
43
48
|
// Records a fatal kernel failure reported by JS (unhandled promise
|
|
44
49
|
// rejection). The runtime tears down after the current task drains.
|
|
@@ -74,10 +79,10 @@ struct KernelGlobalsState {
|
|
|
74
79
|
// Kernel thread only.
|
|
75
80
|
std::optional<facebook::jsi::Function> messageHandler;
|
|
76
81
|
|
|
77
|
-
//
|
|
78
|
-
//
|
|
79
|
-
//
|
|
80
|
-
std::
|
|
82
|
+
// The process-shared NFC reader behind __qntx.cardReader; injected by the
|
|
83
|
+
// host through KernelRuntime::Hooks so tests and platforms can substitute
|
|
84
|
+
// their own.
|
|
85
|
+
std::shared_ptr<CardReader> cardReader;
|
|
81
86
|
|
|
82
87
|
// Dismiss in-flight system prompts (keystore, passkey); each installer adds
|
|
83
88
|
// one and teardown runs them all. Kernel thread only.
|
|
@@ -86,7 +91,8 @@ struct KernelGlobalsState {
|
|
|
86
91
|
|
|
87
92
|
// Installs the kernel's capabilities on a fresh runtime:
|
|
88
93
|
// globalThis.__qntx frozen { random, now, elapsed, setTimer, pbkdf2, file,
|
|
89
|
-
// frames, backends, keystore, passkey
|
|
94
|
+
// anchor, frames, backends, keystore, passkey,
|
|
95
|
+
// cardReader, secureInput }
|
|
90
96
|
// globalThis.crypto frozen { getRandomValues }
|
|
91
97
|
// globalThis.TextDecoder the native Hermes decoder (260318099+), frozen
|
|
92
98
|
// and rebound hidden
|
package/cpp/runtime/KernelJs.cpp
CHANGED
|
@@ -23,6 +23,20 @@ double finiteNumber(jsi::Runtime& rt, const jsi::Value& value, const char* name)
|
|
|
23
23
|
return value.getNumber();
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
+
jsi::Value detailValue(jsi::Runtime& rt, const std::string& detail) {
|
|
27
|
+
if (detail.empty() || detail.size() > 80) {
|
|
28
|
+
return jsi::Value::undefined();
|
|
29
|
+
}
|
|
30
|
+
for (const char c : detail) {
|
|
31
|
+
const bool ok = (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') ||
|
|
32
|
+
(c >= '0' && c <= '9') || c == '_' || c == '.' || c == ':' || c == '-';
|
|
33
|
+
if (!ok) {
|
|
34
|
+
return jsi::Value::undefined();
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return jsi::Value(rt, jsi::String::createFromAscii(rt, detail));
|
|
38
|
+
}
|
|
39
|
+
|
|
26
40
|
uint64_t integerInRange(
|
|
27
41
|
jsi::Runtime& rt,
|
|
28
42
|
const jsi::Value& value,
|
package/cpp/runtime/KernelJs.hpp
CHANGED
|
@@ -42,6 +42,10 @@ void defineHiddenGlobal(
|
|
|
42
42
|
|
|
43
43
|
double finiteNumber(jsi::Runtime& rt, const jsi::Value& value, const char* name);
|
|
44
44
|
|
|
45
|
+
// A detail is a "<domain>:<code>" diagnostic the JS side validates again;
|
|
46
|
+
// pass it through only while it stays a short token string.
|
|
47
|
+
jsi::Value detailValue(jsi::Runtime& rt, const std::string& detail);
|
|
48
|
+
|
|
45
49
|
uint64_t integerInRange(
|
|
46
50
|
jsi::Runtime& rt,
|
|
47
51
|
const jsi::Value& value,
|
|
@@ -71,8 +71,8 @@ const char* errorCode(KeystoreStatus status) {
|
|
|
71
71
|
return "cancelled";
|
|
72
72
|
case KeystoreStatus::invalidated:
|
|
73
73
|
return "factor-invalidated";
|
|
74
|
-
case KeystoreStatus::
|
|
75
|
-
return "
|
|
74
|
+
case KeystoreStatus::noLockScreen:
|
|
75
|
+
return "verification-unavailable";
|
|
76
76
|
case KeystoreStatus::ok:
|
|
77
77
|
case KeystoreStatus::unavailable:
|
|
78
78
|
case KeystoreStatus::failed:
|
|
@@ -173,6 +173,7 @@ void installKernelKeystore(
|
|
|
173
173
|
|
|
174
174
|
auto keystore = jsi::Object(rt);
|
|
175
175
|
keystore.setProperty(rt, "locale", jsi::String::createFromUtf8(rt, keystoreLocale()));
|
|
176
|
+
keystore.setProperty(rt, "platform", jsi::String::createFromUtf8(rt, keystorePlatform()));
|
|
176
177
|
keystore.setProperty(
|
|
177
178
|
rt,
|
|
178
179
|
"seal",
|
|
@@ -211,6 +212,81 @@ void installKernelKeystore(
|
|
|
211
212
|
keystoreOpen(id, std::move(sealed), std::move(prompt), std::move(done));
|
|
212
213
|
return jsi::Value::undefined();
|
|
213
214
|
}));
|
|
215
|
+
keystore.setProperty(
|
|
216
|
+
rt,
|
|
217
|
+
"sealDevice",
|
|
218
|
+
hostFn(rt, "keystore.sealDevice", 3, [state, calls](jsi::Runtime& rt, const jsi::Value&, const jsi::Value* args, size_t count) -> jsi::Value {
|
|
219
|
+
if (count < 3) {
|
|
220
|
+
throw jsi::JSError(
|
|
221
|
+
rt, "__qntx.keystore.sealDevice expects (id, secret, done)");
|
|
222
|
+
}
|
|
223
|
+
auto id = factorId(rt, args[0], "__qntx.keystore.sealDevice");
|
|
224
|
+
auto view =
|
|
225
|
+
byteViewFromValue(rt, args[1], "__qntx.keystore.sealDevice secret", *state->intrinsics);
|
|
226
|
+
if (view.size != kSecretLength) {
|
|
227
|
+
throw jsi::JSError(rt, "__qntx.keystore.sealDevice secret must be 32 bytes");
|
|
228
|
+
}
|
|
229
|
+
SecretBytes secret(view.data, view.size);
|
|
230
|
+
auto done = park(state, calls, callbackFrom(rt, args[2], "__qntx.keystore.sealDevice"), true);
|
|
231
|
+
keystoreSealDevice(id, std::move(secret), std::move(done));
|
|
232
|
+
return jsi::Value::undefined();
|
|
233
|
+
}));
|
|
234
|
+
keystore.setProperty(
|
|
235
|
+
rt,
|
|
236
|
+
"openDevice",
|
|
237
|
+
hostFn(rt, "keystore.openDevice", 3, [state, calls](jsi::Runtime& rt, const jsi::Value&, const jsi::Value* args, size_t count) -> jsi::Value {
|
|
238
|
+
if (count < 3) {
|
|
239
|
+
throw jsi::JSError(
|
|
240
|
+
rt, "__qntx.keystore.openDevice expects (id, sealed, done)");
|
|
241
|
+
}
|
|
242
|
+
auto id = factorId(rt, args[0], "__qntx.keystore.openDevice");
|
|
243
|
+
auto view =
|
|
244
|
+
byteViewFromValue(rt, args[1], "__qntx.keystore.openDevice sealed", *state->intrinsics);
|
|
245
|
+
if (view.size == 0 || view.size > kSealedMax) {
|
|
246
|
+
throw jsi::JSError(rt, "__qntx.keystore.openDevice sealed length is out of range");
|
|
247
|
+
}
|
|
248
|
+
std::vector<uint8_t> sealed(view.data, view.data + view.size);
|
|
249
|
+
auto done = park(state, calls, callbackFrom(rt, args[2], "__qntx.keystore.openDevice"), true);
|
|
250
|
+
keystoreOpenDevice(id, std::move(sealed), std::move(done));
|
|
251
|
+
return jsi::Value::undefined();
|
|
252
|
+
}));
|
|
253
|
+
keystore.setProperty(
|
|
254
|
+
rt,
|
|
255
|
+
"probe",
|
|
256
|
+
hostFn(rt, "keystore.probe", 3, [state, calls](jsi::Runtime& rt, const jsi::Value&, const jsi::Value* args, size_t count) -> jsi::Value {
|
|
257
|
+
if (count < 3) {
|
|
258
|
+
throw jsi::JSError(rt, "__qntx.keystore.probe expects (id, protection, done)");
|
|
259
|
+
}
|
|
260
|
+
auto id = factorId(rt, args[0], "__qntx.keystore.probe");
|
|
261
|
+
if (!args[1].isString()) {
|
|
262
|
+
throw jsi::JSError(rt, "__qntx.keystore.probe protection must be a string");
|
|
263
|
+
}
|
|
264
|
+
const auto protection = args[1].asString(rt).utf8(rt);
|
|
265
|
+
KeyProtection kind;
|
|
266
|
+
if (protection == "device") {
|
|
267
|
+
kind = KeyProtection::device;
|
|
268
|
+
} else if (protection == "presence") {
|
|
269
|
+
kind = KeyProtection::presence;
|
|
270
|
+
} else {
|
|
271
|
+
throw jsi::JSError(
|
|
272
|
+
rt, "__qntx.keystore.probe protection must be \"device\" or \"presence\"");
|
|
273
|
+
}
|
|
274
|
+
auto done = park(state, calls, callbackFrom(rt, args[2], "__qntx.keystore.probe"), false);
|
|
275
|
+
keystoreProbe(id, kind, std::move(done));
|
|
276
|
+
return jsi::Value::undefined();
|
|
277
|
+
}));
|
|
278
|
+
keystore.setProperty(
|
|
279
|
+
rt,
|
|
280
|
+
"remove",
|
|
281
|
+
hostFn(rt, "keystore.remove", 2, [state, calls](jsi::Runtime& rt, const jsi::Value&, const jsi::Value* args, size_t count) -> jsi::Value {
|
|
282
|
+
if (count < 2) {
|
|
283
|
+
throw jsi::JSError(rt, "__qntx.keystore.remove expects (id, done)");
|
|
284
|
+
}
|
|
285
|
+
auto id = factorId(rt, args[0], "__qntx.keystore.remove");
|
|
286
|
+
auto done = park(state, calls, callbackFrom(rt, args[1], "__qntx.keystore.remove"), false);
|
|
287
|
+
keystoreRemove(id, std::move(done));
|
|
288
|
+
return jsi::Value::undefined();
|
|
289
|
+
}));
|
|
214
290
|
keystore.setProperty(
|
|
215
291
|
rt,
|
|
216
292
|
"authenticate",
|
|
@@ -11,6 +11,7 @@ struct KernelGlobalsState;
|
|
|
11
11
|
// Installs the frozen `keystore` object on `__qntx` before the caller freezes
|
|
12
12
|
// it:
|
|
13
13
|
// locale platform language (BCP 47)
|
|
14
|
+
// platform "ios" | "android"
|
|
14
15
|
// seal(id, secret, title, description, done) done(sealed | undefined, code | undefined)
|
|
15
16
|
// open(id, sealed, title, description, done) done(kek | undefined, code | undefined)
|
|
16
17
|
// authenticate(title, description, done) done(undefined, code | undefined)
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
#include <utility>
|
|
5
5
|
|
|
6
6
|
#include "../host/Passkey.hpp"
|
|
7
|
+
#include "KernelBuffer.hpp"
|
|
7
8
|
#include "KernelGlobals.hpp"
|
|
8
9
|
#include "KernelJs.hpp"
|
|
9
10
|
|
|
@@ -31,20 +32,21 @@ const char* errorCode(PasskeyStatus status) {
|
|
|
31
32
|
return "unavailable";
|
|
32
33
|
}
|
|
33
34
|
|
|
34
|
-
//
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
if (detail.empty() || detail.size() > 80) {
|
|
35
|
+
// `{ first, second? }` Uint8Arrays over the platform's PRF outputs, or undefined when it gave none.
|
|
36
|
+
jsi::Value prfValue(jsi::Runtime& rt, KernelGlobalsState& state, const PasskeyResult& result) {
|
|
37
|
+
if (result.prfFirst.size() == 0) {
|
|
38
38
|
return jsi::Value::undefined();
|
|
39
39
|
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
40
|
+
auto bytes = [&](const SecretBytes& secret) {
|
|
41
|
+
return makeUint8Array(
|
|
42
|
+
rt, *state.intrinsics, arrayBufferFromBytes(rt, secret.data(), secret.size()));
|
|
43
|
+
};
|
|
44
|
+
auto prf = jsi::Object(rt);
|
|
45
|
+
prf.setProperty(rt, "first", bytes(result.prfFirst));
|
|
46
|
+
if (result.prfSecond.size() != 0) {
|
|
47
|
+
prf.setProperty(rt, "second", bytes(result.prfSecond));
|
|
46
48
|
}
|
|
47
|
-
return jsi::Value(rt,
|
|
49
|
+
return jsi::Value(rt, prf);
|
|
48
50
|
}
|
|
49
51
|
|
|
50
52
|
struct PasskeyCalls {
|
|
@@ -101,7 +103,8 @@ PasskeyDone park(
|
|
|
101
103
|
rt,
|
|
102
104
|
jsi::Value(rt, jsi::String::createFromUtf8(rt, shared->responseJson)),
|
|
103
105
|
jsi::Value::undefined(),
|
|
104
|
-
jsi::Value::undefined()
|
|
106
|
+
jsi::Value::undefined(),
|
|
107
|
+
prfValue(rt, *state, *shared));
|
|
105
108
|
});
|
|
106
109
|
};
|
|
107
110
|
}
|