Commit 645bb47
feat(sdk-ffi): structured SigningKeyUnavailable discriminator across the signer wire
Replace end-to-end message sniffing for the signer's "missing key" failure
with a typed discriminator (dashpay#4060 finding 7):
- rs-sdk-ffi: DashSDKSignerErrorCode { Generic = 0, SigningKeyUnavailable =
1, AuthenticationFailed = 2 (reserved) }; SignCompletionCallback and
dash_sdk_sign_async_completion gain error_code: i32 (before
error_message). SignResult stays Result<Vec<u8>, ProtocolError> (a new
rs-dpp ProtocolError variant would carry serialization blast radius), so
code 1 rides the single Rust-owned machine prefix
DASH_SDK_SIGNER_ERR_KEY_UNAVAILABLE_PREFIX through
ProtocolError::Generic — typed at both ABI edges, one constant bridging
the string segment. This is an internal coordinated ABI change: every
piece versions together in this monorepo.
- rs-platform-wallet-ffi: PlatformWalletFFIResultCode::
ErrorSigningKeyUnavailable = 31 (codes 26-28 are reserved for dashpay#4185's
reservation-token errors and 29/30 for dashpay#4184's asset-lock errors on
sibling branches — documented in the enum as dashpay#4184 does). The
From<dpp::ProtocolError> conversion restores the typed code from the
prefix FIRST (before the loose keyword sniffs), and the
From<PlatformWalletError> blanket impl restores it on the catch-all only
(dedicated retry-semantics codes are never overridden) — covering the
Sdk(dash_sdk::Error::Protocol(..)) wrapping path.
- JNI/Kotlin: SignerNative.completeSign(token, signature, errorCode,
errorMessage); KeystoreSigner passes SIGNER_ERROR_CODE_KEY_UNAVAILABLE on
the null-key branch (keeping the MESSAGE_MARKER text for the transition
window) and Generic everywhere else. DashSdkError maps 31 →
PlatformWallet.SigningKeyUnavailable; the dashpay#4191 marker sniff on the
catch-all codes remains as a deprecated old-native fallback with a
removal note tied to the next minor release.
- Swift: KeychainSigner trampolines forward the code (missing-row /
missing-scalar outcomes classify as 1); PlatformWalletResultCode gains
errorSigningKeyUnavailable = 31 → PlatformWalletError
.signingKeyUnavailable (Kotlin parity).
- Tests: rs-sdk-ffi completion-code tests (prefix present for code 1,
absent for generic), platform-wallet-ffi prefix→31 tests on both
conversion points, Kotlin code-31 + fallback-marker tests, Swift mapping
and trampoline-classifier tests.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>1 parent f66be6a commit 645bb47
21 files changed
Lines changed: 446 additions & 52 deletions
File tree
- packages
- kotlin-sdk/sdk/src
- main/kotlin/org/dashfoundation/dashsdk
- errors
- ffi
- security
- test/kotlin/org/dashfoundation/dashsdk/errors
- rs-platform-wallet-ffi/src
- rs-sdk-ffi/src
- token
- rs-unified-sdk-jni/src
- swift-sdk
- Sources/SwiftDashSDK
- FFI
- PlatformWallet
- SwiftTests/SwiftDashSDKTests
Lines changed: 37 additions & 14 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
182 | 182 | | |
183 | 183 | | |
184 | 184 | | |
185 | | - | |
186 | | - | |
187 | | - | |
188 | | - | |
189 | | - | |
190 | | - | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
191 | 192 | | |
192 | 193 | | |
193 | 194 | | |
| |||
197 | 198 | | |
198 | 199 | | |
199 | 200 | | |
200 | | - | |
201 | | - | |
202 | | - | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
203 | 212 | | |
204 | 213 | | |
205 | 214 | | |
| |||
280 | 289 | | |
281 | 290 | | |
282 | 291 | | |
283 | | - | |
284 | | - | |
285 | | - | |
286 | | - | |
287 | | - | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
288 | 299 | | |
289 | 300 | | |
290 | 301 | | |
| |||
294 | 305 | | |
295 | 306 | | |
296 | 307 | | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
297 | 312 | | |
298 | 313 | | |
299 | 314 | | |
| |||
321 | 336 | | |
322 | 337 | | |
323 | 338 | | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
324 | 345 | | |
| 346 | + | |
| 347 | + | |
325 | 348 | | |
326 | 349 | | |
327 | 350 | | |
| |||
Lines changed: 25 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
9 | 25 | | |
10 | 26 | | |
11 | 27 | | |
| |||
14 | 30 | | |
15 | 31 | | |
16 | 32 | | |
17 | | - | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
18 | 36 | | |
19 | | - | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
20 | 43 | | |
21 | 44 | | |
22 | 45 | | |
| |||
Lines changed: 36 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
84 | 84 | | |
85 | 85 | | |
86 | 86 | | |
| 87 | + | |
87 | 88 | | |
88 | 89 | | |
89 | 90 | | |
| |||
101 | 102 | | |
102 | 103 | | |
103 | 104 | | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
108 | 112 | | |
109 | 113 | | |
110 | 114 | | |
| 115 | + | |
111 | 116 | | |
112 | 117 | | |
113 | 118 | | |
114 | 119 | | |
115 | 120 | | |
116 | 121 | | |
117 | 122 | | |
118 | | - | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
119 | 129 | | |
120 | | - | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
121 | 136 | | |
122 | 137 | | |
123 | 138 | | |
| |||
146 | 161 | | |
147 | 162 | | |
148 | 163 | | |
| 164 | + | |
149 | 165 | | |
150 | 166 | | |
151 | 167 | | |
| |||
157 | 173 | | |
158 | 174 | | |
159 | 175 | | |
| 176 | + | |
160 | 177 | | |
161 | 178 | | |
162 | 179 | | |
| |||
170 | 187 | | |
171 | 188 | | |
172 | 189 | | |
| 190 | + | |
173 | 191 | | |
174 | 192 | | |
175 | 193 | | |
| |||
183 | 201 | | |
184 | 202 | | |
185 | 203 | | |
186 | | - | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
187 | 210 | | |
188 | | - | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
189 | 217 | | |
190 | 218 | | |
191 | 219 | | |
| |||
Lines changed: 19 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
128 | 128 | | |
129 | 129 | | |
130 | 130 | | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
131 | 144 | | |
132 | 145 | | |
133 | 146 | | |
134 | 147 | | |
135 | | - | |
136 | | - | |
137 | | - | |
138 | | - | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
139 | 154 | | |
140 | 155 | | |
141 | 156 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
168 | 168 | | |
169 | 169 | | |
170 | 170 | | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
171 | 192 | | |
172 | 193 | | |
173 | 194 | | |
| |||
329 | 350 | | |
330 | 351 | | |
331 | 352 | | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
332 | 366 | | |
333 | 367 | | |
334 | 368 | | |
| |||
421 | 455 | | |
422 | 456 | | |
423 | 457 | | |
424 | | - | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
425 | 465 | | |
426 | 466 | | |
427 | 467 | | |
| |||
810 | 850 | | |
811 | 851 | | |
812 | 852 | | |
| 853 | + | |
| 854 | + | |
| 855 | + | |
| 856 | + | |
| 857 | + | |
| 858 | + | |
| 859 | + | |
| 860 | + | |
| 861 | + | |
| 862 | + | |
| 863 | + | |
| 864 | + | |
| 865 | + | |
| 866 | + | |
| 867 | + | |
| 868 | + | |
| 869 | + | |
| 870 | + | |
| 871 | + | |
| 872 | + | |
| 873 | + | |
| 874 | + | |
| 875 | + | |
| 876 | + | |
| 877 | + | |
| 878 | + | |
| 879 | + | |
| 880 | + | |
| 881 | + | |
| 882 | + | |
| 883 | + | |
| 884 | + | |
| 885 | + | |
| 886 | + | |
| 887 | + | |
| 888 | + | |
| 889 | + | |
| 890 | + | |
| 891 | + | |
| 892 | + | |
| 893 | + | |
| 894 | + | |
| 895 | + | |
| 896 | + | |
| 897 | + | |
| 898 | + | |
| 899 | + | |
| 900 | + | |
813 | 901 | | |
0 commit comments