@qntx/wallet-native 0.10.0 → 0.12.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 +6 -5
- package/android/src/main/java/com/margelo/nitro/qntxwallet/Keystore.kt +42 -27
- package/android/src/main/java/com/margelo/nitro/qntxwallet/Passkey.kt +26 -11
- package/cpp/host/Keystore.hpp +13 -3
- package/cpp/host/Passkey.hpp +13 -3
- package/cpp/platform/KeystoreAndroid.cpp +10 -2
- package/cpp/platform/KeystoreIos.mm +55 -11
- package/cpp/platform/PasskeyAndroid.cpp +10 -1
- package/cpp/platform/PasskeyIos.mm +26 -6
- package/cpp/runtime/KernelKeystore.cpp +25 -6
- package/cpp/runtime/KernelPasskey.cpp +24 -3
- package/kernel/generated/kernel-entry.js +206 -133
- package/kernel/generated/kernel.manifest.json +5 -5
- package/package.json +5 -5
|
@@ -71,15 +71,32 @@ 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::noDeviceCredential:
|
|
75
|
+
return "no-device-credential";
|
|
76
76
|
case KeystoreStatus::ok:
|
|
77
|
+
case KeystoreStatus::unavailable:
|
|
77
78
|
case KeystoreStatus::failed:
|
|
78
79
|
break;
|
|
79
80
|
}
|
|
80
81
|
return "unavailable";
|
|
81
82
|
}
|
|
82
83
|
|
|
84
|
+
// A detail is a "<domain>:<code>" diagnostic the JS side validates again;
|
|
85
|
+
// pass it through only while it stays a short token string.
|
|
86
|
+
jsi::Value detailValue(jsi::Runtime& rt, const std::string& detail) {
|
|
87
|
+
if (detail.empty() || detail.size() > 80) {
|
|
88
|
+
return jsi::Value::undefined();
|
|
89
|
+
}
|
|
90
|
+
for (const char c : detail) {
|
|
91
|
+
const bool ok = (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') ||
|
|
92
|
+
(c >= '0' && c <= '9') || c == '_' || c == '.' || c == ':' || c == '-';
|
|
93
|
+
if (!ok) {
|
|
94
|
+
return jsi::Value::undefined();
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
return jsi::Value(rt, jsi::String::createFromAscii(rt, detail));
|
|
98
|
+
}
|
|
99
|
+
|
|
83
100
|
// Shared by every keystore call of one runtime: the number of platform calls
|
|
84
101
|
// whose completion has not yet returned (kernel thread only).
|
|
85
102
|
struct KeystoreCalls {
|
|
@@ -118,23 +135,25 @@ KeystoreDone park(
|
|
|
118
135
|
done->call(
|
|
119
136
|
rt,
|
|
120
137
|
jsi::Value::undefined(),
|
|
121
|
-
jsi::Value(rt, jsi::String::createFromAscii(rt, errorCode(shared->status)))
|
|
138
|
+
jsi::Value(rt, jsi::String::createFromAscii(rt, errorCode(shared->status))),
|
|
139
|
+
detailValue(rt, shared->detail));
|
|
122
140
|
return;
|
|
123
141
|
}
|
|
124
142
|
if (!withBytes) {
|
|
125
|
-
done->call(rt, jsi::Value::undefined(), jsi::Value::undefined());
|
|
143
|
+
done->call(rt, jsi::Value::undefined(), jsi::Value::undefined(), jsi::Value::undefined());
|
|
126
144
|
return;
|
|
127
145
|
}
|
|
128
146
|
if (shared->bytes.size() == 0) {
|
|
129
147
|
done->call(
|
|
130
148
|
rt,
|
|
131
149
|
jsi::Value::undefined(),
|
|
132
|
-
jsi::Value(rt, jsi::String::createFromAscii(rt, errorCode(KeystoreStatus::failed)))
|
|
150
|
+
jsi::Value(rt, jsi::String::createFromAscii(rt, errorCode(KeystoreStatus::failed))),
|
|
151
|
+
jsi::Value::undefined());
|
|
133
152
|
return;
|
|
134
153
|
}
|
|
135
154
|
auto buffer = arrayBufferFromBytes(rt, shared->bytes.data(), shared->bytes.size());
|
|
136
155
|
auto array = makeUint8Array(rt, *state->intrinsics, std::move(buffer));
|
|
137
|
-
done->call(rt, jsi::Value(std::move(array)), jsi::Value::undefined());
|
|
156
|
+
done->call(rt, jsi::Value(std::move(array)), jsi::Value::undefined(), jsi::Value::undefined());
|
|
138
157
|
});
|
|
139
158
|
};
|
|
140
159
|
}
|
|
@@ -19,15 +19,34 @@ const char* errorCode(PasskeyStatus status) {
|
|
|
19
19
|
switch (status) {
|
|
20
20
|
case PasskeyStatus::cancelled:
|
|
21
21
|
return "cancelled";
|
|
22
|
-
case PasskeyStatus::
|
|
23
|
-
return "
|
|
22
|
+
case PasskeyStatus::notConfigured:
|
|
23
|
+
return "passkey-not-configured";
|
|
24
|
+
case PasskeyStatus::unsupported:
|
|
25
|
+
return "unsupported";
|
|
24
26
|
case PasskeyStatus::ok:
|
|
27
|
+
case PasskeyStatus::unavailable:
|
|
25
28
|
case PasskeyStatus::failed:
|
|
26
29
|
break;
|
|
27
30
|
}
|
|
28
31
|
return "unavailable";
|
|
29
32
|
}
|
|
30
33
|
|
|
34
|
+
// A detail is a "<domain>:<code>" diagnostic the JS side validates again;
|
|
35
|
+
// pass it through only while it stays a short token string.
|
|
36
|
+
jsi::Value detailValue(jsi::Runtime& rt, const std::string& detail) {
|
|
37
|
+
if (detail.empty() || detail.size() > 80) {
|
|
38
|
+
return jsi::Value::undefined();
|
|
39
|
+
}
|
|
40
|
+
for (const char c : detail) {
|
|
41
|
+
const bool ok = (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') ||
|
|
42
|
+
(c >= '0' && c <= '9') || c == '_' || c == '.' || c == ':' || c == '-';
|
|
43
|
+
if (!ok) {
|
|
44
|
+
return jsi::Value::undefined();
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return jsi::Value(rt, jsi::String::createFromAscii(rt, detail));
|
|
48
|
+
}
|
|
49
|
+
|
|
31
50
|
struct PasskeyCalls {
|
|
32
51
|
int inFlight = 0; // kernel thread only
|
|
33
52
|
};
|
|
@@ -74,12 +93,14 @@ PasskeyDone park(
|
|
|
74
93
|
done->call(
|
|
75
94
|
rt,
|
|
76
95
|
jsi::Value::undefined(),
|
|
77
|
-
jsi::Value(rt, jsi::String::createFromAscii(rt, errorCode(status)))
|
|
96
|
+
jsi::Value(rt, jsi::String::createFromAscii(rt, errorCode(status))),
|
|
97
|
+
detailValue(rt, shared->detail));
|
|
78
98
|
return;
|
|
79
99
|
}
|
|
80
100
|
done->call(
|
|
81
101
|
rt,
|
|
82
102
|
jsi::Value(rt, jsi::String::createFromUtf8(rt, shared->responseJson)),
|
|
103
|
+
jsi::Value::undefined(),
|
|
83
104
|
jsi::Value::undefined());
|
|
84
105
|
});
|
|
85
106
|
};
|