Show TOTP codes in password details (#75)

This commit is contained in:
2026-08-11 23:40:24 +02:00
parent 9759162eff
commit 2026637a0e
9 changed files with 640 additions and 110 deletions

View File

@@ -621,7 +621,7 @@ public protocol MobileAuthenticationProtocol: AnyObject, Sendable {
func entryEditor(editor: UInt64) throws -> MobileEntryEditorPage
func entryPage(path: String) throws -> MobileEntryPage
func entryPage(path: String, unixSeconds: UInt64) throws -> MobileEntryPresentation
func generateEntryEditorPassword(editor: UInt64, length: UInt32?, noSymbols: Bool) throws -> MobileEntryEditorPage
@@ -806,12 +806,13 @@ open func entryEditor(editor: UInt64)throws -> MobileEntryEditorPage {
})
}
open func entryPage(path: String)throws -> MobileEntryPage {
return try FfiConverterTypeMobileEntryPage_lift(try rustCallWithError(FfiConverterTypeMobileAuthenticationFfiError_lift) {
open func entryPage(path: String, unixSeconds: UInt64)throws -> MobileEntryPresentation {
return try FfiConverterTypeMobileEntryPresentation_lift(try rustCallWithError(FfiConverterTypeMobileAuthenticationFfiError_lift) {
uniffiCallStatus in
uniffi_ironstorage_apple_fn_method_mobileauthentication_entry_page(
self.uniffiCloneHandle(),
FfiConverterString.lower(path),uniffiCallStatus
FfiConverterString.lower(path),
FfiConverterUInt64.lower(unixSeconds),uniffiCallStatus
)
})
}
@@ -2320,6 +2321,64 @@ public func FfiConverterTypeMobileEntryPage_lower(_ value: MobileEntryPage) -> R
}
public struct MobileEntryPresentation: Equatable, Hashable {
public var page: MobileEntryPage
public var totp: MobileTotpDetail?
public var cacheNotice: String?
// Default memberwise initializers are never public by default, so we
// declare one manually.
public init(page: MobileEntryPage, totp: MobileTotpDetail?, cacheNotice: String?) {
self.page = page
self.totp = totp
self.cacheNotice = cacheNotice
}
}
#if compiler(>=6)
extension MobileEntryPresentation: Sendable {}
#endif
#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeMobileEntryPresentation: FfiConverterRustBuffer {
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> MobileEntryPresentation {
return
try MobileEntryPresentation(
page: FfiConverterTypeMobileEntryPage.read(from: &buf),
totp: FfiConverterOptionTypeMobileTotpDetail.read(from: &buf),
cacheNotice: FfiConverterOptionString.read(from: &buf)
)
}
public static func write(_ value: MobileEntryPresentation, into buf: inout [UInt8]) {
FfiConverterTypeMobileEntryPage.write(value.page, into: &buf)
FfiConverterOptionTypeMobileTotpDetail.write(value.totp, into: &buf)
FfiConverterOptionString.write(value.cacheNotice, into: &buf)
}
}
#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeMobileEntryPresentation_lift(_ buf: RustBuffer) throws -> MobileEntryPresentation {
return try FfiConverterTypeMobileEntryPresentation.lift(buf)
}
#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeMobileEntryPresentation_lower(_ value: MobileEntryPresentation) -> RustBuffer {
return FfiConverterTypeMobileEntryPresentation.lower(value)
}
public struct MobileEntrySection: Equatable, Hashable {
public var kind: MobileEntrySectionKind
public var title: String
@@ -6231,6 +6290,30 @@ fileprivate struct FfiConverterOptionTypeMobileKeyTransferKey: FfiConverterRustB
}
}
#if swift(>=5.8)
@_documentation(visibility: private)
#endif
fileprivate struct FfiConverterOptionTypeMobileTotpDetail: FfiConverterRustBuffer {
typealias SwiftType = MobileTotpDetail?
public static func write(_ value: SwiftType, into buf: inout [UInt8]) {
guard let value = value else {
writeInt(&buf, Int8(0))
return
}
writeInt(&buf, Int8(1))
FfiConverterTypeMobileTotpDetail.write(value, into: &buf)
}
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
switch try readInt(&buf) as Int8 {
case 0: return nil
case 1: return try FfiConverterTypeMobileTotpDetail.read(from: &buf)
default: throw UniffiInternalError.unexpectedOptionalTag
}
}
}
#if swift(>=5.8)
@_documentation(visibility: private)
#endif
@@ -6775,7 +6858,7 @@ private let initializationResult: InitializationResult = {
if (uniffi_ironstorage_apple_checksum_method_mobileauthentication_entry_editor() != 65179) {
return InitializationResult.apiChecksumMismatch
}
if (uniffi_ironstorage_apple_checksum_method_mobileauthentication_entry_page() != 56594) {
if (uniffi_ironstorage_apple_checksum_method_mobileauthentication_entry_page() != 9073) {
return InitializationResult.apiChecksumMismatch
}
if (uniffi_ironstorage_apple_checksum_method_mobileauthentication_generate_entry_editor_password() != 34289) {

View File

@@ -300,7 +300,7 @@ RustBuffer uniffi_ironstorage_apple_fn_method_mobileauthentication_entry_editor(
#endif
#ifndef UNIFFI_FFIDEF_UNIFFI_IRONSTORAGE_APPLE_FN_METHOD_MOBILEAUTHENTICATION_ENTRY_PAGE
#define UNIFFI_FFIDEF_UNIFFI_IRONSTORAGE_APPLE_FN_METHOD_MOBILEAUTHENTICATION_ENTRY_PAGE
RustBuffer uniffi_ironstorage_apple_fn_method_mobileauthentication_entry_page(uint64_t ptr, RustBuffer path, RustCallStatus *_Nonnull out_status
RustBuffer uniffi_ironstorage_apple_fn_method_mobileauthentication_entry_page(uint64_t ptr, RustBuffer path, uint64_t unix_seconds, RustCallStatus *_Nonnull out_status
);
#endif
#ifndef UNIFFI_FFIDEF_UNIFFI_IRONSTORAGE_APPLE_FN_METHOD_MOBILEAUTHENTICATION_GENERATE_ENTRY_EDITOR_PASSWORD