Skip to content

Conversation

chris13524
Copy link
Member

No description provided.

chris13524 and others added 8 commits July 18, 2025 12:44
* feat: Rust sample wallet

* uniffi

* savepoint

* savepoint

* savepoint

* savepoint

* savepoint

* cleanup

* savepoint

* mutex client

* savepoint

---------

Co-authored-by: Chris Smith <[email protected]>
@chris13524 chris13524 marked this pull request as ready for review July 25, 2025 18:49
@chris13524 chris13524 force-pushed the push-yruotstkupns branch 2 times, most recently from a981230 to e3612a6 Compare July 25, 2025 19:27
@llbartekll llbartekll requested a review from Copilot July 28, 2025 13:22
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request adds session persistence functionality to the Yttrium Sign client, allowing sessions to be maintained across application restarts. The implementation includes client state management, cryptographic key persistence, and enhanced session handling capabilities.

Key changes:

  • Session storage and retrieval with encrypted state persistence
  • Cryptographic utilities for topic generation and Diffie-Hellman key exchange
  • Comprehensive session request handling and WebSocket message processing
  • End-to-end testing infrastructure with Playwright

Reviewed Changes

Copilot reviewed 14 out of 16 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
crates/yttrium/src/sign/utils.rs Adds cryptographic utilities for topic generation and key exchange
crates/yttrium/src/sign/protocol_types.rs Defines JSON-RPC message structures for session management
crates/yttrium/src/sign/mod.rs Major refactor to support session persistence and improved WebSocket handling
crates/rust-sample-wallet/src/app.rs New UI component for session management with local storage integration
crates/rust-sample-wallet/src/main.rs Simplified main entry point with logging configuration
Other files Supporting files for testing infrastructure and UI components
Files not reviewed (1)
  • crates/rust-sample-wallet/package-lock.json: Language not supported

Comment on lines +36 to +44
) -> [u8; 32] {
let shared_key = private_key.diffie_hellman(public_key);
let derived_key = hkdf::Hkdf::<Sha256>::new(None, shared_key.as_bytes());
let mut expanded_key = [0u8; 32];
derived_key.expand(b"", &mut expanded_key).unwrap();
expanded_key
Copy link

Copilot AI Jul 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The unwrap() call should be replaced with proper error handling. HKDF expand operations can fail and should return a proper error type instead of panicking.

Suggested change
) -> [u8; 32] {
let shared_key = private_key.diffie_hellman(public_key);
let derived_key = hkdf::Hkdf::<Sha256>::new(None, shared_key.as_bytes());
let mut expanded_key = [0u8; 32];
derived_key.expand(b"", &mut expanded_key).unwrap();
expanded_key
) -> Result<[u8; 32], hkdf::InvalidLength> {
let shared_key = private_key.diffie_hellman(public_key);
let derived_key = hkdf::Hkdf::<Sha256>::new(None, shared_key.as_bytes());
let mut expanded_key = [0u8; 32];
derived_key.expand(b"", &mut expanded_key)?;
Ok(expanded_key)

Copilot uses AI. Check for mistakes.

if let Err(e) =
response_tx.send(response)
{
web_sys::console::log_1(&format!("Failed to send response: {e:?}").into());
Copy link

Copilot AI Jul 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using web_sys::console::log_1 for error handling in production code is not ideal. Consider using the tracing crate which is already imported for consistent logging.

Suggested change
web_sys::console::log_1(&format!("Failed to send response: {e:?}").into());
tracing::error!("Failed to send response: {:?}", e);

Copilot uses AI. Check for mistakes.

Payload::Response(response) => {
if let Some(response_tx) = response_channels.remove(&response.id()) {
if let Err(e) = response_tx.send(response) {
web_sys::console::log_1(&format!("Failed to send response: {e:?}").into());
Copy link

Copilot AI Jul 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duplicate error logging pattern using web_sys::console::log_1. This should be consistent with the tracing infrastructure used elsewhere in the codebase.

Suggested change
web_sys::console::log_1(&format!("Failed to send response: {e:?}").into());
tracing::error!("Failed to send response: {:?}", e);

Copilot uses AI. Check for mistakes.

// TODO may not be string messages
let message = event.data().as_string().unwrap();
tx.send(message).unwrap();
web_sys::console::log_1(&message.clone().into());
Copy link

Copilot AI Jul 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Debug logging using web_sys::console::log_1 should be replaced with tracing::debug! for consistency with the logging infrastructure.

Suggested change
web_sys::console::log_1(&message.clone().into());
tracing::debug!("{}", message.clone());

Copilot uses AI. Check for mistakes.

Comment on lines 757 to 771
result: serde_json::to_value(true).expect("TODO"),
jsonrpc: "2.0".to_string().into(),
}));
let serialized = serde_json::to_string(&request).map_err(|e| {
RequestError::ShouldNeverHappen(format!(
"Failed to serialize request: {e}"
))
}).expect("TODO");
Copy link

Copilot AI Jul 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The expect("TODO") indicates incomplete error handling. This should be replaced with proper error propagation or a more descriptive error message.

Suggested change
result: serde_json::to_value(true).expect("TODO"),
jsonrpc: "2.0".to_string().into(),
}));
let serialized = serde_json::to_string(&request).map_err(|e| {
RequestError::ShouldNeverHappen(format!(
"Failed to serialize request: {e}"
))
}).expect("TODO");
result: serde_json::to_value(true).map_err(|e| {
RequestError::Internal(format!(
"Failed to serialize result: {e}"
))
})?,
jsonrpc: "2.0".to_string().into(),
}));
let serialized = serde_json::to_string(&request).map_err(|e| {
RequestError::ShouldNeverHappen(format!(
"Failed to serialize request: {e}"
))
})?;

