Commit 417da32
feat(server,platform): retain and expose session identity material (#403)
* feat(server,platform): retain and expose session identity material
The v2 pairing handshake carries three values the core consumed and then
discarded: the identity chat X25519 private key, the answering device's
encryption public key, and the peer's statement account id. A host adopting
core pairing had no way to reach them, so it had to keep a second duplicate
pairing alive purely to harvest them.
Retain rather than derive. The wallet chooses the chat key and every peer
already addresses that identity by the matching public key, so a value
derived host-side would name an identity nobody can reach. The pairing host
provably cannot recompute it either: the derivation needs raw BIP-39 entropy,
which only a signing host holds.
Split the read paths by sensitivity. Public material rides SessionUiInfo
(chat_public_key, device_enc_public_key, peer_statement_account_id) so a host
that only addresses the identity never touches a secret. The secrets sit
behind explicit CoreAdmin calls, because SessionUiInfo rides every AuthState
broadcast to all registered AuthPresenters and would push them to hosts that
never asked. Both secrets are reachable over wasm and UniFFI.
Give the responder its own device encryption key. It previously advertised
the SSO channel key as device_enc_pub_key, which makes every device sharing
an identity indistinguishable. The key is now random and persisted under
CoreStorageKey::DeviceEncryptionKey, matching the provider, and the CLI host
anchors that slot to its bootstrap directory so a user switch cannot
regenerate the identity peers address this install by.
Verified field-for-field against the Android provider and the host-papp
consumer: the handshake layout, the X25519 basepoint derivation of the chat
public key, and the statement-signer origin of the peer account id all match.
SessionInfo gains fields mid-struct, so its SCALE layout changes. The blob is
unversioned and decode rejects short input, so sessions persisted by an
earlier build no longer decode and those users re-pair once.
Refs #384
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* fix(server,host): close the device-key race and the empty-key fallback
Move the device-key serialization guard from SigningHost onto RuntimeServices
and bundle it with the read. The key is reachable from both roles now, so a
guard owned by one of them left the CoreAdmin and pairing-runtime paths free
to race a first-time read against pairing, generate a second secret, and
overwrite the one peers were told to address. `device_encryption_secret` is
the only way to reach the key, so no caller can forget to hold it.
Reject instead of resolving with an empty key when the worker host runtime is
disposed. Callers encrypt with whatever comes back, so a zero-length secret
is the one answer that must never be handed out.
* fix(server,host): address PR review nits
Move the execution-kind doc comment onto execution_kind(), warn on a
malformed stored device encryption key, and cover the provider's
getDeviceEncryptionKey hex/rejection paths.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>1 parent 00ab14e commit 417da32
27 files changed
Lines changed: 918 additions & 29 deletions
File tree
- ios/truapi-host/Sources
- TrUAPIHost
- truapi_serverFFI/include
- js/packages/truapi-host/src
- web
- rust/crates
- truapi-codegen/tests/golden
- truapi-host-cli/src
- truapi-platform
- src
- truapi-server
- src
- host_logic
- sso
- runtime
- signing_host
- tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1121 | 1121 | | |
1122 | 1122 | | |
1123 | 1123 | | |
| 1124 | + | |
| 1125 | + | |
| 1126 | + | |
| 1127 | + | |
| 1128 | + | |
| 1129 | + | |
| 1130 | + | |
| 1131 | + | |
| 1132 | + | |
| 1133 | + | |
| 1134 | + | |
| 1135 | + | |
| 1136 | + | |
| 1137 | + | |
| 1138 | + | |
| 1139 | + | |
| 1140 | + | |
1124 | 1141 | | |
1125 | 1142 | | |
1126 | 1143 | | |
| |||
1139 | 1156 | | |
1140 | 1157 | | |
1141 | 1158 | | |
| 1159 | + | |
| 1160 | + | |
| 1161 | + | |
| 1162 | + | |
| 1163 | + | |
| 1164 | + | |
| 1165 | + | |
| 1166 | + | |
| 1167 | + | |
| 1168 | + | |
| 1169 | + | |
| 1170 | + | |
| 1171 | + | |
| 1172 | + | |
1142 | 1173 | | |
1143 | 1174 | | |
1144 | 1175 | | |
| |||
1147 | 1178 | | |
1148 | 1179 | | |
1149 | 1180 | | |
| 1181 | + | |
| 1182 | + | |
| 1183 | + | |
1150 | 1184 | | |
1151 | 1185 | | |
1152 | 1186 | | |
| |||
1169 | 1203 | | |
1170 | 1204 | | |
1171 | 1205 | | |
| 1206 | + | |
| 1207 | + | |
| 1208 | + | |
1172 | 1209 | | |
1173 | 1210 | | |
1174 | 1211 | | |
| |||
1177 | 1214 | | |
1178 | 1215 | | |
1179 | 1216 | | |
| 1217 | + | |
| 1218 | + | |
| 1219 | + | |
1180 | 1220 | | |
1181 | 1221 | | |
1182 | 1222 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2432 | 2432 | | |
2433 | 2433 | | |
2434 | 2434 | | |
| 2435 | + | |
| 2436 | + | |
| 2437 | + | |
| 2438 | + | |
| 2439 | + | |
| 2440 | + | |
2435 | 2441 | | |
2436 | 2442 | | |
2437 | 2443 | | |
| |||
2473 | 2479 | | |
2474 | 2480 | | |
2475 | 2481 | | |
| 2482 | + | |
| 2483 | + | |
| 2484 | + | |
| 2485 | + | |
| 2486 | + | |
| 2487 | + | |
2476 | 2488 | | |
2477 | 2489 | | |
2478 | 2490 | | |
| |||
2554 | 2566 | | |
2555 | 2567 | | |
2556 | 2568 | | |
| 2569 | + | |
| 2570 | + | |
| 2571 | + | |
| 2572 | + | |
| 2573 | + | |
| 2574 | + | |
| 2575 | + | |
| 2576 | + | |
| 2577 | + | |
| 2578 | + | |
| 2579 | + | |
| 2580 | + | |
| 2581 | + | |
2557 | 2582 | | |
2558 | 2583 | | |
2559 | 2584 | | |
| |||
2656 | 2681 | | |
2657 | 2682 | | |
2658 | 2683 | | |
| 2684 | + | |
| 2685 | + | |
| 2686 | + | |
| 2687 | + | |
| 2688 | + | |
| 2689 | + | |
| 2690 | + | |
| 2691 | + | |
| 2692 | + | |
| 2693 | + | |
| 2694 | + | |
| 2695 | + | |
| 2696 | + | |
2659 | 2697 | | |
2660 | 2698 | | |
2661 | 2699 | | |
| |||
5831 | 5869 | | |
5832 | 5870 | | |
5833 | 5871 | | |
| 5872 | + | |
| 5873 | + | |
| 5874 | + | |
| 5875 | + | |
| 5876 | + | |
| 5877 | + | |
| 5878 | + | |
| 5879 | + | |
| 5880 | + | |
| 5881 | + | |
| 5882 | + | |
| 5883 | + | |
| 5884 | + | |
| 5885 | + | |
| 5886 | + | |
| 5887 | + | |
| 5888 | + | |
| 5889 | + | |
| 5890 | + | |
| 5891 | + | |
| 5892 | + | |
| 5893 | + | |
| 5894 | + | |
| 5895 | + | |
5834 | 5896 | | |
5835 | 5897 | | |
5836 | 5898 | | |
| |||
6217 | 6279 | | |
6218 | 6280 | | |
6219 | 6281 | | |
| 6282 | + | |
| 6283 | + | |
| 6284 | + | |
6220 | 6285 | | |
6221 | 6286 | | |
6222 | 6287 | | |
| |||
6241 | 6306 | | |
6242 | 6307 | | |
6243 | 6308 | | |
| 6309 | + | |
| 6310 | + | |
| 6311 | + | |
6244 | 6312 | | |
6245 | 6313 | | |
6246 | 6314 | | |
| |||
Lines changed: 22 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
641 | 641 | | |
642 | 642 | | |
643 | 643 | | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
644 | 649 | | |
645 | 650 | | |
646 | 651 | | |
| |||
681 | 686 | | |
682 | 687 | | |
683 | 688 | | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
684 | 694 | | |
685 | 695 | | |
686 | 696 | | |
| |||
1321 | 1331 | | |
1322 | 1332 | | |
1323 | 1333 | | |
| 1334 | + | |
| 1335 | + | |
| 1336 | + | |
| 1337 | + | |
| 1338 | + | |
| 1339 | + | |
1324 | 1340 | | |
1325 | 1341 | | |
1326 | 1342 | | |
| |||
1369 | 1385 | | |
1370 | 1386 | | |
1371 | 1387 | | |
| 1388 | + | |
| 1389 | + | |
| 1390 | + | |
| 1391 | + | |
| 1392 | + | |
| 1393 | + | |
1372 | 1394 | | |
1373 | 1395 | | |
1374 | 1396 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
| 25 | + | |
24 | 26 | | |
25 | 27 | | |
26 | 28 | | |
| |||
0 commit comments