Skip to content
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
165 commits
Select commit Hold shift + click to select a range
ef9feff
feat: add Chat v2 account authority operations
replghost Sep 9, 2026
da72d30
fix: align Chat client examples and catalog test
replghost Sep 9, 2026
36b0dbb
feat(chat): add explicit context-bound cipher suite
replghost Sep 9, 2026
035f12e
fix(codegen): update Chat wire schema golden
replghost Sep 10, 2026
c47f1b6
Merge branch 'feat/pvm-app-runtime' into feat/chat-v2-product-authority
replghost Sep 10, 2026
4ccb114
feat: add dedicated Chat authority permission
replghost Sep 10, 2026
a0681e1
chore: regenerate Chat authority artifacts
replghost Sep 10, 2026
4388850
fix(chat): forward product statement proofs over SSO
replghost Sep 11, 2026
e6e31b5
fix(chat): sign first-contact proofs without message framing
replghost Sep 12, 2026
7d4ca68
fix(identity): register Chat-capable X25519 keys
replghost Sep 12, 2026
da64a51
Integrate browser wallet host support above Chat authority
replghost Sep 12, 2026
a217452
Merge commit 'e3a37f0be703715dbdfb39cc68e7b02e6c19acd4' into integrat…
replghost Sep 14, 2026
d0ed5a1
Merge commit '810aa11e' into integrate/chat-receive
replghost Sep 14, 2026
ccf2fc9
feat(chat): authenticate incoming product-device requests
replghost Sep 14, 2026
8ff4a85
Merge branch 'integrate/local-wallet-native-base' into integrate/chat…
replghost Sep 14, 2026
8911041
fix(chat): inherit persistent username confirmation monitoring
replghost Sep 15, 2026
07a5fc8
fix: align allowance helpers with wasm target boundaries
replghost Sep 15, 2026
4bdc938
Merge branch 'fix/wasm-allowance-boundary-540' into fix/chat-authorit…
replghost Sep 15, 2026
fd612bc
Merge branch 'fix/wasm-allowance-boundary-540' into fix/chat-authorit…
replghost Sep 15, 2026
65d8080
fix(chat): enforce dedicated authority on local product calls
replghost Sep 15, 2026
88bb941
Merge branch 'fix/wasm-allowance-boundary-540' into fix/chat-authorit…
replghost Sep 15, 2026
ddccbac
Merge branch 'fix/wasm-allowance-boundary-540' into fix/chat-authorit…
replghost Sep 15, 2026
4180a21
Merge SDK 0.16 into Chat authority and allocate its scoped method add…
replghost Sep 15, 2026
00f1499
Merge branch 'fix/wasm-allowance-boundary-540' into fix/chat-authorit…
replghost Sep 15, 2026
2d43b93
Format the SDK 0.16 Chat migration
replghost Sep 15, 2026
eeec65d
Merge branch 'fix/wasm-allowance-boundary-540' into fix/chat-authorit…
replghost Sep 15, 2026
15d9861
Complete Chat codec two integration coverage and migration notes
replghost Sep 15, 2026
4881067
Merge branch 'fix/wasm-allowance-boundary-540' into fix/chat-authorit…
replghost Sep 15, 2026
726c697
fix(ios): route dedicated Chat authority through permission guard
replghost Sep 15, 2026
57bbf8d
Merge commit 'a5c3f3f2' into fix/chat-authority-review-709
replghost Sep 15, 2026
656698d
Merge commit '7260aabd' into fix/chat-authority-review-709
replghost Sep 15, 2026
91e55b5
style: format Chat changeset
replghost Sep 15, 2026
01c1fd5
Merge commit '5c04f3afa5ce2004d6ec3e37603289321a329a99' into fix/chat…
replghost Sep 15, 2026
5bfe42d
fix(ios): fund selected product statement-store accounts without expo…
replghost Sep 16, 2026
a34218f
fix(ios): separate permission confirmation dispatch
replghost Sep 16, 2026
d956dda
Persist scoped statement allowance grants without approving silent in…
replghost Sep 16, 2026
0d70243
Keep native renewal ledger storage out of browser builds
replghost Sep 16, 2026
d0c157a
test: isolate method-keyed RPC fixtures across reconnects
replghost Sep 16, 2026
8372260
Merge remote-tracking branch 'origin/feat/pvm-app-runtime' into refre…
replghost Sep 17, 2026
05d8cb8
fix(wasm): gate native renewal inspection
replghost Sep 17, 2026
49f7ec8
Merge remote-tracking branch 'origin/feat/pvm-app-runtime' into refre…
replghost Sep 17, 2026
e55f78a
Merge remote-tracking branch 'origin/feat/pvm-app-runtime' into refre…
replghost Sep 17, 2026
027feac
Merge runtime wallet claim progress into Chat authority
replghost Sep 17, 2026
0926e88
Merge remote-tracking branch 'origin/feat/pvm-app-runtime' into refre…
replghost Sep 17, 2026
97ea37b
feat(chat): move native Chat and main-purse payments into shared Host
replghost Sep 21, 2026
4a8b867
fix(chat): include complete crypto sources in the shared Host workspace
replghost Sep 22, 2026
e4af1e6
build(chat): lock dependency resolution for reproducible Host generation
replghost Sep 22, 2026
837bd4f
docs(chat): record shared main-purse authority release notes
replghost Sep 22, 2026
8de303f
feat(chat): use native iOS custody and product-owned messaging
replghost Sep 23, 2026
5704252
fix(chat): address second review of Chat v2 product authority
replghost Sep 23, 2026
fc86c56
chore: merge refreshed feat/pvm-app-runtime into feat/chat-v2-product…
replghost Sep 23, 2026
a9d055a
fix: restore chat v2 branch checks
replghost Sep 23, 2026
6f1563b
Merge remote-tracking branch 'origin/feat/chat-v2-product-authority' …
replghost Sep 23, 2026
e4424be
fix(truapi): ignore late responses on known method pairs
replghost Sep 23, 2026
e6822d2
fix(js): reconcile the worker host surface after the main merge
replghost Sep 23, 2026
cf0221a
Merge commit '6f1563b7e' into fix/pr709-review-2
replghost Sep 23, 2026
6853dcf
Merge remote-tracking branch 'origin/feat/chat-v2-product-authority' …
replghost Sep 23, 2026
9f6a123
fix: reconcile chat branch with updated runtime
replghost Sep 23, 2026
b626f90
Merge remote-tracking branch 'origin/feat/chat-v2-product-authority' …
replghost Sep 23, 2026
2d8a629
fix: align browser host integration
replghost Sep 23, 2026
8f301bb
Merge remote-tracking branch 'origin/feat/pvm-app-runtime' into feat/…
replghost Sep 23, 2026
c3f9adb
Merge remote-tracking branch 'origin/feat/chat-v2-product-authority' …
replghost Sep 23, 2026
d3dec53
test(chat): build the refused product context for the SSO attestation…
replghost Sep 23, 2026
4c73446
fix: restore cross-platform host checks
replghost Sep 23, 2026
50e27db
Merge remote-tracking branch 'origin/feat/chat-v2-product-authority' …
replghost Sep 23, 2026
f296c55
test: update native custody key indices
replghost Sep 24, 2026
c5c39cf
fix: clear iOS warning ratchet
replghost Sep 24, 2026
0b5c741
fix(runtime): bound the host callbacks on own-account resolution
replghost Sep 24, 2026
6f7958b
Merge remote-tracking branch 'origin/feat/pvm-app-runtime' into HEAD
replghost Sep 24, 2026
bd060cc
Merge feat/pvm-app-runtime (wallet allowance inspection) into feat/ch…
replghost Sep 25, 2026
2fd97b2
fix(allowance): compile the renewal ledger reader for the browser sig…
replghost Sep 25, 2026
131c17e
Merge feat/pvm-app-runtime (#540): no-std import and clippy fix
replghost Sep 27, 2026
1284d03
Merge refreshed feat/pvm-app-runtime (SDK 0.21) into feat/chat-v2-pro…
replghost Sep 27, 2026
55713ed
fix(ios): Chat authority always prompts, even for a trusted product
replghost Sep 27, 2026
07ac76e
fix(chat): release the wallet lease before answering a payment call
replghost Sep 27, 2026
8ba4092
fix(sso): give the unreleased Chat v2 messages their own index block
replghost Sep 28, 2026
5e6da34
Merge updated host base
replghost Sep 28, 2026
a5502aa
Merge light-client CLI base into feat/chat-v2-product-authority
replghost Sep 29, 2026
2526446
Merge current host base into Chat v2 product authority
replghost Sep 29, 2026
74423b3
Merge host packaging and allocation fixes into Chat stack
replghost Sep 29, 2026
979dda2
fix(chat): migrate compiler boundaries to unified runtime
replghost Sep 29, 2026
1772ce9
Merge commit '6898a7f95' into HEAD
replghost Sep 29, 2026
3820751
Align Chat runtime features and authority with unified core
replghost Sep 29, 2026
4c52459
Complete unified Chat storage and license migration
replghost Sep 29, 2026
ba19476
Merge commit '522e14465' into HEAD
replghost Sep 29, 2026
d40c693
Merge commit 'f9d72df5e' into HEAD
replghost Sep 29, 2026
46c7c01
Merge commit 'e73014d21dcab5064b3484a9d599310fa523ef2d' into HEAD
replghost Sep 29, 2026
e2accca
test(codegen): qualify generated contracts without source snapshots
replghost Sep 29, 2026
64d18eb
fix(ios): preserve Chat coinage schema across main integration
replghost Sep 29, 2026
a36962b
fix(chat): keep attachment capabilities private and restore wire checks
replghost Sep 29, 2026
179fc93
fix(coinage): settle claims whose source was spent elsewhere
replghost Sep 29, 2026
2c38acc
fix(chat): bound Chat records per peer and honour allow-once for the …
replghost Sep 29, 2026
a7c0430
Merge branch 'fix/pr709-r3-topup' into fix/pr709-review-3
replghost Sep 29, 2026
f4d39d8
chore: update dotli PolkaVM runtime setting
replghost Sep 29, 2026
8b73633
fix(ios): review Chat payments outside the serial coinage queue
replghost Sep 29, 2026
acc2487
Merge branch 'fix/pr709-r3-ios' into fix/pr709-review-3
replghost Sep 29, 2026
4357942
Merge remote-tracking branch 'origin/feat/chat-v2-product-authority' …
replghost Sep 29, 2026
59c0d3a
chore: update dotli runtime opt-in coverage
replghost Sep 29, 2026
4c9cc84
chore: update dotli stacked runtime setting
replghost Sep 29, 2026
18e4535
Merge feat/pvm-app-runtime into feat/chat-v2-product-authority
replghost Sep 29, 2026
68ea768
fix(chat): address review of the Chat authority fixes
replghost Sep 29, 2026
3855ff1
fix(ios): share one payment review per operation until its decision i…
replghost Sep 29, 2026
3fe0aaa
fix(chat): bound Chat records per peer without evicting them
replghost Sep 29, 2026
0704c74
Merge branch 'fix/pr709-r3-ios' into fix/pr709-review-3
replghost Sep 29, 2026
c1d982c
Merge commit 'e4f657dfe' into HEAD
replghost Sep 29, 2026
9e21d86
Merge remote-tracking branch 'origin/feat/chat-v2-product-authority' …
replghost Sep 29, 2026
b17687c
Merge remote-tracking branch 'origin/feat/pvm-app-runtime' into HEAD
replghost Sep 29, 2026
c592acb
feat(chat): expose authenticated host-private contacts directory
replghost Sep 30, 2026
0eccd80
fix(contacts): resolve host adapter installed after runtime creation
replghost Sep 30, 2026
f8cd4e2
docs(chat): record top-up settlement evidence and its per-installatio…
replghost Sep 30, 2026
aab15ca
Merge remote-tracking branch 'origin/feat/chat-v2-product-authority' …
replghost Sep 30, 2026
437a46c
fix(ci): retain iOS test failure diagnostics
replghost Sep 29, 2026
89d9f34
Merge commit 'd155c1474f8dce3bdca63637acee078afc84574b' into HEAD
replghost Sep 30, 2026
4b241e8
Merge commit '953519aa65f02412ae487ce2356d04ed56b5622d' into HEAD
replghost Sep 30, 2026
2cb2412
Merge refreshed PolkaVM base into Chat with SQLite and named sessions
replghost Oct 1, 2026
daf0ff5
Merge commit '1709e630c87d336e30632799f587d0bd09e1a80d' into HEAD
replghost Oct 1, 2026
21c870c
Merge commit '9dcf66544e02b3bb3994e05f3a1400738f742331' into HEAD
replghost Oct 1, 2026
e6c6ed3
Normalize named-session integration formatting
replghost Oct 1, 2026
08bddf3
test: complete Chat runtime configuration migration
replghost Oct 1, 2026
c1e38d3
Merge commit 'ec91cdc01daa7ff57af61cb1f943d28a1036c9c6' into HEAD
replghost Oct 1, 2026
6d97c79
Merge commit 'e0a8d59a07e72c4c7f36e6bab6c1db34c06d35dc' into HEAD
replghost Oct 1, 2026
726ef76
Merge commit 'a572456b90dc6932476f2fb5a71985fbe9fcbd84' into HEAD
replghost Oct 2, 2026
4100ceb
Merge feat/pvm-app-runtime into feat/chat-v2-product-authority
replghost Oct 2, 2026
5bbad3f
fix(test-host): withhold product statement allowances after runtime sync
replghost Oct 2, 2026
4dcc4de
docs(test-host): document indexed statement resource withholding
replghost Oct 2, 2026
e521d81
Merge runtime subtree synchronization into feat/chat-v2-product-autho…
replghost Oct 2, 2026
87a085b
test(signing-host): await Chat product state cleanup
replghost Oct 2, 2026
0c9415e
Merge runtime snapshot fixture correction into feat/chat-v2-product-a…
replghost Oct 2, 2026
f702177
Merge frozen runtime main update into feat/chat-v2-product-authority
replghost Oct 2, 2026
b5c4c0e
Merge host locale timestamp conversion into Chat
replghost Oct 2, 2026
83c288e
Merge locale binding corrections into Chat
replghost Oct 2, 2026
01c16a0
Merge explicit API version binding fix into Chat
replghost Oct 2, 2026
7f07aeb
chore(codegen): regenerate Chat locale client catalog
replghost Oct 2, 2026
ceea3cd
Merge generator fixture compile fix into Chat
replghost Oct 2, 2026
80ba885
merge: forward pinned-nightly Locale formatting into native 709
replghost Oct 2, 2026
901a3e7
Merge qualified runtime updates from #540 into #709
replghost Oct 3, 2026
373be76
Merge notification activation and bootstrap fixes into Chat authority
replghost Oct 5, 2026
3f6bbbd
Merge approved notification base compile correction into Chat
replghost Oct 5, 2026
e23f3cd
chore: regenerate Chat-layer notification activation client catalog
replghost Oct 5, 2026
a78944c
Merge approved base notification client catalog into Chat
replghost Oct 5, 2026
02e98b4
Merge native base notification formatting into Chat
replghost Oct 6, 2026
172afb2
fix(chat): fence session grants and release failed attachment custody
replghost Oct 8, 2026
7f00854
Merge canonical native runtime into Chat authority
replghost Oct 9, 2026
5ab4315
Merge native platform CI repairs into Chat
replghost Oct 9, 2026
77f01e4
fix(chat): expose canonical native feature permissions in settings
replghost Oct 9, 2026
8684b5f
test(chat): include native wallet in runtime factory fixture
replghost Oct 9, 2026
a0711ac
Merge final native allowance and platform qualification repairs into …
replghost Oct 9, 2026
309b3ec
merge: forward simulator sequencing into Chat
replghost Oct 9, 2026
c7d61d6
refactor(ios): share Chat permission presentation and selector mapping
replghost Oct 9, 2026
09431a8
Merge native platform qualification into Chat
replghost Oct 9, 2026
ab0b9d9
test(ios): avoid throwing key-path inference in permission assertions
replghost Oct 9, 2026
4b0f92c
Merge native WebKit navigation diagnostics into Chat
replghost Oct 9, 2026
960a1b3
fix(ios): remove permission helper SwiftLint warning
replghost Oct 9, 2026
26cdf23
Merge feat/pvm-app-runtime into feat/chat-v2-product-authority
replghost Oct 9, 2026
67aa374
Merge PolkaVM notification boundary extraction into Chat
replghost Oct 11, 2026
c7f4101
Merge refreshed PolkaVM runtime into Chat authority
replghost Oct 16, 2026
30ecc06
Forward preserved upload consent into Chat
replghost Oct 16, 2026
5ccc348
Forward generic permission projection fixes into Chat
replghost Oct 16, 2026
4a5adee
Merge regenerated generic 0.25 bindings
replghost Oct 16, 2026
7921392
Merge 0.25 signing and scoped scanner repairs
replghost Oct 16, 2026
3a1ba52
Merge canonical signing WebAssembly permission exports
replghost Oct 16, 2026
9005f23
test(chat): bind new scanner and recovery fixtures to wallet-aware ru…
replghost Oct 16, 2026
f04b1e9
fix(chat): expose statement renewal targets to WebAssembly
replghost Oct 16, 2026
f45f01e
fix(chat): retain signing runtime permission administration
replghost Oct 16, 2026
37d2755
Merge accurate upload consent contracts
replghost Oct 16, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ generated from [Conventional Commits](https://www.conventionalcommits.org/).

### Added

- Add `account.productDeviceChat` for host-private Chat v2 identity binding and
identity-route sealing/opening through local or paired account authorities.
- Generate a transport-neutral `no_std` Rust client with typed request,
subscription, result-subscription, and host-initiated Worker subscription
codecs.
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,12 @@ const result = await truapi.accountManagement.accountGet({

See [`js/packages/truapi/README.md`](js/packages/truapi/README.md) for the full client reference.

`account.productDeviceChat` binds a product-derived account to the connected
wallet's Chat v2 identity and seals or opens identity-route payloads without
exposing the wallet's X25519 private key. Browser pairing hosts forward the
operation over encrypted SSO; signing hosts require the calling product's
identity-disclosure authorization before using local wallet material.

## Repository layout

```
Expand Down
34 changes: 33 additions & 1 deletion rust/crates/truapi-client/src/generated.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use super::*;

/// Fingerprint of the generated wire contract.
pub const TRUAPI_WIRE_SCHEMA_HASH: &str = "0449982638d57658";
pub const TRUAPI_WIRE_SCHEMA_HASH: &str = "f1682972c34c8609";

/// `account_connection_status_subscribe` method marker.
pub struct AccountConnectionStatusSubscribe;
Expand Down Expand Up @@ -239,6 +239,35 @@ impl RequestMethod for AccountRingVrfSign {
const DESCRIPTOR: MethodDescriptor = Self::DESCRIPTOR;
}

/// `account_product_device_chat` method marker.
pub struct AccountProductDeviceChat;
impl AccountProductDeviceChat {
/// Canonical metadata and frame ids for this method.
pub const DESCRIPTOR: MethodDescriptor = MethodDescriptor {
service: "Account",
method: "product_device_chat",
wire_name: "account_product_device_chat",
request_type: "truapi::versioned::account::HostProductDeviceChatRequest",
response_type: "truapi::versioned::account::HostProductDeviceChatResponse",
error_type: Some("truapi::versioned::account::HostProductDeviceChatError"),
kind: MethodKind::Request,
direction: Direction::ProductToHost,
required_execution: None,
sensitive: true,
wire: MethodWire::Request(RequestFrameIds {
request_id: 174,
response_id: 175,
}),
};
}
impl RequestMethod for AccountProductDeviceChat {
type Request = truapi::versioned::account::HostProductDeviceChatRequest;
type Response = truapi::versioned::account::HostProductDeviceChatResponse;
type Error = truapi::versioned::account::HostProductDeviceChatError;
const RESPONSE_VERSIONED: bool = true;
const DESCRIPTOR: MethodDescriptor = Self::DESCRIPTOR;
}

/// `account_get_legacy_accounts` method marker.
pub struct AccountGetLegacyAccounts;
impl AccountGetLegacyAccounts {
Expand Down Expand Up @@ -2121,6 +2150,7 @@ pub const APP_METHODS: &[MethodDescriptor] = &[
AccountRegisterRingVrfKey::DESCRIPTOR,
AccountListRingVrfKeys::DESCRIPTOR,
AccountRingVrfSign::DESCRIPTOR,
AccountProductDeviceChat::DESCRIPTOR,
AccountGetLegacyAccounts::DESCRIPTOR,
AccountGetUserId::DESCRIPTOR,
AccountRequestLogin::DESCRIPTOR,
Expand Down Expand Up @@ -2191,6 +2221,7 @@ pub const WIDGET_METHODS: &[MethodDescriptor] = &[
AccountRegisterRingVrfKey::DESCRIPTOR,
AccountListRingVrfKeys::DESCRIPTOR,
AccountRingVrfSign::DESCRIPTOR,
AccountProductDeviceChat::DESCRIPTOR,
AccountGetLegacyAccounts::DESCRIPTOR,
AccountGetUserId::DESCRIPTOR,
AccountRequestLogin::DESCRIPTOR,
Expand Down Expand Up @@ -2261,6 +2292,7 @@ pub const WORKER_METHODS: &[MethodDescriptor] = &[
AccountRegisterRingVrfKey::DESCRIPTOR,
AccountListRingVrfKeys::DESCRIPTOR,
AccountRingVrfSign::DESCRIPTOR,
AccountProductDeviceChat::DESCRIPTOR,
AccountGetLegacyAccounts::DESCRIPTOR,
AccountGetUserId::DESCRIPTOR,
AccountRequestLogin::DESCRIPTOR,
Expand Down
19 changes: 15 additions & 4 deletions rust/crates/truapi-client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -457,10 +457,21 @@ mod tests {

#[test]
fn catalogs_partition_worker_only_chat() {
assert_eq!(APP_METHODS.len(), 66);
assert_eq!(WIDGET_METHODS.len(), 66);
assert_eq!(WORKER_METHODS.len(), 72);
assert_eq!(WORKER_ONLY_METHODS.len(), 6);
assert_eq!(APP_METHODS, WIDGET_METHODS);
assert_eq!(
WORKER_METHODS.len(),
APP_METHODS.len() + WORKER_ONLY_METHODS.len()
);
assert!(
APP_METHODS
.iter()
.all(|method| WORKER_METHODS.contains(method))
);
assert!(
WORKER_ONLY_METHODS
.iter()
.all(|method| WORKER_METHODS.contains(method) && !APP_METHODS.contains(method))
);
assert!(WORKER_ONLY_METHODS.iter().all(|method| {
method.service == "Chat" && method.required_execution == Some(ExecutionKind::Worker)
}));
Expand Down
39 changes: 39 additions & 0 deletions rust/crates/truapi-codegen/tests/golden/dispatcher.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 11 additions & 1 deletion rust/crates/truapi-codegen/tests/golden/wire_table.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion rust/crates/truapi-server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ getrandom = { version = "0.2", features = ["js"] }
p256 = { version = "0.13", default-features = false, features = ["ecdh"] }
hkdf = "0.12"
chacha20poly1305 = { version = "0.10", default-features = false, features = ["alloc"] }
x25519-dalek = { version = "2", default-features = false, features = ["static_secrets"] }
x25519-dalek = { version = "2", default-features = false, features = ["static_secrets", "zeroize"] }
sha2 = "0.10"
merlin = "3"
parking_lot = "0.12"
Expand Down
47 changes: 41 additions & 6 deletions rust/crates/truapi-server/src/host_logic/permissions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
//! The cache layer is shared but keys are typed so a device grant cannot
//! authorize a remote operation by accident. Keys are also scoped by product id
//! so one product's authorization never grants another product's request.
//! Identity disclosure is also represented as a product-scoped authorization,
//! but the prompt itself is handled by the account runtime because it uses the
//! richer user-confirmation surface rather than the device/remote callbacks.
//! Identity disclosure is also represented as a product-scoped authorization;
//! its richer user-confirmation prompt is coordinated here so local and remote
//! account-authority paths share one decision state machine.
//!
//! Domain grants (`RemotePermission::Remote`) are the one request that does not
//! occupy a single slot. A product may ask for several domains at once, while
Expand Down Expand Up @@ -42,9 +42,10 @@ use truapi::latest::{
RemotePermissionRequest, RemotePermissionResponse,
};
use truapi_platform::{
CoreStorage, CoreStorageKey, DevicePermissionStatus, PermissionAuthorizationRequest,
PermissionAuthorizationStatus, PermissionStatusHost, Permissions,
has_trusted_remote_permissions, remote_domain_candidates,
CoreStorage, CoreStorageKey, DevicePermissionStatus, IdentityDisclosureReview,
PermissionAuthorizationRequest, PermissionAuthorizationStatus, PermissionStatusHost,
Permissions, UserConfirmation, UserConfirmationReview, has_trusted_remote_permissions,
remote_domain_candidates,
};

/// Persisted answer for a single permission request. Keep `Authorized` at
Expand Down Expand Up @@ -358,6 +359,40 @@ impl<'a, S: CoreStorage + ?Sized, P: Permissions + ?Sized> PermissionsService<'a
set_authorization_status(self.storage, key, status).await
}

/// Resolve the product's identity-disclosure grant, prompting once when no
/// durable user decision exists.
pub async fn check_or_prompt_identity_disclosure(
&self,
) -> Result<PermissionAuthorizationStatus, GenericError>
where
P: UserConfirmation,
{
let request = PermissionAuthorizationRequest::IdentityDisclosure;
let cached = self.authorization_status(&request).await?;
if cached != PermissionAuthorizationStatus::NotDetermined {
return Ok(cached);
}
let confirmed = match self
.prompt
.confirm_user_action(UserConfirmationReview::IdentityDisclosure(
IdentityDisclosureReview {
product_id: self.product_id.to_string(),
},
))
.await
{
Ok(confirmed) => confirmed,
Err(_) => return Ok(PermissionAuthorizationStatus::NotDetermined),
};
let status = if confirmed {
PermissionAuthorizationStatus::Authorized
} else {
PermissionAuthorizationStatus::Denied
};
self.set_authorization_status(&request, status).await?;
Ok(status)
}

/// Resolves a device capability against both the OS state and the stored
/// product decision, prompting the platform's `device_permission` callback
/// and persisting the answer when the question is still open.
Expand Down
Loading