Skip to content

Commit 257fc83

Browse files
committed
refactor(ffi): expose tapsigner stepwise wait via wait
1 parent c91b137 commit 257fc83

2 files changed

Lines changed: 9 additions & 13 deletions

File tree

cktap-ffi/src/tap_signer.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,9 @@ impl TapSigner {
5050
read(&mut *card, Some(cvc)).await
5151
}
5252

53-
pub async fn wait(&self) -> Result<(), CkTapError> {
53+
pub async fn wait(&self) -> Result<Option<u8>, CkTapError> {
5454
let mut card = self.0.lock().await;
55-
// if auth delay call wait
56-
while card.auth_delay().is_some() {
57-
card.wait(None).await?;
58-
}
59-
Ok(())
55+
card.wait(None).await.map_err(CkTapError::from)
6056
}
6157

6258
pub async fn check_cert(&self) -> Result<(), CertsError> {

cktap-swift/Sources/CKTap/cktap_ffi.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1214,7 +1214,7 @@ public protocol TapSignerProtocol: AnyObject, Sendable {
12141214

12151215
func status() async -> TapSignerStatus
12161216

1217-
func wait() async throws
1217+
func wait() async throws -> UInt8?
12181218

12191219
func xpub(master: Bool, cvc: String) async throws -> String
12201220

@@ -1404,7 +1404,7 @@ open func status()async -> TapSignerStatus {
14041404
)
14051405
}
14061406

1407-
open func wait()async throws {
1407+
open func wait()async throws -> UInt8? {
14081408
return
14091409
try await uniffiRustCallAsync(
14101410
rustFutureFunc: {
@@ -1413,10 +1413,10 @@ open func wait()async throws {
14131413

14141414
)
14151415
},
1416-
pollFunc: ffi_cktap_ffi_rust_future_poll_void,
1417-
completeFunc: ffi_cktap_ffi_rust_future_complete_void,
1418-
freeFunc: ffi_cktap_ffi_rust_future_free_void,
1419-
liftFunc: { $0 },
1416+
pollFunc: ffi_cktap_ffi_rust_future_poll_rust_buffer,
1417+
completeFunc: ffi_cktap_ffi_rust_future_complete_rust_buffer,
1418+
freeFunc: ffi_cktap_ffi_rust_future_free_rust_buffer,
1419+
liftFunc: FfiConverterOptionUInt8.lift,
14201420
errorHandler: FfiConverterTypeCkTapError_lift
14211421
)
14221422
}
@@ -3805,7 +3805,7 @@ private let initializationResult: InitializationResult = {
38053805
if (uniffi_cktap_ffi_checksum_method_tapsigner_status() != 24164) {
38063806
return InitializationResult.apiChecksumMismatch
38073807
}
3808-
if (uniffi_cktap_ffi_checksum_method_tapsigner_wait() != 32878) {
3808+
if (uniffi_cktap_ffi_checksum_method_tapsigner_wait() != 51284) {
38093809
return InitializationResult.apiChecksumMismatch
38103810
}
38113811
if (uniffi_cktap_ffi_checksum_method_tapsigner_xpub() != 22073) {

0 commit comments

Comments
 (0)