ConfidentialQrCodeView
public class ConfidentialQrCodeView : ImageView
This class can be used to share secrets with other devices. A cover image, that can be set using Interface builder will be displayed and the QR code will only be uncovered if the user taps or clicks on the image view and has authenticated himself.
If the cover image is shown, then the user will be asked to authenticate
himself as the owner of the device, e.g., by using Face/Touch ID or by
asking for the device passcode. The authentication is performed by using
the LocalAuthentication
framework. Therefore the authentication credentials will be handled by the
operating system an cannot be intercepted by the application.
If the confidential value is shown, tapping on it will invalidate the authentication context. Therefore, in order to display the confidential value again, the user has to authenticate as the device owner anew.
-
The image that should be displayed to the user if the confidential value is hidden. The image could describe the action the user has to perform in order to unhide the confidential value, e.g.,
Tap to show secret.
Declaration
Swift
public var coverImage: Image?
-
The authentication context for displaying the confidential value. Once the confidential value is hidden again, the authentication context will be invalidated.
Declaration
Swift
private var context: AuthenticationContext?
-
Internal variable to keep track if the confidential value is displayed.
Declaration
Swift
private var isConfidentialValueDisplayed: Bool
-
The confidential value in the format of a QR Code.
Declaration
Swift
public var qrCode: QRCode!
-
Initializes an
ImageView
from a coded state. For example, this is called if anImageView
was added via Interface Builder. The default image (e.g., as set in Interface Builder) is taken as the cover image.Declaration
Swift
public required init?(coder aDecoder: NSCoder)
Parameters
coder
The persisted state of the
ConfidentialImageView
.Return Value
nil
ifcoder
does not contain a validConfidentialImageView
. -
Uncovers the confidential value.
Declaration
Swift
private func uncover()
-
Shows an error dialog. The title of the dialog is
Authentication failed
and it can be dismissed by pressing/tappingOk
.Declaration
Swift
private func showError(message: String)
Parameters
message
The error message.
-
Selector that is called upon tapping on the
ConfidentialImageView
. It toggles the confidential and the cover image.Declaration
Swift
@objc private func toggleDisplayingConfidentialValue()