Copilot uses AI. Check for mistakes.

Comment on lines 896 to 910
let serialized = serde_json::to_string(&request).map_err(|e| {
RequestError::ShouldNeverHappen(format!(
"Failed to serialize request: {e}"
))
}).expect("TODO");
ws.send_with_str(&serialized).expect("TODO");
Copy link

Copilot AI Jul 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another expect("TODO") that should be replaced with proper error handling to avoid potential panics in production code.

Copilot uses AI. Check for mistakes.

jakubuid and others added 26 commits September 17, 2025 15:29
* ios: update features for xcframework build (#201)

* savepoint

* savepoint

* savepoint

* savepoint

* savepoint

* chore: update Package.swift and podspec for version 0.9.4

* chore: update Package.swift and podspec for version 0.9.45

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* iOS: Package split (#203)

* savepoint

* savepoint

* savepoint

* savepoint

* savepoint

* chore: update Package.swift and podspec for version 0.9.4

* chore: update Package.swift and podspec for version 0.9.45

* savepoint

* savepoint

* savepoint

* add podspec update utils workflow

* savepoint

* update workflows

* fix ci

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* chore: update Package.swift, utils sources, and podspec for version 0.9.46

* support for 16kb pages

* Update gradle.properties

Co-authored-by: Copilot <[email protected]>

* Update crates/kotlin-ffi/android/build.gradle

Co-authored-by: Copilot <[email protected]>

* update

* change profile for local build

* iOS: Package split 2 (#204)

* savepoint

* savepoint

* savepoint

* savepoint

* savepoint

* chore: update Package.swift and podspec for version 0.9.4

* chore: update Package.swift and podspec for version 0.9.45

* savepoint

* savepoint

* savepoint

* add podspec update utils workflow

* savepoint

* update workflows

* fix ci

* savepoint

* fix pods

* savepoint

* test

* chore: update Package.swift, utils sources, and podspec for version 0.9.50

* rename utils modulemap

* chore: update Package.swift, utils sources, and podspec for version 0.9.52

* fix yttrium conflict

* update ignore

* utils(build): enable Sui, namespace FFI (yttriumUtilsFFI), rename libyttrium-utils.a; update build script

* add sui

* savepoint

* select xcode

* chore: update Package.swift, utils sources, and podspec for version 0.9.56

* savepoint

* remove prepare from cocoapods

* savepoint

* chore: update Package.swift, utils sources, and podspec for version 0.9.59

* SPM works

* chore: update Package.swift and podspec for version 0.9.60

* chore: update Package.swift, utils sources, and podspec for version 0.9.61

* fix(utils-spm): package XCFramework zip with top-level libyttrium-utils.xcframework directory for SPM

* chore: update Package.swift, utils sources, and podspec for version 0.9.62

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* chore: update Package.swift and podspec for version 0.9.63

* chore: update Package.swift, utils sources, and podspec for version 0.9.64

* chore: update Package.swift and podspec for version 0.9.67

* Ios deployment target fix (#208)

* savepoint

* savepoint

* savepoint

* savepoint

* savepoint

* chore: update Package.swift and podspec for version 0.9.4

* chore: update Package.swift and podspec for version 0.9.45

* savepoint

* savepoint

* savepoint

* add podspec update utils workflow

* savepoint

* update workflows

* fix ci

* savepoint

* fix pods

* savepoint

* test

* chore: update Package.swift, utils sources, and podspec for version 0.9.50

* rename utils modulemap

* chore: update Package.swift, utils sources, and podspec for version 0.9.52

* fix yttrium conflict

* update ignore

* utils(build): enable Sui, namespace FFI (yttriumUtilsFFI), rename libyttrium-utils.a; update build script

* add sui

* savepoint

* select xcode

* chore: update Package.swift, utils sources, and podspec for version 0.9.56

* savepoint

* remove prepare from cocoapods

* savepoint

* chore: update Package.swift, utils sources, and podspec for version 0.9.59

* SPM works

* chore: update Package.swift and podspec for version 0.9.60

* chore: update Package.swift, utils sources, and podspec for version 0.9.61

* fix(utils-spm): package XCFramework zip with top-level libyttrium-utils.xcframework directory for SPM

* update scripts

* chore: update Package.swift and podspec for version 0.9.65

* chore: update Package.swift, utils sources, and podspec for version 0.9.66

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* chore: update Package.swift and podspec for version 0.9.68

* savepoint

* lint

---------

Co-authored-by: Bartosz Rozwarski <[email protected]>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: jakubuid <[email protected]>
Co-authored-by: Copilot <[email protected]>
@chris13524 chris13524 merged commit 1121c15 into main Sep 24, 2025
12 of 13 checks passed
@chris13524 chris13524 deleted the push-yruotstkupns branch September 24, 2025 17:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants