Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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: 1 addition & 1 deletion Cargo.lock

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

1 change: 1 addition & 0 deletions explorer/diagnosis-reports/pairing-host-cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
| `Account/get_legacy_accounts` | ✅ | |
| `Account/get_user_id` | ✅ | |
| `Account/request_login` | ✅ | |
| `Account/sign_vrf` | ✅ | |
| `Chain/follow_head_subscribe` | ✅ | |
| `Chain/get_head_header` | ✅ | |
| `Chain/get_head_body` | ✅ | |
Expand Down
1 change: 1 addition & 0 deletions explorer/diagnosis-reports/signing-host-cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
| `Account/get_legacy_accounts` || |
| `Account/get_user_id` || |
| `Account/request_login` || |
| `Account/sign_vrf` || |
| `Chain/follow_head_subscribe` || |
| `Chain/get_head_header` || |
| `Chain/get_head_body` || |
Expand Down
2 changes: 1 addition & 1 deletion hosts/dotli
Submodule dotli updated 88 files
+1 −1 .github/workflows/labeler.yml
+1 −0 DEPLOYMENT.md
+20 −2 Makefile
+8 −1 README.md
+11 −13 apps/host/tests/e2e/fixtures/paired.ts
+14 −14 apps/host/tests/e2e/global-setup.ts
+35 −0 apps/host/tests/e2e/helpers/chain-backend.ts
+31 −5 apps/host/tests/e2e/truapi.spec.ts
+201 −189 apps/host/tests/functional/host-settings.spec.ts
+1 −1 apps/host/vite.config.ts
+20 −35 bun.lock
+4 −0 deploy.env.example
+23 −2 nginx/nginx.conf.template
+35 −0 nginx/snippets/dotli-sentry-tunnel.conf
+7 −3 package.json
+1 −1 packages/config/src/mode.ts
+6 −6 packages/config/src/network.ts
+3 −3 packages/config/tests/gateway-chains.test.ts
+5 −5 packages/config/tests/mode.test.ts
+8 −8 packages/config/tests/url-settings.test.ts
+22 −5 packages/metrics/src/sentry.ts
+7 −2 packages/metrics/tests/sentry.test.ts
+7 −1 packages/protocol/src/auth-storage.ts
+200 −57 packages/protocol/src/broker.ts
+8 −0 packages/protocol/src/client.ts
+1 −1 packages/protocol/tests/auth-storage.test.ts
+345 −0 packages/protocol/tests/broker.test.ts
+0 −3 packages/resolver/package.json
+1 −1 packages/resolver/src/chain-specs/paseo-asset-hub-next.smol.json
+1 −1 packages/resolver/src/chain-specs/paseo-bulletin-next.smol.json
+1 −1 packages/resolver/src/chain-specs/paseo.smol.json
+1 −1 packages/resolver/src/chain-specs/previewnet-asset-hub.smol.json
+1 −1 packages/resolver/src/chain-specs/previewnet-bulletin-local.smol.json
+1 −1 packages/resolver/src/chain-specs/previewnet-people.smol.json
+1 −1 packages/resolver/src/chain-specs/previewnet.smol.json
+6 −0 packages/resolver/src/smoldot.ts
+15 −0 packages/resolver/tests/chains.test.ts
+33 −6 packages/resolver/tests/rpc-chain.test.ts
+24 −11 packages/truapi-debug/DEBUG_PANEL.md
+1 −0 packages/truapi-debug/package.json
+78 −82 packages/truapi-debug/src/chain-decode.ts
+3 −36 packages/truapi-debug/src/chain-summary.ts
+1 −1 packages/truapi-debug/src/event-store.ts
+69 −0 packages/truapi-debug/src/export.ts
+57 −9 packages/truapi-debug/src/filters.ts
+1 −1 packages/truapi-debug/src/format.ts
+128 −4 packages/truapi-debug/src/panel.ts
+50 −0 packages/truapi-debug/src/shape.ts
+18 −4 packages/truapi-debug/src/styles.css
+17 −15 packages/truapi-debug/src/timeline-layout.ts
+3 −2 packages/ui/package.json
+112 −12 packages/ui/src/bridge.ts
+8 −1 packages/ui/src/bulletin-bitswap.ts
+282 −0 packages/ui/src/debug-wire-describe.ts
+8 −1 packages/ui/src/host-callbacks/Chain.ts
+5 −0 packages/ui/src/host-callbacks/Preimage.ts
+13 −1 packages/ui/src/host-callbacks/PromptPermission.ts
+6 −0 packages/ui/src/host-callbacks/PushNotification.ts
+253 −13 packages/ui/src/host-callbacks/SessionStore.ts
+108 −150 packages/ui/src/host-callbacks/UserConfirmation.ts
+14 −2 packages/ui/src/host-callbacks/handlers.ts
+25 −0 packages/ui/src/host-callbacks/rate-limit.ts
+46 −18 packages/ui/src/legacy-host-bridge.ts
+2 −2 packages/ui/src/permissions.ts
+2 −4 packages/ui/src/runtime-config.ts
+12 −0 packages/ui/src/styles/landing.css
+7 −0 packages/ui/src/styles/themes.css
+54 −10 packages/ui/src/topbar.ts
+38 −3 packages/ui/src/ui.ts
+33 −6 packages/ui/tests/blocking-modal-queue.test.ts
+65 −15 packages/ui/tests/bridge.test.ts
+46 −19 packages/ui/tests/chain-callback.test.ts
+353 −0 packages/ui/tests/debug-wire-describe.test.ts
+133 −17 packages/ui/tests/legacy-host-bridge.test.ts
+8 −2 packages/ui/tests/local-storage.test.ts
+47 −26 packages/ui/tests/notification.test.ts
+0 −70 packages/ui/tests/nova-removal.test.ts
+4 −1 packages/ui/tests/open-url.test.ts
+12 −3 packages/ui/tests/permission-modal.test.ts
+90 −26 packages/ui/tests/permissions.test.ts
+38 −6 packages/ui/tests/preimage.test.ts
+126 −0 packages/ui/tests/rate-limit.test.ts
+7 −17 packages/ui/tests/runtime-config.test.ts
+246 −17 packages/ui/tests/session-store.test.ts
+18 −0 packages/ui/tests/support.ts
+8 −2 packages/ui/tests/theme.test.ts
+111 −15 packages/ui/tests/topbar.test.ts
+131 −39 packages/ui/tests/user-confirmation.test.ts
14 changes: 14 additions & 0 deletions js/packages/truapi-host/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
# @parity/truapi-host

