-
Notifications
You must be signed in to change notification settings - Fork 1
Sweep funds from unsupported address types #309
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
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
febf53a
feat: sweep funds from unsupported address types
ben-kaufman 6f3b5f6
Merge branch 'master' into feat/sweep-funds
ben-kaufman 82b045b
Fixes
ben-kaufman 21909ba
Merge branch 'feat/sweep-funds' of https://github.com/synonymdev/bitk…
ben-kaufman 5d9710a
Fix default fee behaviour
ben-kaufman 1b8174e
Check sweepable funds also on regular restore
ben-kaufman a844f97
Merge branch 'master' into feat/sweep-funds
ben-kaufman File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
Bitkit.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
Bitkit/Assets.xcassets/Illustrations/magnifying-glass-illustration.imageset/Contents.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| { | ||
| "images" : [ | ||
| { | ||
| "filename" : "magnifying glass 1.png", | ||
| "idiom" : "universal", | ||
| "scale" : "1x" | ||
| }, | ||
| { | ||
| "filename" : "magnifying glass 1@2x.png", | ||
| "idiom" : "universal", | ||
| "scale" : "2x" | ||
| }, | ||
| { | ||
| "filename" : "magnifying glass 1@3x.png", | ||
| "idiom" : "universal", | ||
| "scale" : "3x" | ||
| } | ||
| ], | ||
| "info" : { | ||
| "author" : "xcode", | ||
| "version" : 1 | ||
| } | ||
| } |
Binary file added
BIN
+36.9 KB
...ets/Illustrations/magnifying-glass-illustration.imageset/magnifying glass 1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+127 KB
.../Illustrations/magnifying-glass-illustration.imageset/magnifying glass 1@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+368 KB
.../Illustrations/magnifying-glass-illustration.imageset/magnifying glass 1@3x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,87 @@ | ||
| import LocalAuthentication | ||
|
|
||
| /// Result of a biometric authentication attempt | ||
| enum BiometricAuthResult { | ||
| case success | ||
| case cancelled | ||
| case failed(message: String) | ||
| } | ||
|
|
||
| /// Utility for biometric authentication (Face ID / Touch ID) | ||
| enum BiometricAuth { | ||
| /// The display name for the current biometry type | ||
| static var biometryTypeName: String { | ||
| switch Env.biometryType { | ||
| case .touchID: | ||
| return t("security__bio_touch_id") | ||
| case .faceID: | ||
| return t("security__bio_face_id") | ||
| default: | ||
| return t("security__bio_face_id") | ||
| } | ||
| } | ||
|
|
||
| /// Whether biometric authentication is available on this device | ||
| static var isAvailable: Bool { | ||
| let context = LAContext() | ||
| var error: NSError? | ||
| return context.canEvaluatePolicy(.deviceOwnerAuthenticationWithBiometrics, error: &error) | ||
| } | ||
|
|
||
| /// Authenticate using biometrics (Face ID or Touch ID) | ||
| /// - Returns: Result indicating success, cancellation, or failure with error message | ||
| @MainActor | ||
| static func authenticate() async -> BiometricAuthResult { | ||
| await withCheckedContinuation { continuation in | ||
| let context = LAContext() | ||
| var error: NSError? | ||
|
|
||
| guard context.canEvaluatePolicy(.deviceOwnerAuthenticationWithBiometrics, error: &error) else { | ||
| let message = errorMessage(for: error) | ||
| if let message { | ||
| continuation.resume(returning: .failed(message: message)) | ||
| } else { | ||
| continuation.resume(returning: .cancelled) | ||
| } | ||
| return | ||
| } | ||
|
|
||
| let reason = t("security__bio_confirm", variables: ["biometricsName": biometryTypeName]) | ||
|
|
||
| context.evaluatePolicy(.deviceOwnerAuthenticationWithBiometrics, localizedReason: reason) { success, authError in | ||
| DispatchQueue.main.async { | ||
| if success { | ||
| Logger.debug("Biometric authentication successful", context: "BiometricAuth") | ||
| continuation.resume(returning: .success) | ||
| } else if let authError { | ||
| let message = errorMessage(for: authError) | ||
| if let message { | ||
| continuation.resume(returning: .failed(message: message)) | ||
| } else { | ||
| continuation.resume(returning: .cancelled) | ||
| } | ||
| } else { | ||
| continuation.resume(returning: .cancelled) | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| /// Convert LAError to user-facing error message | ||
| /// Returns nil for user-initiated cancellations (no error to show) | ||
| private static func errorMessage(for error: Error?) -> String? { | ||
| guard let error else { return nil } | ||
|
|
||
| let nsError = error as NSError | ||
|
|
||
| switch nsError.code { | ||
| case LAError.biometryNotAvailable.rawValue, LAError.biometryNotEnrolled.rawValue: | ||
| return t("security__bio_not_available") | ||
| case LAError.userCancel.rawValue, LAError.userFallback.rawValue: | ||
| return nil | ||
| default: | ||
| return t("security__bio_error_message", variables: ["type": biometryTypeName]) | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.