Skip to content

[PM-18042] Build request response structure #275

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weโ€™ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 34 commits into from
Jun 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
c5c5ade
feat: scaffold rpc structure
coroiu Apr 17, 2025
9e7fa7c
wip: implement rpc request
coroiu May 7, 2025
4cc2ef7
feat: add async-trait to workspace and ipc
coroiu May 9, 2025
777e626
wip: scaffold all types for the handler registry
coroiu May 9, 2025
4823779
feat: let error be a handler implementation detail
coroiu May 9, 2025
24faea3
feat: implement handler registry
coroiu May 9, 2025
40f751d
feat: consolidate RpcPayload trait type
coroiu May 9, 2025
88b4b70
refactor: rename RpcRequest -> RpcRequestMessage
coroiu May 9, 2025
97b43b1
refactor: rename RpcResponse -> RpcResponseMessage
coroiu May 9, 2025
dea5dcb
refactor: rename RpcPayload -> RpcRequest
coroiu May 9, 2025
a9c3ea2
refactor: rename payload -> request
coroiu May 9, 2025
8f50ea9
wip: implement client rpc handling
coroiu May 9, 2025
d08d7b8
feat: use RPC as a typed message
coroiu May 12, 2025
824a1ae
wip: process rpc request
coroiu May 12, 2025
b606f0b
feat: implement request handling
coroiu May 12, 2025
bf5f928
feat: implement discover command
coroiu May 13, 2025
ca22419
feat: simplify discover response
coroiu May 13, 2025
5823a13
fix: discover not working
coroiu May 14, 2025
30fd7ab
fix: broken tests
coroiu Jun 12, 2025
43882f0
fix: linting and docs
coroiu Jun 12, 2025
c98bbf3
fix: lint
coroiu Jun 12, 2025
35e2fc5
fix: typescript type showing up as `any`
coroiu Jun 13, 2025
8a24466
feat: add abort signal support
coroiu Jun 13, 2025
18a7a3b
chore: remove println
coroiu Jun 13, 2025
340cfce
fix: try fixing type issue by running npm ci
coroiu Jun 13, 2025
9cd8679
fix: missing types during typecheck
coroiu Jun 13, 2025
491ed61
feat: simplify request error type
coroiu Jun 23, 2025
4de8897
fix: lint
coroiu Jun 23, 2025
64a8bd2
Refactor: Use serde instead of TryFrom<Vec<u8>> traits in IPC (#316)
coroiu Jun 24, 2025
dae6451
fix: `erased-serde` version range
coroiu Jun 25, 2025
8283410
feat: use trait constant
coroiu Jun 25, 2025
1ae377b
feat: clarify function name
coroiu Jun 25, 2025
72ce7e6
OMG THIS COMMA!!!
coroiu Jun 25, 2025
76f74f5
Merge branch 'main' into PM-18042-build-request-response-structure
coroiu Jun 25, 2025
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
19 changes: 19 additions & 0 deletions Cargo.lock

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

3 changes: 3 additions & 0 deletions crates/bitwarden-ipc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,18 @@ wasm = [
] # WASM support

[dependencies]
async-trait = { workspace = true }
bitwarden-error = { workspace = true }
bitwarden-threading = { workspace = true }
erased-serde = ">=0.4.6, <0.5"
js-sys = { workspace = true, optional = true }
log = { workspace = true }
serde = { workspace = true }
serde_json = { workspace = true }
thiserror = { workspace = true }
tokio = { features = ["sync", "time", "rt"], workspace = true }
tsify-next = { workspace = true, optional = true }
uuid = { workspace = true }
wasm-bindgen = { workspace = true, optional = true }
wasm-bindgen-futures = { workspace = true, optional = true }

Expand Down
38 changes: 38 additions & 0 deletions crates/bitwarden-ipc/src/discover/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
use serde::{Deserialize, Serialize};
#[cfg(feature = "wasm")]
use {tsify_next::Tsify, wasm_bindgen::prelude::*};

use crate::{rpc::request::RpcRequest, RpcHandler};

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct DiscoverRequest;

#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "wasm", derive(Tsify), tsify(into_wasm_abi, from_wasm_abi))]
pub struct DiscoverResponse {
pub version: String,
}

impl RpcRequest for DiscoverRequest {
type Response = DiscoverResponse;

const NAME: &str = "DiscoverRequest";
}

pub struct DiscoverHandler {
response: DiscoverResponse,
}

impl DiscoverHandler {
pub fn new(response: DiscoverResponse) -> Self {
Self { response }
}

Check warning on line 29 in crates/bitwarden-ipc/src/discover/mod.rs

View check run for this annotation

Codecov / codecov/patch

crates/bitwarden-ipc/src/discover/mod.rs#L27-L29

Added lines #L27 - L29 were not covered by tests
}

impl RpcHandler for DiscoverHandler {
type Request = DiscoverRequest;

async fn handle(&self, _request: Self::Request) -> DiscoverResponse {
self.response.clone()
}

Check warning on line 37 in crates/bitwarden-ipc/src/discover/mod.rs

View check run for this annotation

Codecov / codecov/patch

crates/bitwarden-ipc/src/discover/mod.rs#L35-L37

Added lines #L35 - L37 were not covered by tests
}
Loading
Loading