## 0.4.0

### Minor Changes

- Publish the RFC-0022 mobile host cutover and completed RFC-0023 account VRF
signing runtime. Pairing hosts persist product-scoped AutoSigning keys, sign
matching same-product requests locally, and require structured host and
Account Holder confirmations before forwarding every other request.

### Patch Changes

- Updated dependencies
- @parity/truapi@0.7.0

## 0.3.0

### Minor Changes
Expand Down
4 changes: 2 additions & 2 deletions js/packages/truapi-host/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@parity/truapi-host",
"version": "0.3.0",
"version": "0.4.0",
"description": "WASM-backed TrUAPI host runtime: embeds the Rust core, with web iframe and Web Worker entry points",
"license": "MIT",
"author": "Parity Technologies <admin@parity.io>",
Expand Down Expand Up @@ -49,7 +49,7 @@
"test": "bun test"
},
"dependencies": {
"@parity/truapi": "^0.6.0"
"@parity/truapi": "^0.7.0"
},
"devDependencies": {
"@types/bun": "^1.3.0",
Expand Down
7 changes: 7 additions & 0 deletions js/packages/truapi/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# @parity/truapi

## 0.7.0

### Minor Changes

- Publish the package version paired with the RFC-0022 mobile host cutover and
the completed RFC-0023 account VRF signing flow.

## 0.6.0

### Minor Changes
Expand Down
2 changes: 1 addition & 1 deletion js/packages/truapi/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@parity/truapi",
"version": "0.6.0",
"version": "0.7.0",
"description": "TrUAPI TypeScript transport, SCALE codecs, and generated API client",
"license": "MIT",
"author": "Parity Technologies <admin@parity.io>",
Expand Down
6 changes: 3 additions & 3 deletions package-lock.json

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

96 changes: 87 additions & 9 deletions rust/crates/truapi-server/src/runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1066,13 +1066,6 @@ impl Account for ProductRuntimeHost {
},
))
})?;
if !self.is_product_account_valid_for_caller(&request.account.dot_ns_identifier) {
return Err(CallError::Domain(HostAccountSignVrfError::V1(
v01::HostAccountSignVrfError::Unknown {
reason: "Product account does not belong to the calling product".to_string(),
},
)));
}
validate_vrf_transcript(&request).map_err(|reason| {
CallError::Domain(HostAccountSignVrfError::V1(
v01::HostAccountSignVrfError::Unknown { reason },
Expand Down Expand Up @@ -2925,13 +2918,14 @@ mod tests {
}

#[test]
fn sign_vrf_forwards_mobile_sso_request_and_response() {
fn sign_vrf_forwards_cross_product_mobile_sso_request_and_response() {
Comment thread
pgherveou marked this conversation as resolved.
let session = sso_session_info();
let signature = v01::VrfSignature {
pre_output: [0x11; 32],
proof: [0x22; 64],
};
let platform = Arc::new(StubPlatform {
sign_vrf_confirmed: true,
sso_response_script: Some(sso_success_response_script(
&session,
RemoteMessage {
Expand All @@ -2953,7 +2947,7 @@ mod tests {
);
install_pairing_session(&host, session.clone());
let request = v01::HostAccountSignVrfRequest {
account: account_id("myapp.dot", 0),
account: account_id("other-product.dot", 0),
transcript_label: b"ctx".to_vec(),
items: vec![v01::VrfTranscriptItem {
label: b"domain".to_vec(),
Expand All @@ -2968,6 +2962,16 @@ mod tests {
.unwrap();

assert_eq!(response, HostAccountSignVrfResponse::V1(signature));
assert_eq!(
*platform
.sign_vrf_reviews
.lock()
.expect("VRF signing review list mutex poisoned"),
vec![truapi_platform::SignVrfReview {
calling_product_id: "myapp.dot".to_string(),
request: request.clone(),
}]
);
let message = submitted_remote_message(&platform, &session);
let RemoteMessageData::V1(v1::RemoteMessage::SignVrfRequest(request_message)) =
message.data
Expand All @@ -2978,6 +2982,73 @@ mod tests {
assert_eq!(request_message.payload, request);
}

#[test]
fn sign_vrf_rejects_declined_pairing_host_confirmation_before_mobile_sso() {
let session = sso_session_info();
let platform = Arc::new(StubPlatform {
sso_response_script: Some(sso_success_response_script(
&session,
RemoteMessage {
message_id: "wallet-vrf-declined".to_string(),
data: RemoteMessageData::V1(v1::RemoteMessage::SignVrfResponse(
crate::host_logic::sso::messages::SignVrfResponse {
responding_to: "vrf-declined".to_string(),
payload: Ok(v01::VrfSignature {
pre_output: [0x11; 32],
proof: [0x22; 64],
}),
},
)),
},
)),
..Default::default()
});
let host = ProductRuntimeHost::new(
platform.clone(),
runtime_config("myapp.dot"),
test_spawner(),
);
install_pairing_session(&host, session);
let request = v01::HostAccountSignVrfRequest {
account: account_id("other-product.dot", 0),
transcript_label: b"ctx".to_vec(),
items: vec![v01::VrfTranscriptItem {
label: b"domain".to_vec(),
value: vec![1, 2],
}],
};

let err = futures::executor::block_on(host.sign_vrf(
&CallContext::with_request_id("vrf-declined".to_string()),
HostAccountSignVrfRequest::V1(request.clone()),
))
.unwrap_err();

assert!(matches!(
err,
CallError::Domain(HostAccountSignVrfError::V1(
v01::HostAccountSignVrfError::Rejected
))
));
assert_eq!(
*platform
.sign_vrf_reviews
.lock()
.expect("VRF signing review list mutex poisoned"),
vec![truapi_platform::SignVrfReview {
calling_product_id: "myapp.dot".to_string(),
request,
}]
);
assert!(
platform
.sent_rpc
.lock()
.expect("RPC request list mutex poisoned")
.is_empty()
);
}

#[test]
fn sign_vrf_rejects_oversized_transcript_before_sso() {
let host =
Expand Down Expand Up @@ -4537,6 +4608,13 @@ mod tests {
))
.expect("persisted AutoSigning key signs locally");
let HostAccountSignVrfResponse::V1(signature) = response;
assert!(
platform
.sign_vrf_reviews
.lock()
.expect("VRF signing review list mutex poisoned")
.is_empty()
);

let keypair = crate::host_logic::product_account::derive_product_keypair(
&root,
Expand Down
18 changes: 17 additions & 1 deletion rust/crates/truapi-server/src/runtime/pairing_host.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,10 @@ use futures::StreamExt;
use tracing::{instrument, warn};
use truapi::versioned::account::{HostRequestLoginError, HostRequestLoginResponse};
use truapi::{CallContext, CallError, v01};
use truapi_platform::{CoreStorageKey, PairingHostConfig, Platform, ProductContext};
use truapi_platform::{
CoreStorageKey, PairingHostConfig, Platform, ProductContext, SignVrfReview,
UserConfirmationReview,
};

/// Distinguishes all remote authority request entrypoints by wire label.
#[derive(Clone, Copy, Debug, derive_more::Display)]
Expand Down Expand Up @@ -888,6 +891,19 @@ impl PairingHost {
);
return Ok(v01::VrfSignature { pre_output, proof });
}
let confirmed = self
.platform
.confirm_user_action(UserConfirmationReview::SignVrf(SignVrfReview {
calling_product_id: calling_product_id.clone(),
request: request.clone(),
}))
.await
.map_err(|err| AuthorityError::Unknown {
reason: format!("VRF signing confirmation failed: {err:?}"),
})?;
if !confirmed {
return Err(AuthorityError::Rejected);
}
self.remote_sign_vrf(cx, &session, calling_product_id, request)
.await
}
Expand Down
2 changes: 1 addition & 1 deletion rust/crates/truapi/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "truapi"
version = "0.6.0"
version = "0.7.0"
edition.workspace = true
license.workspace = true
description = "TrUAPI trait and type definitions"
Expand Down