Skip to content

Commit

Permalink
Refactor terminate session function
Browse files Browse the repository at this point in the history
  • Loading branch information
sbihel committed Jan 26, 2024
1 parent d1be8fd commit 95ca3ca
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 21 deletions.
10 changes: 5 additions & 5 deletions WalletSdkRs/RustFramework.xcframework/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -10,34 +10,34 @@
<key>HeadersPath</key>
<string>Headers</string>
<key>LibraryIdentifier</key>
<string>ios-arm64_x86_64-simulator</string>
<string>ios-arm64</string>
<key>LibraryPath</key>
<string>libwallet_sdk_rs.a</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
<string>x86_64</string>
</array>
<key>SupportedPlatform</key>
<string>ios</string>
<key>SupportedPlatformVariant</key>
<string>simulator</string>
</dict>
<dict>
<key>BinaryPath</key>
<string>libwallet_sdk_rs.a</string>
<key>HeadersPath</key>
<string>Headers</string>
<key>LibraryIdentifier</key>
<string>ios-arm64</string>
<string>ios-arm64_x86_64-simulator</string>
<key>LibraryPath</key>
<string>libwallet_sdk_rs.a</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
<string>x86_64</string>
</array>
<key>SupportedPlatform</key>
<string>ios</string>
<key>SupportedPlatformVariant</key>
<string>simulator</string>
</dict>
</array>
<key>CFBundlePackageType</key>
Expand Down
Git LFS file not shown
Git LFS file not shown
6 changes: 3 additions & 3 deletions WalletSdkRs/Sources/WalletSdkRs/wallet_sdk_rs.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1308,8 +1308,8 @@ public func submitSignature(sessionManager: SessionManager, signature: Data) thr
)
}

public func terminateSession() throws -> String {
return try FfiConverterString.lift(
public func terminateSession() throws -> Data {
return try FfiConverterData.lift(
try rustCallWithError(FfiConverterTypeTerminationError.lift) {
uniffi_wallet_sdk_rs_fn_func_terminate_session($0)
}
Expand Down Expand Up @@ -1346,7 +1346,7 @@ private var initializationResult: InitializationResult {
if (uniffi_wallet_sdk_rs_checksum_func_submit_signature() != 58193) {
return InitializationResult.apiChecksumMismatch
}
if (uniffi_wallet_sdk_rs_checksum_func_terminate_session() != 30335) {
if (uniffi_wallet_sdk_rs_checksum_func_terminate_session() != 35293) {
return InitializationResult.apiChecksumMismatch
}
if (uniffi_wallet_sdk_rs_checksum_method_mdoc_id() != 56888) {
Expand Down
14 changes: 5 additions & 9 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use isomdl::{
device_engagement::{CentralClientMode, DeviceRetrievalMethods},
device_request,
helpers::NonEmptyMap,
BleOptions, DeviceRetrievalMethod, SessionEstablishment,
session, BleOptions, DeviceRetrievalMethod, SessionEstablishment,
},
presentation::{
device::{self, Document, SessionManagerEngaged, SessionManagerInit},
Expand Down Expand Up @@ -257,19 +257,15 @@ pub enum TerminationError {
}

#[uniffi::export]
fn terminate_session() -> Result<String, TerminationError> {
use isomdl::definitions::session::{SessionData, Status};

let msg = SessionData {
fn terminate_session() -> Result<Vec<u8>, TerminationError> {
let msg = session::SessionData {
data: None,
status: Some(Status::SessionTermination),
status: Some(session::Status::SessionTermination),
};
let msg_bytes = serde_cbor::to_vec(&msg).map_err(|e| TerminationError::Generic {
value: format!("Could not serialize message bytes: {e:?}"),
})?;
let mut response = hex::encode(msg_bytes);
response.insert_str(0, "0x");
Ok(response)
Ok(msg_bytes)
}

#[derive(uniffi::Object)]
Expand Down

0 comments on commit 95ca3ca

Please sign in to comment.