Documentation
¶
Overview ¶
Package localauthentication provides Go bindings for the LocalAuthentication framework.
Authenticate users biometrically or with a passphrase they already know.
Many users rely on biometric authentication like Face ID, Touch ID, or Optic ID to enable secure, effortless access to their devices. As a fallback option, and for devices without biometry, a passcode or password serves a similar purpose. Use the LocalAuthentication framework to leverage these mechanisms in your app and extend authentication procedures your app already implements.
Essentials ¶
- Logging a User into Your App with Face ID or Touch ID: Supplement your own authentication scheme with biometric authentication, making it easy for users to access sensitive parts of your app.
- Accessing Keychain Items with Face ID or Touch ID: Protect a keychain item with biometric authentication.
Authentication and access ¶
- LARight: A grouped set of requirements that gate access to a resource or operation.
- LARightState: The possible states for a right during authorization.
- LAContext: A mechanism for evaluating authentication policies and access controls. (LAPolicy, LABiometryType, LAAccessControlOperation, LACredentialType)
Persistence ¶
- LARightStore: A container for data protected by a right.
- LAPersistedRight: A right that gates access to a key and a secret.
- LASecret: Data that’s protected by a persisted right.
Key pairs ¶
- LAPublicKey: The public portion of an asymmetric key pair.
- LAPrivateKey: The private portion of an asymmetric key pair.
Requirements ¶
- LAAuthenticationRequirement: A set of requirements that protect a right.
- LABiometryFallbackRequirement: A set of requirements to fall back on if biometrics aren’t present.
Errors ¶
- LAError: Errors issued by the LocalAuthentication framework.
- LAErrorDomain: The error domain that the framework uses when issuing errors.
Classes ¶
- LADomainState
- LADomainStateBiometry
- LADomainStateCompanion
- LAEnvironment
- LAEnvironmentMechanism
- LAEnvironmentMechanismBiometry
- LAEnvironmentMechanismCompanion
- LAEnvironmentMechanismUserPassword
- LAEnvironmentState
Protocols ¶
Macros ¶
- LA_EXPORT
- LA_EXTERN
- kLAAccessControlOperationCreateItem
- kLAAccessControlOperationCreateKey
- kLAAccessControlOperationUseItem
- kLAAccessControlOperationUseKeyDecrypt
- kLAAccessControlOperationUseKeyKeyExchange
- kLAAccessControlOperationUseKeySign
- kLACompanionTypeMac
- kLACompanionTypeNone
- kLACompanionTypeVision
- kLACompanionTypeWatch
- kLAErrorCompanionNotAvailable
- kLAPolicyDeviceOwnerAuthenticationWithBiometricsOrCompanion
- kLAPolicyDeviceOwnerAuthenticationWithCompanion
Enumerations ¶
Key Types ¶
- LAContext - A mechanism for evaluating authentication policies and access controls.
- LARight - A grouped set of requirements that gate access to a resource or operation.
- LAPrivateKey - The private portion of an asymmetric key pair.
- LARightStore - A container for data protected by a right.
- LAEnvironmentMechanismBiometry
- LAPublicKey - The public portion of an asymmetric key pair.
- LAAuthenticationRequirement - A set of requirements that protect a right.
- LAEnvironment
- LAEnvironmentState
- LAPersistedRight - A right that gates access to a key and a secret.
Code generated from Apple documentation. DO NOT EDIT.
Index ¶
- Variables
- func NewBoolErrorBlock(handler BoolErrorHandler) (objc.ID, func())
- func NewDataErrorBlock(handler DataErrorHandler) (objc.ID, func())
- func NewErrorBlock(handler ErrorHandler) (objc.ID, func())
- func NewLAPersistedRightErrorBlock(handler LAPersistedRightErrorHandler) (objc.ID, func())
- func NewVoidBlock(handler VoidHandler) (objc.ID, func())
- type BoolErrorHandler
- type DataErrorHandler
- type ErrorHandler
- type ILAAuthenticationRequirement
- type ILABiometryFallbackRequirement
- type ILAContext
- type ILADomainState
- type ILADomainStateBiometry
- type ILADomainStateCompanion
- type ILAEnvironment
- type ILAEnvironmentMechanism
- type ILAEnvironmentMechanismBiometry
- type ILAEnvironmentMechanismCompanion
- type ILAEnvironmentMechanismUserPassword
- type ILAEnvironmentState
- type ILAPersistedRight
- type ILAPrivateKey
- type ILAPublicKey
- type ILARight
- type ILARightStore
- type ILASecret
- type LAAccessControlOperation
- type LAAuthenticationRequirement
- type LAAuthenticationRequirementClass
- func (lc LAAuthenticationRequirementClass) Alloc() LAAuthenticationRequirement
- func (_LAAuthenticationRequirementClass LAAuthenticationRequirementClass) BiometryCurrentSetRequirement() LAAuthenticationRequirement
- func (_LAAuthenticationRequirementClass LAAuthenticationRequirementClass) BiometryRequirement() LAAuthenticationRequirement
- func (_LAAuthenticationRequirementClass LAAuthenticationRequirementClass) BiometryRequirementWithFallback(fallback ILABiometryFallbackRequirement) LAAuthenticationRequirement
- func (lc LAAuthenticationRequirementClass) Class() objc.Class
- func (_LAAuthenticationRequirementClass LAAuthenticationRequirementClass) DefaultRequirement() LAAuthenticationRequirement
- type LABiometryFallbackRequirement
- type LABiometryFallbackRequirementClass
- func (lc LABiometryFallbackRequirementClass) Alloc() LABiometryFallbackRequirement
- func (lc LABiometryFallbackRequirementClass) Class() objc.Class
- func (_LABiometryFallbackRequirementClass LABiometryFallbackRequirementClass) DefaultRequirement() LABiometryFallbackRequirement
- func (_LABiometryFallbackRequirementClass LABiometryFallbackRequirementClass) DevicePasscodeRequirement() LABiometryFallbackRequirement
- type LABiometryType
- type LACompanionType
- type LAContext
- func (c LAContext) Autorelease() LAContext
- func (c LAContext) BiometryType() LABiometryType
- func (c LAContext) CanEvaluatePolicyError(policy LAPolicy) (bool, error)
- func (c LAContext) DomainState() ILADomainState
- func (c LAContext) EvaluateAccessControlOperationLocalizedReasonReply(accessControl security.SecAccessControlRef, operation LAAccessControlOperation, ...)
- func (c LAContext) EvaluateAccessControlOperationLocalizedReasonReplySync(ctx context.Context, accessControl security.SecAccessControlRef, ...) (bool, error)
- func (c LAContext) EvaluatePolicyLocalizedReasonReply(policy LAPolicy, localizedReason string, reply BoolErrorHandler)
- func (c LAContext) EvaluatePolicyLocalizedReasonReplySync(ctx context.Context, policy LAPolicy, localizedReason string) (bool, error)
- func (c LAContext) EvaluatedPolicyDomainState() foundation.NSData
- func (c LAContext) Init() LAContext
- func (c LAContext) InteractionNotAllowed() bool
- func (c LAContext) Invalidate()
- func (c LAContext) IsCredentialSet(type_ LACredentialType) bool
- func (c LAContext) LocalizedCancelTitle() string
- func (c LAContext) LocalizedFallbackTitle() string
- func (c LAContext) LocalizedReason() string
- func (c LAContext) SetCredentialType(credential foundation.NSData, type_ LACredentialType) bool
- func (c LAContext) SetInteractionNotAllowed(value bool)
- func (c LAContext) SetLocalizedCancelTitle(value string)
- func (c LAContext) SetLocalizedFallbackTitle(value string)
- func (c LAContext) SetLocalizedReason(value string)
- func (c LAContext) SetTouchIDAuthenticationAllowableReuseDuration(value foundation.NSTimeInterval)
- func (c LAContext) TouchIDAuthenticationAllowableReuseDuration() foundation.NSTimeInterval
- type LAContextClass
- type LACredentialType
- type LADomainState
- type LADomainStateBiometry
- type LADomainStateBiometryClass
- type LADomainStateClass
- type LADomainStateCompanion
- func (d LADomainStateCompanion) Autorelease() LADomainStateCompanion
- func (d LADomainStateCompanion) AvailableCompanionTypes() foundation.INSSet
- func (d LADomainStateCompanion) Init() LADomainStateCompanion
- func (d LADomainStateCompanion) StateHash() foundation.NSData
- func (d LADomainStateCompanion) StateHashForCompanionType(companionType LACompanionType) foundation.NSData
- type LADomainStateCompanionClass
- type LAEnvironment
- type LAEnvironmentClass
- type LAEnvironmentMechanism
- type LAEnvironmentMechanismBiometry
- func (e LAEnvironmentMechanismBiometry) Autorelease() LAEnvironmentMechanismBiometry
- func (e LAEnvironmentMechanismBiometry) BiometryType() LABiometryType
- func (e LAEnvironmentMechanismBiometry) BuiltInSensorInaccessible() bool
- func (e LAEnvironmentMechanismBiometry) Init() LAEnvironmentMechanismBiometry
- func (e LAEnvironmentMechanismBiometry) IsEnrolled() bool
- func (e LAEnvironmentMechanismBiometry) IsLockedOut() bool
- func (e LAEnvironmentMechanismBiometry) StateHash() foundation.NSData
- type LAEnvironmentMechanismBiometryClass
- type LAEnvironmentMechanismClass
- type LAEnvironmentMechanismCompanion
- func (e LAEnvironmentMechanismCompanion) Autorelease() LAEnvironmentMechanismCompanion
- func (e LAEnvironmentMechanismCompanion) Init() LAEnvironmentMechanismCompanion
- func (e LAEnvironmentMechanismCompanion) StateHash() foundation.NSData
- func (e LAEnvironmentMechanismCompanion) Type() LACompanionType
- type LAEnvironmentMechanismCompanionClass
- type LAEnvironmentMechanismUserPassword
- type LAEnvironmentMechanismUserPasswordClass
- type LAEnvironmentObserver
- type LAEnvironmentObserverObject
- type LAEnvironmentState
- func (e LAEnvironmentState) AllMechanisms() []LAEnvironmentMechanism
- func (e LAEnvironmentState) Autorelease() LAEnvironmentState
- func (e LAEnvironmentState) Biometry() ILAEnvironmentMechanismBiometry
- func (e LAEnvironmentState) Companions() []LAEnvironmentMechanismCompanion
- func (e LAEnvironmentState) Init() LAEnvironmentState
- func (e LAEnvironmentState) UserPassword() ILAEnvironmentMechanismUserPassword
- type LAEnvironmentStateClass
- type LAError
- type LAPersistedRight
- type LAPersistedRightClass
- type LAPersistedRightErrorHandler
- type LAPolicy
- type LAPrivateKey
- func (p LAPrivateKey) Autorelease() LAPrivateKey
- func (p LAPrivateKey) CanDecryptUsingSecKeyAlgorithm(algorithm corefoundation.CFStringRef) bool
- func (p LAPrivateKey) CanExchangeKeysUsingSecKeyAlgorithm(algorithm corefoundation.CFStringRef) bool
- func (p LAPrivateKey) CanSignUsingSecKeyAlgorithm(algorithm corefoundation.CFStringRef) bool
- func (p LAPrivateKey) DecryptDataSecKeyAlgorithmCompletion(data foundation.NSData, algorithm corefoundation.CFStringRef, ...)
- func (p LAPrivateKey) DecryptDataSecKeyAlgorithmCompletionSync(ctx context.Context, data foundation.NSData, ...) (*foundation.NSData, error)
- func (p LAPrivateKey) ExchangeKeysWithPublicKeySecKeyAlgorithmSecKeyParametersCompletion(publicKey foundation.NSData, algorithm corefoundation.CFStringRef, ...)
- func (p LAPrivateKey) ExchangeKeysWithPublicKeySecKeyAlgorithmSecKeyParametersCompletionSync(ctx context.Context, publicKey foundation.NSData, ...) (*foundation.NSData, error)
- func (p LAPrivateKey) Init() LAPrivateKey
- func (p LAPrivateKey) PublicKey() ILAPublicKey
- func (p LAPrivateKey) SignDataSecKeyAlgorithmCompletion(data foundation.NSData, algorithm corefoundation.CFStringRef, ...)
- func (p LAPrivateKey) SignDataSecKeyAlgorithmCompletionSync(ctx context.Context, data foundation.NSData, ...) (*foundation.NSData, error)
- type LAPrivateKeyClass
- type LAPublicKey
- func (p LAPublicKey) Autorelease() LAPublicKey
- func (p LAPublicKey) CanEncryptUsingSecKeyAlgorithm(algorithm corefoundation.CFStringRef) bool
- func (p LAPublicKey) CanVerifyUsingSecKeyAlgorithm(algorithm corefoundation.CFStringRef) bool
- func (p LAPublicKey) EncryptDataSecKeyAlgorithmCompletion(data foundation.NSData, algorithm corefoundation.CFStringRef, ...)
- func (p LAPublicKey) EncryptDataSecKeyAlgorithmCompletionSync(ctx context.Context, data foundation.NSData, ...) (*foundation.NSData, error)
- func (p LAPublicKey) ExportBytes(ctx context.Context) (*foundation.NSData, error)
- func (p LAPublicKey) ExportBytesWithCompletion(handler DataErrorHandler)
- func (p LAPublicKey) Init() LAPublicKey
- func (p LAPublicKey) VerifyDataSignatureSecKeyAlgorithmCompletion(signedData foundation.NSData, signature foundation.NSData, ...)
- func (p LAPublicKey) VerifyDataSignatureSecKeyAlgorithmCompletionSync(ctx context.Context, signedData foundation.NSData, signature foundation.NSData, ...) error
- type LAPublicKeyClass
- type LARight
- func (r LARight) AuthorizeWithLocalizedReasonCompletion(localizedReason string, handler ErrorHandler)
- func (r LARight) AuthorizeWithLocalizedReasonCompletionSync(ctx context.Context, localizedReason string) error
- func (r LARight) AuthorizeWithLocalizedReasonInPresentationContextCompletion(localizedReason string, presentationContext unsafe.Pointer, ...)
- func (r LARight) AuthorizeWithLocalizedReasonInPresentationContextCompletionSync(ctx context.Context, localizedReason string, ...) error
- func (r LARight) Autorelease() LARight
- func (r LARight) CheckCanAuthorize(ctx context.Context) error
- func (r LARight) CheckCanAuthorizeWithCompletion(handler ErrorHandler)
- func (r LARight) Deauthorize(ctx context.Context) error
- func (r LARight) DeauthorizeWithCompletion(handler VoidHandler)
- func (r LARight) Init() LARight
- func (r LARight) InitWithRequirement(requirement ILAAuthenticationRequirement) LARight
- func (r LARight) SetTag(value int)
- func (r LARight) State() LARightState
- func (r LARight) Tag() int
- type LARightClass
- type LARightState
- type LARightStore
- func (r LARightStore) Autorelease() LARightStore
- func (r LARightStore) Init() LARightStore
- func (r LARightStore) RemoveAllRights(ctx context.Context) error
- func (r LARightStore) RemoveAllRightsWithCompletion(handler ErrorHandler)
- func (r LARightStore) RemoveRightCompletion(right ILAPersistedRight, handler ErrorHandler)
- func (r LARightStore) RemoveRightCompletionSync(ctx context.Context, right ILAPersistedRight) error
- func (r LARightStore) RemoveRightForIdentifierCompletion(identifier string, handler ErrorHandler)
- func (r LARightStore) RemoveRightForIdentifierCompletionSync(ctx context.Context, identifier string) error
- func (r LARightStore) RightForIdentifierCompletion(identifier string, handler LAPersistedRightErrorHandler)
- func (r LARightStore) RightForIdentifierCompletionSync(ctx context.Context, identifier string) (*LAPersistedRight, error)
- func (r LARightStore) SaveRightIdentifierCompletion(right ILARight, identifier string, handler LAPersistedRightErrorHandler)
- func (r LARightStore) SaveRightIdentifierCompletionSync(ctx context.Context, right ILARight, identifier string) (*LAPersistedRight, error)
- func (r LARightStore) SaveRightIdentifierSecretCompletion(right ILARight, identifier string, secret foundation.NSData, ...)
- func (r LARightStore) SaveRightIdentifierSecretCompletionSync(ctx context.Context, right ILARight, identifier string, ...) (*LAPersistedRight, error)
- type LARightStoreClass
- type LASecret
- type LASecretClass
- type VoidHandler
Constants ¶
This section is empty.
Variables ¶
var ( // LAErrorDomain is the error domain that the framework uses when issuing errors. // // See: https://developer.apple.com/documentation/LocalAuthentication/LAErrorDomain LAErrorDomain string )
var ( // LATouchIDAuthenticationMaximumAllowableReuseDuration is the maximum allowable reuse duration. // // See: https://developer.apple.com/documentation/LocalAuthentication/LATouchIDAuthenticationMaximumAllowableReuseDuration LATouchIDAuthenticationMaximumAllowableReuseDuration float64 )
Functions ¶
func NewBoolErrorBlock ¶
func NewBoolErrorBlock(handler BoolErrorHandler) (objc.ID, func())
NewBoolErrorBlock wraps a Go BoolErrorHandler as an Objective-C block. The caller must defer the returned cleanup function.
Used by:
func NewDataErrorBlock ¶
func NewDataErrorBlock(handler DataErrorHandler) (objc.ID, func())
NewDataErrorBlock wraps a Go DataErrorHandler as an Objective-C block. The caller must defer the returned cleanup function.
Used by:
func NewErrorBlock ¶
func NewErrorBlock(handler ErrorHandler) (objc.ID, func())
NewErrorBlock wraps a Go ErrorHandler as an Objective-C block. The caller must defer the returned cleanup function.
Used by:
- LAPublicKey.VerifyDataSignatureSecKeyAlgorithmCompletion
- LARight.AuthorizeWithLocalizedReasonCompletion
- LARight.AuthorizeWithLocalizedReasonInPresentationContextCompletion
- LARight.CheckCanAuthorizeWithCompletion
- LARightStore.RemoveAllRightsWithCompletion
- LARightStore.RemoveRightCompletion
- LARightStore.RemoveRightForIdentifierCompletion
func NewLAPersistedRightErrorBlock ¶
func NewLAPersistedRightErrorBlock(handler LAPersistedRightErrorHandler) (objc.ID, func())
NewLAPersistedRightErrorBlock wraps a Go LAPersistedRightErrorHandler as an Objective-C block. The caller must defer the returned cleanup function.
Used by:
func NewVoidBlock ¶
func NewVoidBlock(handler VoidHandler) (objc.ID, func())
NewVoidBlock wraps a Go VoidHandler as an Objective-C block. The caller must defer the returned cleanup function.
Used by:
Types ¶
type BoolErrorHandler ¶
BoolErrorHandler handles A closure that is executed when policy evaluation finishes.
- success: [true](<doc://com.apple.documentation/documentation/Swift/true>) if policy evaluation succeeded, otherwise [false](<doc://com.apple.documentation/documentation/Swift/false>).
- error: `nil` if policy evaluation succeeded, an error object that should be presented to the user otherwise. See [LAError.Code](<doc://com.apple.localauthentication/documentation/LocalAuthentication/LAError-swift.struct/Code>) for possible error codes
The error can be type-asserted to *foundation.NSError for Domain, Code, and UserInfo.
Used by:
type DataErrorHandler ¶
type DataErrorHandler = func(*foundation.NSData, error)
DataErrorHandler handles A completion handler to call when the decryption operation completes.
- data: The result of the key exchange operation.
- error: An error object that indicates why the key exchange failed, or `nil` if the exchange succeeded.
The error can be type-asserted to *foundation.NSError for Domain, Code, and UserInfo.
Used by:
type ErrorHandler ¶
type ErrorHandler = func(error)
ErrorHandler handles A completion handler to call when the verification operation completes. The error can be type-asserted to *foundation.NSError for Domain, Code, and UserInfo.
Used by:
- LAPublicKey.VerifyDataSignatureSecKeyAlgorithmCompletion
- LARight.AuthorizeWithLocalizedReasonCompletion
- LARight.AuthorizeWithLocalizedReasonInPresentationContextCompletion
- LARight.CheckCanAuthorizeWithCompletion
- LARightStore.RemoveAllRightsWithCompletion
- LARightStore.RemoveRightCompletion
- LARightStore.RemoveRightForIdentifierCompletion
type ILAAuthenticationRequirement ¶
type ILAAuthenticationRequirement interface {
objectivec.IObject
}
An interface definition for the LAAuthenticationRequirement class.
See: https://developer.apple.com/documentation/LocalAuthentication/LAAuthenticationRequirement
type ILABiometryFallbackRequirement ¶
type ILABiometryFallbackRequirement interface {
objectivec.IObject
}
An interface definition for the LABiometryFallbackRequirement class.
See: https://developer.apple.com/documentation/LocalAuthentication/LABiometryFallbackRequirement
type ILAContext ¶
type ILAContext interface {
objectivec.IObject
// Assesses whether authentication can proceed for a given policy.
CanEvaluatePolicyError(policy LAPolicy) (bool, error)
// The type of biometric authentication supported by the device.
BiometryType() LABiometryType
// Evaluates the specified policy.
EvaluatePolicyLocalizedReasonReply(policy LAPolicy, localizedReason string, reply BoolErrorHandler)
// The current state of the evaluated policy domain.
EvaluatedPolicyDomainState() foundation.NSData
// Evaluates an access control for a given operation.
EvaluateAccessControlOperationLocalizedReasonReply(accessControl security.SecAccessControlRef, operation LAAccessControlOperation, localizedReason string, reply BoolErrorHandler)
// A Boolean value indicating whether authentication can be interactive.
InteractionNotAllowed() bool
SetInteractionNotAllowed(value bool)
// The localized explanation for authentication shown in the dialog presented to the user.
LocalizedReason() string
SetLocalizedReason(value string)
// The localized title for the fallback button in the dialog presented to the user during authentication.
LocalizedFallbackTitle() string
SetLocalizedFallbackTitle(value string)
// The localized title for the cancel button in the dialog presented to the user during authentication.
LocalizedCancelTitle() string
SetLocalizedCancelTitle(value string)
// The duration for which Touch ID authentication reuse is allowable.
TouchIDAuthenticationAllowableReuseDuration() foundation.NSTimeInterval
SetTouchIDAuthenticationAllowableReuseDuration(value foundation.NSTimeInterval)
// Sets an application-provided credential to be used when evaluating authentication.
SetCredentialType(credential foundation.NSData, type_ LACredentialType) bool
// Returns a Boolean value indicating whether the specified credential type is set.
IsCredentialSet(type_ LACredentialType) bool
// Invalidates the authentication context.
Invalidate()
// Contains authentication domain state.
DomainState() ILADomainState
}
An interface definition for the LAContext class.
Checking availability ¶
- [ILAContext.CanEvaluatePolicyError]: Assesses whether authentication can proceed for a given policy.
- [ILAContext.BiometryType]: The type of biometric authentication supported by the device.
Evaluating authentication policies ¶
- [ILAContext.EvaluatePolicyLocalizedReasonReply]: Evaluates the specified policy.
- [ILAContext.EvaluatedPolicyDomainState]: The current state of the evaluated policy domain.
Evaluating access controls ¶
- [ILAContext.EvaluateAccessControlOperationLocalizedReasonReply]: Evaluates an access control for a given operation.
- [ILAContext.InteractionNotAllowed]: A Boolean value indicating whether authentication can be interactive.
- [ILAContext.SetInteractionNotAllowed]
Customizing authentication prompts ¶
- [ILAContext.LocalizedReason]: The localized explanation for authentication shown in the dialog presented to the user.
- [ILAContext.SetLocalizedReason]
- [ILAContext.LocalizedFallbackTitle]: The localized title for the fallback button in the dialog presented to the user during authentication.
- [ILAContext.SetLocalizedFallbackTitle]
- [ILAContext.LocalizedCancelTitle]: The localized title for the cancel button in the dialog presented to the user during authentication.
- [ILAContext.SetLocalizedCancelTitle]
Reusing device unlock state ¶
- [ILAContext.TouchIDAuthenticationAllowableReuseDuration]: The duration for which Touch ID authentication reuse is allowable.
- [ILAContext.SetTouchIDAuthenticationAllowableReuseDuration]
Managing credentials ¶
- [ILAContext.SetCredentialType]: Sets an application-provided credential to be used when evaluating authentication.
- [ILAContext.IsCredentialSet]: Returns a Boolean value indicating whether the specified credential type is set.
Invalidating the authentication context ¶
- [ILAContext.Invalidate]: Invalidates the authentication context.
Instance Properties ¶
- [ILAContext.DomainState]: Contains authentication domain state.
See: https://developer.apple.com/documentation/LocalAuthentication/LAContext
type ILADomainState ¶
type ILADomainState interface {
objectivec.IObject
// Contains biometric domain state.
Biometry() ILADomainStateBiometry
// Contains companion domain state.
Companion() ILADomainStateCompanion
// Contains combined state hash data for biometry and companion state hashes.
StateHash() foundation.NSData
}
An interface definition for the LADomainState class.
Instance Properties ¶
- [ILADomainState.Biometry]: Contains biometric domain state.
- [ILADomainState.Companion]: Contains companion domain state.
- [ILADomainState.StateHash]: Contains combined state hash data for biometry and companion state hashes.
See: https://developer.apple.com/documentation/LocalAuthentication/LADomainState
type ILADomainStateBiometry ¶
type ILADomainStateBiometry interface {
objectivec.IObject
// Indicates biometry type available on the device.
BiometryType() LABiometryType
// Contains state hash data for the available biometry type. Returns `nil` if no biometry entities are enrolled.
StateHash() foundation.NSData
}
An interface definition for the LADomainStateBiometry class.
Instance Properties ¶
- [ILADomainStateBiometry.BiometryType]: Indicates biometry type available on the device.
- [ILADomainStateBiometry.StateHash]: Contains state hash data for the available biometry type. Returns `nil` if no biometry entities are enrolled.
See: https://developer.apple.com/documentation/LocalAuthentication/LADomainStateBiometry
type ILADomainStateCompanion ¶
type ILADomainStateCompanion interface {
objectivec.IObject
// Indicates types of companions paired with the device. The elements are NSNumber-wrapped instances of @c [LACompanionType].
AvailableCompanionTypes() foundation.INSSet
// Contains combined state hash data for all available companion types. . Returns `nil` if no companion devices are paired.
StateHash() foundation.NSData
// Returns state hash data for the given companion type.
StateHashForCompanionType(companionType LACompanionType) foundation.NSData
}
An interface definition for the LADomainStateCompanion class.
Instance Properties ¶
- [ILADomainStateCompanion.AvailableCompanionTypes]: Indicates types of companions paired with the device. The elements are NSNumber-wrapped instances of @c LACompanionType.
- [ILADomainStateCompanion.StateHash]: Contains combined state hash data for all available companion types. . Returns `nil` if no companion devices are paired.
Instance Methods ¶
- [ILADomainStateCompanion.StateHashForCompanionType]: Returns state hash data for the given companion type.
See: https://developer.apple.com/documentation/LocalAuthentication/LADomainStateCompanion
type ILAEnvironment ¶
type ILAEnvironment interface {
objectivec.IObject
// The environment state information.
State() objectivec.IObject
AddObserver(observer LAEnvironmentObserver)
RemoveObserver(observer LAEnvironmentObserver)
}
An interface definition for the LAEnvironment class.
Instance Properties ¶
- [ILAEnvironment.State]: The environment state information.
Instance Methods ¶
- [ILAEnvironment.AddObserver]
- [ILAEnvironment.RemoveObserver]
See: https://developer.apple.com/documentation/LocalAuthentication/LAEnvironment
type ILAEnvironmentMechanism ¶
type ILAEnvironmentMechanism interface {
objectivec.IObject
// Name of the SF Symbol representing this authentication mechanism.
IconSystemName() string
IsUsable() bool
// The localized name of the authentication mechanism, e.g. “Touch ID”, “Face ID” etc.
LocalizedName() string
}
An interface definition for the LAEnvironmentMechanism class.
Instance Properties ¶
- [ILAEnvironmentMechanism.IconSystemName]: Name of the SF Symbol representing this authentication mechanism.
- [ILAEnvironmentMechanism.IsUsable]
- [ILAEnvironmentMechanism.LocalizedName]: The localized name of the authentication mechanism, e.g. “Touch ID”, “Face ID” etc.
See: https://developer.apple.com/documentation/LocalAuthentication/LAEnvironment/Mechanism
type ILAEnvironmentMechanismBiometry ¶
type ILAEnvironmentMechanismBiometry interface {
ILAEnvironmentMechanism
BiometryType() LABiometryType
BuiltInSensorInaccessible() bool
IsEnrolled() bool
IsLockedOut() bool
StateHash() foundation.NSData
}
An interface definition for the LAEnvironmentMechanismBiometry class.
Instance Properties ¶
- [ILAEnvironmentMechanismBiometry.BiometryType]
- [ILAEnvironmentMechanismBiometry.BuiltInSensorInaccessible]
- [ILAEnvironmentMechanismBiometry.IsEnrolled]
- [ILAEnvironmentMechanismBiometry.IsLockedOut]
- [ILAEnvironmentMechanismBiometry.StateHash]
See: https://developer.apple.com/documentation/LocalAuthentication/LAEnvironment/MechanismBiometry
type ILAEnvironmentMechanismCompanion ¶
type ILAEnvironmentMechanismCompanion interface {
ILAEnvironmentMechanism
StateHash() foundation.NSData
// Type of the companion.
Type() LACompanionType
}
An interface definition for the LAEnvironmentMechanismCompanion class.
Instance Properties ¶
- [ILAEnvironmentMechanismCompanion.StateHash]
- [ILAEnvironmentMechanismCompanion.Type]: Type of the companion.
See: https://developer.apple.com/documentation/LocalAuthentication/LAEnvironment/MechanismCompanion
type ILAEnvironmentMechanismUserPassword ¶
type ILAEnvironmentMechanismUserPassword interface {
ILAEnvironmentMechanism
IsSet() bool
}
An interface definition for the LAEnvironmentMechanismUserPassword class.
Instance Properties ¶
- [ILAEnvironmentMechanismUserPassword.IsSet]
See: https://developer.apple.com/documentation/LocalAuthentication/LAEnvironment/MechanismUserPassword
type ILAEnvironmentState ¶
type ILAEnvironmentState interface {
objectivec.IObject
AllMechanisms() []LAEnvironmentMechanism
Biometry() ILAEnvironmentMechanismBiometry
Companions() []LAEnvironmentMechanismCompanion
UserPassword() ILAEnvironmentMechanismUserPassword
}
An interface definition for the LAEnvironmentState class.
Instance Properties ¶
- [ILAEnvironmentState.AllMechanisms]
- [ILAEnvironmentState.Biometry]
- [ILAEnvironmentState.Companions]
- [ILAEnvironmentState.UserPassword]
See: https://developer.apple.com/documentation/LocalAuthentication/LAEnvironment/State-swift.class
type ILAPersistedRight ¶
type ILAPersistedRight interface {
ILARight
// The private key that’s persisted by the right.
Key() ILAPrivateKey
// The data kept secret by the right.
Secret() ILASecret
}
An interface definition for the LAPersistedRight class.
Accessing persistent data ¶
- [ILAPersistedRight.Key]: The private key that’s persisted by the right.
- [ILAPersistedRight.Secret]: The data kept secret by the right.
See: https://developer.apple.com/documentation/LocalAuthentication/LAPersistedRight
type ILAPrivateKey ¶
type ILAPrivateKey interface {
objectivec.IObject
// The public key that corresponds with the private key in a key pair.
PublicKey() ILAPublicKey
// Checks whether the algorithm you supply is valid for decrypting data with the key.
CanDecryptUsingSecKeyAlgorithm(algorithm corefoundation.CFStringRef) bool
// Checks whether the algorithm you supply is valid for performing key exchanges.
CanExchangeKeysUsingSecKeyAlgorithm(algorithm corefoundation.CFStringRef) bool
// Checks whether the algorithm you supply is valid for signing data with the key.
CanSignUsingSecKeyAlgorithm(algorithm corefoundation.CFStringRef) bool
// Decrypts the data you supply with a given algorithm.
DecryptDataSecKeyAlgorithmCompletion(data foundation.NSData, algorithm corefoundation.CFStringRef, handler DataErrorHandler)
// Performs a Diffie-Hellman style key exchange operation.
ExchangeKeysWithPublicKeySecKeyAlgorithmSecKeyParametersCompletion(publicKey foundation.NSData, algorithm corefoundation.CFStringRef, parameters foundation.INSDictionary, handler DataErrorHandler)
// Generates a digital signature for the data you supply.
SignDataSecKeyAlgorithmCompletion(data foundation.NSData, algorithm corefoundation.CFStringRef, handler DataErrorHandler)
}
An interface definition for the LAPrivateKey class.
Accessing the associated public key ¶
- [ILAPrivateKey.PublicKey]: The public key that corresponds with the private key in a key pair.
Checking algorithm support ¶
- [ILAPrivateKey.CanDecryptUsingSecKeyAlgorithm]: Checks whether the algorithm you supply is valid for decrypting data with the key.
- [ILAPrivateKey.CanExchangeKeysUsingSecKeyAlgorithm]: Checks whether the algorithm you supply is valid for performing key exchanges.
- [ILAPrivateKey.CanSignUsingSecKeyAlgorithm]: Checks whether the algorithm you supply is valid for signing data with the key.
Performing cryptographic operations ¶
- [ILAPrivateKey.DecryptDataSecKeyAlgorithmCompletion]: Decrypts the data you supply with a given algorithm.
- [ILAPrivateKey.ExchangeKeysWithPublicKeySecKeyAlgorithmSecKeyParametersCompletion]: Performs a Diffie-Hellman style key exchange operation.
- [ILAPrivateKey.SignDataSecKeyAlgorithmCompletion]: Generates a digital signature for the data you supply.
See: https://developer.apple.com/documentation/LocalAuthentication/LAPrivateKey
type ILAPublicKey ¶
type ILAPublicKey interface {
objectivec.IObject
// Checks whether the algorithm you supply is valid for encrypting data with the key.
CanEncryptUsingSecKeyAlgorithm(algorithm corefoundation.CFStringRef) bool
// Checks whether the algorithm you supply is valid for verifying signatures with the key.
CanVerifyUsingSecKeyAlgorithm(algorithm corefoundation.CFStringRef) bool
// Encrypts the data you supply with a given algorithm.
EncryptDataSecKeyAlgorithmCompletion(data foundation.NSData, algorithm corefoundation.CFStringRef, handler DataErrorHandler)
// Exports the data that represents a public key.
ExportBytesWithCompletion(handler DataErrorHandler)
// Verifies a digital signature for the data you supply.
VerifyDataSignatureSecKeyAlgorithmCompletion(signedData foundation.NSData, signature foundation.NSData, algorithm corefoundation.CFStringRef, handler ErrorHandler)
}
An interface definition for the LAPublicKey class.
Checking algorithm support ¶
- [ILAPublicKey.CanEncryptUsingSecKeyAlgorithm]: Checks whether the algorithm you supply is valid for encrypting data with the key.
- [ILAPublicKey.CanVerifyUsingSecKeyAlgorithm]: Checks whether the algorithm you supply is valid for verifying signatures with the key.
Performing cryptographic operations ¶
- [ILAPublicKey.EncryptDataSecKeyAlgorithmCompletion]: Encrypts the data you supply with a given algorithm.
- [ILAPublicKey.ExportBytesWithCompletion]: Exports the data that represents a public key.
- [ILAPublicKey.VerifyDataSignatureSecKeyAlgorithmCompletion]: Verifies a digital signature for the data you supply.
See: https://developer.apple.com/documentation/LocalAuthentication/LAPublicKey
type ILARight ¶
type ILARight interface {
objectivec.IObject
// Creates a right with the authentication requirements you supply.
InitWithRequirement(requirement ILAAuthenticationRequirement) LARight
// An integer you use to identify a right.
Tag() int
SetTag(value int)
// Performs an authorization on the right.
AuthorizeWithLocalizedReasonCompletion(localizedReason string, handler ErrorHandler)
// Performs an authorization on the right with a window context you supply.
AuthorizeWithLocalizedReasonInPresentationContextCompletion(localizedReason string, presentationContext unsafe.Pointer, handler ErrorHandler)
DeauthorizeWithCompletion(handler VoidHandler)
// Checks whether the right has permission to perform authorization.
CheckCanAuthorizeWithCompletion(handler ErrorHandler)
// The current authorization state for a right.
State() LARightState
}
An interface definition for the LARight class.
Authorizing a right ¶
- [ILARight.InitWithRequirement]: Creates a right with the authentication requirements you supply.
- [ILARight.Tag]: An integer you use to identify a right.
- [ILARight.SetTag]
- [ILARight.AuthorizeWithLocalizedReasonCompletion]: Performs an authorization on the right.
- [ILARight.AuthorizeWithLocalizedReasonInPresentationContextCompletion]: Performs an authorization on the right with a window context you supply.
Deauthorizing a right ¶
- [ILARight.DeauthorizeWithCompletion]: Invalidates a previously authorized right.
Monitoring authorization status ¶
- [ILARight.CheckCanAuthorizeWithCompletion]: Checks whether the right has permission to perform authorization.
- [ILARight.State]: The current authorization state for a right.
See: https://developer.apple.com/documentation/LocalAuthentication/LARight
type ILARightStore ¶
type ILARightStore interface {
objectivec.IObject
// Fetches a previously stored right from the shared right store.
RightForIdentifierCompletion(identifier string, handler LAPersistedRightErrorHandler)
// Saves a right to a persistent right store.
SaveRightIdentifierCompletion(right ILARight, identifier string, handler LAPersistedRightErrorHandler)
// Saves a right to a persistent store along with secret data you supply.
SaveRightIdentifierSecretCompletion(right ILARight, identifier string, secret foundation.NSData, handler LAPersistedRightErrorHandler)
// Removes a right from the right store given an instance of that right.
RemoveRightCompletion(right ILAPersistedRight, handler ErrorHandler)
// Removes a right from the right store given its unique identifier.
RemoveRightForIdentifierCompletion(identifier string, handler ErrorHandler)
// Removes all rights associated with this client from the right store.
RemoveAllRightsWithCompletion(handler ErrorHandler)
}
An interface definition for the LARightStore class.
Accessing rights ¶
- [ILARightStore.RightForIdentifierCompletion]: Fetches a previously stored right from the shared right store.
Storing rights ¶
- [ILARightStore.SaveRightIdentifierCompletion]: Saves a right to a persistent right store.
- [ILARightStore.SaveRightIdentifierSecretCompletion]: Saves a right to a persistent store along with secret data you supply.
Removing stored rights ¶
- [ILARightStore.RemoveRightCompletion]: Removes a right from the right store given an instance of that right.
- [ILARightStore.RemoveRightForIdentifierCompletion]: Removes a right from the right store given its unique identifier.
- [ILARightStore.RemoveAllRightsWithCompletion]: Removes all rights associated with this client from the right store.
See: https://developer.apple.com/documentation/LocalAuthentication/LARightStore
type ILASecret ¶
type ILASecret interface {
objectivec.IObject
// Retrieves data stored in a secret.
LoadDataWithCompletion(handler DataErrorHandler)
}
An interface definition for the LASecret class.
Loading secret data ¶
- [ILASecret.LoadDataWithCompletion]: Retrieves data stored in a secret.
See: https://developer.apple.com/documentation/LocalAuthentication/LASecret
type LAAccessControlOperation ¶
type LAAccessControlOperation int
See: https://developer.apple.com/documentation/LocalAuthentication/LAAccessControlOperation
const ( // LAAccessControlOperationCreateItem: Specifies that access control is used for item creation. LAAccessControlOperationCreateItem LAAccessControlOperation = 0 // LAAccessControlOperationCreateKey: Specifies that access control is used for key creation. LAAccessControlOperationCreateKey LAAccessControlOperation = 2 // LAAccessControlOperationUseItem: Specifies that access control is used for accessing an existing item. LAAccessControlOperationUseItem LAAccessControlOperation = 1 // LAAccessControlOperationUseKeyDecrypt: Specifies that access control is used for data decryption using existing key. LAAccessControlOperationUseKeyDecrypt LAAccessControlOperation = 4 // LAAccessControlOperationUseKeyKeyExchange: Specifies that access control is used for key exchange. LAAccessControlOperationUseKeyKeyExchange LAAccessControlOperation = 5 // LAAccessControlOperationUseKeySign: Specifies that access control is used for accessing an existing key. LAAccessControlOperationUseKeySign LAAccessControlOperation = 3 )
func (LAAccessControlOperation) String ¶
func (e LAAccessControlOperation) String() string
type LAAuthenticationRequirement ¶
type LAAuthenticationRequirement struct {
objectivec.Object
}
A set of requirements that protect a right.
See: https://developer.apple.com/documentation/LocalAuthentication/LAAuthenticationRequirement
func LAAuthenticationRequirementFromID ¶
func LAAuthenticationRequirementFromID(id objc.ID) LAAuthenticationRequirement
LAAuthenticationRequirementFromID constructs a LAAuthenticationRequirement from an objc.ID.
A set of requirements that protect a right.
func NewLAAuthenticationRequirement ¶
func NewLAAuthenticationRequirement() LAAuthenticationRequirement
NewLAAuthenticationRequirement creates a new LAAuthenticationRequirement instance.
func (LAAuthenticationRequirement) Autorelease ¶
func (a LAAuthenticationRequirement) Autorelease() LAAuthenticationRequirement
Autorelease adds the receiver to the current autorelease pool.
func (LAAuthenticationRequirement) Init ¶
func (a LAAuthenticationRequirement) Init() LAAuthenticationRequirement
Init initializes the instance.
type LAAuthenticationRequirementClass ¶
type LAAuthenticationRequirementClass struct {
// contains filtered or unexported fields
}
func GetLAAuthenticationRequirementClass ¶
func GetLAAuthenticationRequirementClass() LAAuthenticationRequirementClass
GetLAAuthenticationRequirementClass returns the class object for LAAuthenticationRequirement.
func (LAAuthenticationRequirementClass) Alloc ¶
func (lc LAAuthenticationRequirementClass) Alloc() LAAuthenticationRequirement
Alloc allocates memory for a new instance of the class.
func (LAAuthenticationRequirementClass) BiometryCurrentSetRequirement ¶
func (_LAAuthenticationRequirementClass LAAuthenticationRequirementClass) BiometryCurrentSetRequirement() LAAuthenticationRequirement
The requirement that requires user authentication with the current set of biometrics.
Discussion ¶
Authorizations with this requirement fail when:
- Biometrics aren’t available on the current device. - There aren’t any enrolled biometrics on the current device. - There’s a change in enrolled biometrics on the current device. For example, adding a new finger to Touch ID changes the set of enrolled biometrics.
func (LAAuthenticationRequirementClass) BiometryRequirement ¶
func (_LAAuthenticationRequirementClass LAAuthenticationRequirementClass) BiometryRequirement() LAAuthenticationRequirement
The requirement that requires biometric authentication.
Discussion ¶
Authorizations with this requirement fail when biometrics aren’t available on the current device or there aren’t any enrolled biometrics on the current device.
See: https://developer.apple.com/documentation/LocalAuthentication/LAAuthenticationRequirement/biometry
func (LAAuthenticationRequirementClass) BiometryRequirementWithFallback ¶
func (_LAAuthenticationRequirementClass LAAuthenticationRequirementClass) BiometryRequirementWithFallback(fallback ILABiometryFallbackRequirement) LAAuthenticationRequirement
Creates a requirement that requires biometric authentication or a fallback requirement that you specify.
fallback: A requirement to use a fallback if biometric authentication fails or is unavailable, or if the user prefers not to use biometric authentication.
Return Value ¶
Returns a requirement that requires biometric authentication or a fallback requirement that you specify.
func (LAAuthenticationRequirementClass) Class ¶
func (lc LAAuthenticationRequirementClass) Class() objc.Class
Class returns the underlying Objective-C class pointer.
func (LAAuthenticationRequirementClass) DefaultRequirement ¶
func (_LAAuthenticationRequirementClass LAAuthenticationRequirementClass) DefaultRequirement() LAAuthenticationRequirement
The requirement that requires user authentication.
See: https://developer.apple.com/documentation/LocalAuthentication/LAAuthenticationRequirement/default
type LABiometryFallbackRequirement ¶
type LABiometryFallbackRequirement struct {
objectivec.Object
}
A set of requirements to fall back on if biometrics aren’t present.
See: https://developer.apple.com/documentation/LocalAuthentication/LABiometryFallbackRequirement
func LABiometryFallbackRequirementFromID ¶
func LABiometryFallbackRequirementFromID(id objc.ID) LABiometryFallbackRequirement
LABiometryFallbackRequirementFromID constructs a LABiometryFallbackRequirement from an objc.ID.
A set of requirements to fall back on if biometrics aren’t present.
func NewLABiometryFallbackRequirement ¶
func NewLABiometryFallbackRequirement() LABiometryFallbackRequirement
NewLABiometryFallbackRequirement creates a new LABiometryFallbackRequirement instance.
func (LABiometryFallbackRequirement) Autorelease ¶
func (b LABiometryFallbackRequirement) Autorelease() LABiometryFallbackRequirement
Autorelease adds the receiver to the current autorelease pool.
func (LABiometryFallbackRequirement) Init ¶
func (b LABiometryFallbackRequirement) Init() LABiometryFallbackRequirement
Init initializes the instance.
type LABiometryFallbackRequirementClass ¶
type LABiometryFallbackRequirementClass struct {
// contains filtered or unexported fields
}
func GetLABiometryFallbackRequirementClass ¶
func GetLABiometryFallbackRequirementClass() LABiometryFallbackRequirementClass
GetLABiometryFallbackRequirementClass returns the class object for LABiometryFallbackRequirement.
func (LABiometryFallbackRequirementClass) Alloc ¶
func (lc LABiometryFallbackRequirementClass) Alloc() LABiometryFallbackRequirement
Alloc allocates memory for a new instance of the class.
func (LABiometryFallbackRequirementClass) Class ¶
func (lc LABiometryFallbackRequirementClass) Class() objc.Class
Class returns the underlying Objective-C class pointer.
func (LABiometryFallbackRequirementClass) DefaultRequirement ¶
func (_LABiometryFallbackRequirementClass LABiometryFallbackRequirementClass) DefaultRequirement() LABiometryFallbackRequirement
The default biometric fallback requirement.
See: https://developer.apple.com/documentation/LocalAuthentication/LABiometryFallbackRequirement/default
func (LABiometryFallbackRequirementClass) DevicePasscodeRequirement ¶
func (_LABiometryFallbackRequirementClass LABiometryFallbackRequirementClass) DevicePasscodeRequirement() LABiometryFallbackRequirement
The fallback requirement that requires entering the device passcode.
type LABiometryType ¶
type LABiometryType int
See: https://developer.apple.com/documentation/LocalAuthentication/LABiometryType
const ( // LABiometryTypeFaceID: The device supports Face ID. LABiometryTypeFaceID LABiometryType = 2 // LABiometryTypeNone: No biometry type is supported. LABiometryTypeNone LABiometryType = 0 // LABiometryTypeOpticID: The device supports Optic ID. LABiometryTypeOpticID LABiometryType = 4 // LABiometryTypeTouchID: The device supports Touch ID. LABiometryTypeTouchID LABiometryType = 1 // Deprecated: use LABiometryTypeNone. LABiometryNone LABiometryType = 0 )
func (LABiometryType) String ¶
func (e LABiometryType) String() string
type LACompanionType ¶
type LACompanionType int
See: https://developer.apple.com/documentation/LocalAuthentication/LACompanionType
const ( // LACompanionTypeMac: Paired Mac LACompanionTypeMac LACompanionType = 2 // LACompanionTypeVision: Paired Vision Pro LACompanionTypeVision LACompanionType = 4 // LACompanionTypeWatch: Paired Apple Watch LACompanionTypeWatch LACompanionType = 1 )
func (LACompanionType) String ¶
func (e LACompanionType) String() string
type LAContext ¶
type LAContext struct {
objectivec.Object
}
A mechanism for evaluating authentication policies and access controls.
Overview ¶
You use an authentication context to evaluate the user’s identity, either with biometrics like Touch ID or Face ID, or by supplying the device passcode. The context handles user interaction, and also interfaces to the Secure Enclave, the underlying hardware element that manages biometric data. You create and configure the context, and ask it to carry out the authentication. You then receive an asynchronous callback, which provides an indication of authentication success or failure, and an error instance that explains the reason for a failure, if any.
Checking availability ¶
- LAContext.CanEvaluatePolicyError: Assesses whether authentication can proceed for a given policy.
- LAContext.BiometryType: The type of biometric authentication supported by the device.
Evaluating authentication policies ¶
- LAContext.EvaluatePolicyLocalizedReasonReply: Evaluates the specified policy.
- LAContext.EvaluatedPolicyDomainState: The current state of the evaluated policy domain.
Evaluating access controls ¶
- LAContext.EvaluateAccessControlOperationLocalizedReasonReply: Evaluates an access control for a given operation.
- LAContext.InteractionNotAllowed: A Boolean value indicating whether authentication can be interactive.
- LAContext.SetInteractionNotAllowed
Customizing authentication prompts ¶
- LAContext.LocalizedReason: The localized explanation for authentication shown in the dialog presented to the user.
- LAContext.SetLocalizedReason
- LAContext.LocalizedFallbackTitle: The localized title for the fallback button in the dialog presented to the user during authentication.
- LAContext.SetLocalizedFallbackTitle
- LAContext.LocalizedCancelTitle: The localized title for the cancel button in the dialog presented to the user during authentication.
- LAContext.SetLocalizedCancelTitle
Reusing device unlock state ¶
- LAContext.TouchIDAuthenticationAllowableReuseDuration: The duration for which Touch ID authentication reuse is allowable.
- LAContext.SetTouchIDAuthenticationAllowableReuseDuration
Managing credentials ¶
- LAContext.SetCredentialType: Sets an application-provided credential to be used when evaluating authentication.
- LAContext.IsCredentialSet: Returns a Boolean value indicating whether the specified credential type is set.
Invalidating the authentication context ¶
- LAContext.Invalidate: Invalidates the authentication context.
Instance Properties ¶
- LAContext.DomainState: Contains authentication domain state.
See: https://developer.apple.com/documentation/LocalAuthentication/LAContext
func LAContextFromID ¶
LAContextFromID constructs a LAContext from an objc.ID.
A mechanism for evaluating authentication policies and access controls.
func (LAContext) Autorelease ¶
Autorelease adds the receiver to the current autorelease pool.
func (LAContext) BiometryType ¶
func (c LAContext) BiometryType() LABiometryType
The type of biometric authentication supported by the device.
Discussion ¶
Use the value of this property to ensure that any authentication-related user prompts you create match the biometric capabilities of the device. For example, if the value of this property is LABiometryTypeFaceID, don’t refer to Touch ID in an authentication prompt.
This property is set only after you call the LAContext.CanEvaluatePolicyError method, and is set no matter what the call returns. The default value is LABiometryTypeNone.
See: https://developer.apple.com/documentation/LocalAuthentication/LAContext/biometryType
func (LAContext) CanEvaluatePolicyError ¶
Assesses whether authentication can proceed for a given policy.
policy: The policy to evaluate. For possible values, see LAPolicy.
error: If the method fails, it uses this parameter to return an error detailing what went wrong. See LAError.Code for possible error codes.
Specify `nil` for this parameter to ignore any errors.
Return Value ¶
true if the policy can be evaluated, otherwise false.
Discussion ¶
Some policies impose requirements that must be met before authentication can proceed. For example, a policy that requires biometrics can’t authenticate if Touch ID or Face ID is disabled. This method tests all the prerequisites for a given policy.
Don’t store the return value from this method because it might change as a result of changes in the system. For example, a user might disable Touch ID after you call this method.
See: https://developer.apple.com/documentation/LocalAuthentication/LAContext/canEvaluatePolicy(_:error:)
func (LAContext) DomainState ¶
func (c LAContext) DomainState() ILADomainState
Contains authentication domain state.
See: https://developer.apple.com/documentation/LocalAuthentication/LAContext/domainState
func (LAContext) EvaluateAccessControlOperationLocalizedReasonReply ¶
func (c LAContext) EvaluateAccessControlOperationLocalizedReasonReply(accessControl security.SecAccessControlRef, operation LAAccessControlOperation, localizedReason string, reply BoolErrorHandler)
Evaluates an access control for a given operation.
accessControl: The access control to be evaluated.
operation: The operation for the access control to be evaluated. For possible values, see LAAccessControlOperation.
localizedReason: The app-provided reason for requesting authentication, which displays in the authentication dialog presented to the user.
reply: A block that is executed when access control evaluation finishes. This block is evaluated on a private queue internal to the framework in an unspecified threading context.
success: `true` if policy evaluation succeeded, otherwise `false`. error: `nil` if policy evaluation succeeded, an error object that should be presented to the user otherwise. See LAError.Code for possible error codes
Discussion ¶
This method asynchronously evaluates an access control. Evaluating an access control may involve prompting the user for various kinds of interaction or authentication. The actual behavior is dependent on the access control and device type. It can also be affected by installed configuration profiles.
The localized string you present to the user should provide a clear reason for why you are requesting they authenticate themselves, and what action you will be taking based on that authentication. This string should be provided in the user’s current language and should be short and clear. It should not contain the app name, because that appears elsewhere in the authentication dialog. In macOS this appears in the dialog title, and in iOS this appears in the dialog subtitle.
You should not assume that a previous successful evaluation of an access control necessarily leads to a subsequent successful evaluation. Access control evaluation can fail for various reasons, including cancelation by the user or the system.
func (LAContext) EvaluateAccessControlOperationLocalizedReasonReplySync ¶
func (c LAContext) EvaluateAccessControlOperationLocalizedReasonReplySync(ctx context.Context, accessControl security.SecAccessControlRef, operation LAAccessControlOperation, localizedReason string) (bool, error)
EvaluateAccessControlOperationLocalizedReasonReplySync is a synchronous wrapper around LAContext.EvaluateAccessControlOperationLocalizedReasonReply. It blocks until the completion handler fires or the context is cancelled.
func (LAContext) EvaluatePolicyLocalizedReasonReply ¶
func (c LAContext) EvaluatePolicyLocalizedReasonReply(policy LAPolicy, localizedReason string, reply BoolErrorHandler)
Evaluates the specified policy.
policy: The policy to evaluate. For possible values, see LAPolicy.
localizedReason: The app-provided reason for requesting authentication, which displays in the authentication dialog presented to the user.
reply: A closure that is executed when policy evaluation finishes. This is evaluated on a private queue internal to the framework in an unspecified threading context. You must not call LAContext.CanEvaluatePolicyError in this block, because doing so could lead to deadlock.
success: true if policy evaluation succeeded, otherwise false. error: `nil` if policy evaluation succeeded, an error object that should be presented to the user otherwise. See LAError.Code for possible error codes
Discussion ¶
This method asynchronously evaluates an authentication policy. Evaluating a policy may involve prompting the user for various kinds of interaction or authentication. The actual behavior is dependent on the evaluated policy and the device type. The behavior can also be affected by installed configuration profiles.
In the localized string you present to the user in the authentication dialog, provide a clear reason for the authentication request, and describe the resulting action. Make the message short and clear, and provide it in the user’s language. Don’t include the app name, which already appears in the authentication dialog (in macOS, in the title of the dialog; in iOS, in the subtitle).
Don’t assume that a previous successful policy evaluation means that future evaluations will also succeed. Policy evaluation can fail for various reasons, including cancellation by the user or the system.
func (LAContext) EvaluatePolicyLocalizedReasonReplySync ¶
func (c LAContext) EvaluatePolicyLocalizedReasonReplySync(ctx context.Context, policy LAPolicy, localizedReason string) (bool, error)
EvaluatePolicyLocalizedReasonReplySync is a synchronous wrapper around LAContext.EvaluatePolicyLocalizedReasonReply. It blocks until the completion handler fires or the context is cancelled.
func (LAContext) EvaluatedPolicyDomainState ¶
func (c LAContext) EvaluatedPolicyDomainState() foundation.NSData
The current state of the evaluated policy domain.
Discussion ¶
The value of this property is non-`nil` when the LAContext.CanEvaluatePolicyError method succeeds for a biometric policy or the person successfully authenticates using biometrics, following a call to LAContext.EvaluatePolicyLocalizedReasonReply. Otherwise, its value is `nil`.
Compare the values you get from successive calls to this property to determine whether the authorized database changed. However, the value you get doesn’t describe the nature of a change; it only lets you detect if a change happens.
See: https://developer.apple.com/documentation/LocalAuthentication/LAContext/evaluatedPolicyDomainState
func (LAContext) InteractionNotAllowed ¶
A Boolean value indicating whether authentication can be interactive.
See: https://developer.apple.com/documentation/LocalAuthentication/LAContext/interactionNotAllowed
func (LAContext) Invalidate ¶
func (c LAContext) Invalidate()
Invalidates the authentication context.
Discussion ¶
Calling this method stops any pending policy evaluations, causing them to fail with the LAErrorAppCancel error code. Once an authentication context has been invalidated, it cannot be used for policy evaluation. Invalidating a context that has been already invalidated has no effect.
See: https://developer.apple.com/documentation/LocalAuthentication/LAContext/invalidate()
func (LAContext) IsCredentialSet ¶
func (c LAContext) IsCredentialSet(type_ LACredentialType) bool
Returns a Boolean value indicating whether the specified credential type is set.
type: The type of the credential. For possible values, see LACredentialType
Return Value ¶
true if the credential is set, otherwise false.
See: https://developer.apple.com/documentation/LocalAuthentication/LAContext/isCredentialSet(_:)
func (LAContext) LocalizedCancelTitle ¶
The localized title for the cancel button in the dialog presented to the user during authentication.
Discussion ¶
The system presents a cancel button during biometric authentication to let the user abort the authentication attempt. The button appears every time the system asks the user to present a finger registered with Touch ID. For Face ID, the button only appears if authentication fails and the user is prompted to try again. Either way, the user can stop trying to authenticate by tapping the button.
Use the LAContext.LocalizedCancelTitle property to choose a title for the cancel button. If you set the property to `nil`—as it is by default—or assign an empty string, the system uses an appropriate default title, like “Cancel”. Otherwise, provide a localized string that’s short and clear.
See: https://developer.apple.com/documentation/LocalAuthentication/LAContext/localizedCancelTitle
func (LAContext) LocalizedFallbackTitle ¶
The localized title for the fallback button in the dialog presented to the user during authentication.
Discussion ¶
The system presents a fallback button when biometric authentication fails—for example, because the system doesn’t recognize the presented finger, or after several failed attempts to recognize the user’s face. Tapping the button lets the user revert to authentication using the device passcode or password instead.
Use the LAContext.LocalizedFallbackTitle property to set a title for the fallback button. When the property is `nil`—as it is by default—the user sees an appropriate default title, like “Use Passcode”. Otherwise, provide a localized string that’s short and clear.
To eliminate the fallback option, set the fallback title to an empty string. This hides the button from the interface.
See: https://developer.apple.com/documentation/LocalAuthentication/LAContext/localizedFallbackTitle
func (LAContext) LocalizedReason ¶
The localized explanation for authentication shown in the dialog presented to the user.
Discussion ¶
This property is overwritten if an authentication reason is provided in LAContext.EvaluatePolicyLocalizedReasonReply.
The localized string you present to the user should provide a clear reason for why you are requesting they authenticate themselves, and what action you will be taking based on that authentication. This string should be provided in the user’s current language and should be short and clear. It should not contain the app name, because that appears elsewhere in the authentication dialog. In macOS this appears in the dialog title, and in iOS this appears in the dialog subtitle.
See: https://developer.apple.com/documentation/LocalAuthentication/LAContext/localizedReason
func (LAContext) SetCredentialType ¶
func (c LAContext) SetCredentialType(credential foundation.NSData, type_ LACredentialType) bool
Sets an application-provided credential to be used when evaluating authentication.
credential: The credential to be used when evaluating the authentication context.
Setting this parameter to `nil` removes any existing credential of the specified type.
type: The type of the specified credential. For possible values, see LACredentialType.
Return Value ¶
true if the credential was set, otherwise false.
See: https://developer.apple.com/documentation/LocalAuthentication/LAContext/setCredential(_:type:)
func (LAContext) SetInteractionNotAllowed ¶
func (LAContext) SetLocalizedCancelTitle ¶
func (LAContext) SetLocalizedFallbackTitle ¶
func (LAContext) SetLocalizedReason ¶
func (LAContext) SetTouchIDAuthenticationAllowableReuseDuration ¶
func (c LAContext) SetTouchIDAuthenticationAllowableReuseDuration(value foundation.NSTimeInterval)
func (LAContext) TouchIDAuthenticationAllowableReuseDuration ¶
func (c LAContext) TouchIDAuthenticationAllowableReuseDuration() foundation.NSTimeInterval
The duration for which Touch ID authentication reuse is allowable.
Discussion ¶
If the user unlocks the device using Touch ID within the specified time interval, then authentication for the receiver succeeds automatically, without prompting the user for Touch ID. This bypasses a scenario where the user unlocks the device and then is almost immediately prompted for another fingerprint.
The default value is `0`, meaning that Touch ID authentication isn’t reused.
The maximum allowable duration for Touch ID authentication reuse is specified by the LATouchIDAuthenticationMaximumAllowableReuseDuration constant. You cannot specify a longer duration by setting this property to a value greater than this constant.
type LAContextClass ¶
type LAContextClass struct {
// contains filtered or unexported fields
}
func GetLAContextClass ¶
func GetLAContextClass() LAContextClass
GetLAContextClass returns the class object for LAContext.
func (LAContextClass) Alloc ¶
func (lc LAContextClass) Alloc() LAContext
Alloc allocates memory for a new instance of the class.
func (LAContextClass) Class ¶
func (lc LAContextClass) Class() objc.Class
Class returns the underlying Objective-C class pointer.
type LACredentialType ¶
type LACredentialType int
See: https://developer.apple.com/documentation/LocalAuthentication/LACredentialType
const ( // LACredentialTypeApplicationPassword: Specifies that a password is provided by the application. LACredentialTypeApplicationPassword LACredentialType = 0 LACredentialTypeSmartCardPIN LACredentialType = -3 )
func (LACredentialType) String ¶
func (e LACredentialType) String() string
type LADomainState ¶
type LADomainState struct {
objectivec.Object
}
Instance Properties ¶
- LADomainState.Biometry: Contains biometric domain state.
- LADomainState.Companion: Contains companion domain state.
- LADomainState.StateHash: Contains combined state hash data for biometry and companion state hashes.
See: https://developer.apple.com/documentation/LocalAuthentication/LADomainState
func LADomainStateFromID ¶
func LADomainStateFromID(id objc.ID) LADomainState
LADomainStateFromID constructs a LADomainState from an objc.ID.
func NewLADomainState ¶
func NewLADomainState() LADomainState
NewLADomainState creates a new LADomainState instance.
func (LADomainState) Autorelease ¶
func (d LADomainState) Autorelease() LADomainState
Autorelease adds the receiver to the current autorelease pool.
func (LADomainState) Biometry ¶
func (d LADomainState) Biometry() ILADomainStateBiometry
Contains biometric domain state.
See: https://developer.apple.com/documentation/LocalAuthentication/LADomainState/biometry
func (LADomainState) Companion ¶
func (d LADomainState) Companion() ILADomainStateCompanion
Contains companion domain state.
See: https://developer.apple.com/documentation/LocalAuthentication/LADomainState/companion
func (LADomainState) Init ¶
func (d LADomainState) Init() LADomainState
Init initializes the instance.
func (LADomainState) StateHash ¶
func (d LADomainState) StateHash() foundation.NSData
Contains combined state hash data for biometry and companion state hashes.
Discussion ¶
See: https://developer.apple.com/documentation/LocalAuthentication/LADomainState/stateHash
type LADomainStateBiometry ¶
type LADomainStateBiometry struct {
objectivec.Object
}
Instance Properties ¶
- LADomainStateBiometry.BiometryType: Indicates biometry type available on the device.
- LADomainStateBiometry.StateHash: Contains state hash data for the available biometry type. Returns `nil` if no biometry entities are enrolled.
See: https://developer.apple.com/documentation/LocalAuthentication/LADomainStateBiometry
func LADomainStateBiometryFromID ¶
func LADomainStateBiometryFromID(id objc.ID) LADomainStateBiometry
LADomainStateBiometryFromID constructs a LADomainStateBiometry from an objc.ID.
func NewLADomainStateBiometry ¶
func NewLADomainStateBiometry() LADomainStateBiometry
NewLADomainStateBiometry creates a new LADomainStateBiometry instance.
func (LADomainStateBiometry) Autorelease ¶
func (d LADomainStateBiometry) Autorelease() LADomainStateBiometry
Autorelease adds the receiver to the current autorelease pool.
func (LADomainStateBiometry) BiometryType ¶
func (d LADomainStateBiometry) BiometryType() LABiometryType
Indicates biometry type available on the device.
See: https://developer.apple.com/documentation/LocalAuthentication/LADomainStateBiometry/biometryType
func (LADomainStateBiometry) Init ¶
func (d LADomainStateBiometry) Init() LADomainStateBiometry
Init initializes the instance.
func (LADomainStateBiometry) StateHash ¶
func (d LADomainStateBiometry) StateHash() foundation.NSData
Contains state hash data for the available biometry type. Returns `nil` if no biometry entities are enrolled.
Discussion ¶
If biometric database was modified (fingers, faces were removed or added), `stateHash` data will change. Nature of such database changes cannot be determined but comparing data of `stateHash` after different evaluatePolicy calls will reveal the fact database was changed between the calls.
See: https://developer.apple.com/documentation/LocalAuthentication/LADomainStateBiometry/stateHash
type LADomainStateBiometryClass ¶
type LADomainStateBiometryClass struct {
// contains filtered or unexported fields
}
func GetLADomainStateBiometryClass ¶
func GetLADomainStateBiometryClass() LADomainStateBiometryClass
GetLADomainStateBiometryClass returns the class object for LADomainStateBiometry.
func (LADomainStateBiometryClass) Alloc ¶
func (lc LADomainStateBiometryClass) Alloc() LADomainStateBiometry
Alloc allocates memory for a new instance of the class.
func (LADomainStateBiometryClass) Class ¶
func (lc LADomainStateBiometryClass) Class() objc.Class
Class returns the underlying Objective-C class pointer.
type LADomainStateClass ¶
type LADomainStateClass struct {
// contains filtered or unexported fields
}
func GetLADomainStateClass ¶
func GetLADomainStateClass() LADomainStateClass
GetLADomainStateClass returns the class object for LADomainState.
func (LADomainStateClass) Alloc ¶
func (lc LADomainStateClass) Alloc() LADomainState
Alloc allocates memory for a new instance of the class.
func (LADomainStateClass) Class ¶
func (lc LADomainStateClass) Class() objc.Class
Class returns the underlying Objective-C class pointer.
type LADomainStateCompanion ¶
type LADomainStateCompanion struct {
objectivec.Object
}
Instance Properties ¶
- LADomainStateCompanion.AvailableCompanionTypes: Indicates types of companions paired with the device. The elements are NSNumber-wrapped instances of @c LACompanionType.
- LADomainStateCompanion.StateHash: Contains combined state hash data for all available companion types. . Returns `nil` if no companion devices are paired.
Instance Methods ¶
- LADomainStateCompanion.StateHashForCompanionType: Returns state hash data for the given companion type.
See: https://developer.apple.com/documentation/LocalAuthentication/LADomainStateCompanion
func LADomainStateCompanionFromID ¶
func LADomainStateCompanionFromID(id objc.ID) LADomainStateCompanion
LADomainStateCompanionFromID constructs a LADomainStateCompanion from an objc.ID.
func NewLADomainStateCompanion ¶
func NewLADomainStateCompanion() LADomainStateCompanion
NewLADomainStateCompanion creates a new LADomainStateCompanion instance.
func (LADomainStateCompanion) Autorelease ¶
func (d LADomainStateCompanion) Autorelease() LADomainStateCompanion
Autorelease adds the receiver to the current autorelease pool.
func (LADomainStateCompanion) AvailableCompanionTypes ¶
func (d LADomainStateCompanion) AvailableCompanionTypes() foundation.INSSet
Indicates types of companions paired with the device. The elements are NSNumber-wrapped instances of @c LACompanionType.
func (LADomainStateCompanion) Init ¶
func (d LADomainStateCompanion) Init() LADomainStateCompanion
Init initializes the instance.
func (LADomainStateCompanion) StateHash ¶
func (d LADomainStateCompanion) StateHash() foundation.NSData
Contains combined state hash data for all available companion types. . Returns `nil` if no companion devices are paired.
Discussion ¶
As long as database of paired companion devices doesn’t change, `stateHash` stays the same for the same set of `availableCompanions`.
See: https://developer.apple.com/documentation/LocalAuthentication/LADomainStateCompanion/stateHash
func (LADomainStateCompanion) StateHashForCompanionType ¶
func (d LADomainStateCompanion) StateHashForCompanionType(companionType LACompanionType) foundation.NSData
Returns state hash data for the given companion type.
companionType: The companion type for which state hash data should be returned.
Discussion ¶
If database of paired devices of the given type was modified state hash data will change. Nature of such database changes cannot be determined but comparing data of state hash after different policy evaluation will reveal the fact database was changed between calls.
See: https://developer.apple.com/documentation/LocalAuthentication/LADomainStateCompanion/stateHash(for:)
type LADomainStateCompanionClass ¶
type LADomainStateCompanionClass struct {
// contains filtered or unexported fields
}
func GetLADomainStateCompanionClass ¶
func GetLADomainStateCompanionClass() LADomainStateCompanionClass
GetLADomainStateCompanionClass returns the class object for LADomainStateCompanion.
func (LADomainStateCompanionClass) Alloc ¶
func (lc LADomainStateCompanionClass) Alloc() LADomainStateCompanion
Alloc allocates memory for a new instance of the class.
func (LADomainStateCompanionClass) Class ¶
func (lc LADomainStateCompanionClass) Class() objc.Class
Class returns the underlying Objective-C class pointer.
type LAEnvironment ¶
type LAEnvironment struct {
objectivec.Object
}
Instance Properties ¶
- LAEnvironment.State: The environment state information.
Instance Methods ¶
See: https://developer.apple.com/documentation/LocalAuthentication/LAEnvironment
func LAEnvironmentFromID ¶
func LAEnvironmentFromID(id objc.ID) LAEnvironment
LAEnvironmentFromID constructs a LAEnvironment from an objc.ID.
func NewLAEnvironment ¶
func NewLAEnvironment() LAEnvironment
NewLAEnvironment creates a new LAEnvironment instance.
func (LAEnvironment) AddObserver ¶
func (e LAEnvironment) AddObserver(observer LAEnvironmentObserver)
Discussion ¶
Adds observer to monitor changes of the environment.
The observer will be held weakly so its instance should be kept alive by the caller.
See: https://developer.apple.com/documentation/LocalAuthentication/LAEnvironment/addObserver(_:)
func (LAEnvironment) Autorelease ¶
func (e LAEnvironment) Autorelease() LAEnvironment
Autorelease adds the receiver to the current autorelease pool.
func (LAEnvironment) Init ¶
func (e LAEnvironment) Init() LAEnvironment
Init initializes the instance.
func (LAEnvironment) RemoveObserver ¶
func (e LAEnvironment) RemoveObserver(observer LAEnvironmentObserver)
Discussion ¶
Removes the previously registered observer.
If the observer is deallocated, it will be removed automatically.
See: https://developer.apple.com/documentation/LocalAuthentication/LAEnvironment/removeObserver(_:)
func (LAEnvironment) State ¶
func (e LAEnvironment) State() objectivec.IObject
The environment state information.
See: https://developer.apple.com/documentation/LocalAuthentication/LAEnvironment/state-swift.property
type LAEnvironmentClass ¶
type LAEnvironmentClass struct {
// contains filtered or unexported fields
}
func GetLAEnvironmentClass ¶
func GetLAEnvironmentClass() LAEnvironmentClass
GetLAEnvironmentClass returns the class object for LAEnvironment.
func (LAEnvironmentClass) Alloc ¶
func (lc LAEnvironmentClass) Alloc() LAEnvironment
Alloc allocates memory for a new instance of the class.
func (LAEnvironmentClass) Class ¶
func (lc LAEnvironmentClass) Class() objc.Class
Class returns the underlying Objective-C class pointer.
func (LAEnvironmentClass) CurrentUser ¶
func (_LAEnvironmentClass LAEnvironmentClass) CurrentUser() LAEnvironment
Environment of the current user.
See: https://developer.apple.com/documentation/LocalAuthentication/LAEnvironment/currentUser
type LAEnvironmentMechanism ¶
type LAEnvironmentMechanism struct {
objectivec.Object
}
Instance Properties ¶
- LAEnvironmentMechanism.IconSystemName: Name of the SF Symbol representing this authentication mechanism.
- LAEnvironmentMechanism.IsUsable
- LAEnvironmentMechanism.LocalizedName: The localized name of the authentication mechanism, e.g. “Touch ID”, “Face ID” etc.
See: https://developer.apple.com/documentation/LocalAuthentication/LAEnvironment/Mechanism
func LAEnvironmentMechanismFromID ¶
func LAEnvironmentMechanismFromID(id objc.ID) LAEnvironmentMechanism
LAEnvironmentMechanismFromID constructs a LAEnvironmentMechanism from an objc.ID.
func NewLAEnvironmentMechanism ¶
func NewLAEnvironmentMechanism() LAEnvironmentMechanism
NewLAEnvironmentMechanism creates a new LAEnvironmentMechanism instance.
func (LAEnvironmentMechanism) Autorelease ¶
func (e LAEnvironmentMechanism) Autorelease() LAEnvironmentMechanism
Autorelease adds the receiver to the current autorelease pool.
func (LAEnvironmentMechanism) IconSystemName ¶
func (e LAEnvironmentMechanism) IconSystemName() string
Name of the SF Symbol representing this authentication mechanism.
See: https://developer.apple.com/documentation/LocalAuthentication/LAEnvironment/Mechanism/iconSystemName
func (LAEnvironmentMechanism) Init ¶
func (e LAEnvironmentMechanism) Init() LAEnvironmentMechanism
Init initializes the instance.
func (LAEnvironmentMechanism) IsUsable ¶
func (e LAEnvironmentMechanism) IsUsable() bool
Discussion ¶
Whether the mechanism is available for use, i.e. whether the relevant preflight call of @c canEvaluatePolicy would succeed.
properties of the subclass to determine why mechanism can’t be used.
See: https://developer.apple.com/documentation/LocalAuthentication/LAEnvironment/Mechanism/isUsable
func (LAEnvironmentMechanism) LocalizedName ¶
func (e LAEnvironmentMechanism) LocalizedName() string
The localized name of the authentication mechanism, e.g. “Touch ID”, “Face ID” etc.
See: https://developer.apple.com/documentation/LocalAuthentication/LAEnvironment/Mechanism/localizedName
type LAEnvironmentMechanismBiometry ¶
type LAEnvironmentMechanismBiometry struct {
LAEnvironmentMechanism
}
Instance Properties ¶
- LAEnvironmentMechanismBiometry.BiometryType
- LAEnvironmentMechanismBiometry.BuiltInSensorInaccessible
- LAEnvironmentMechanismBiometry.IsEnrolled
- LAEnvironmentMechanismBiometry.IsLockedOut
- LAEnvironmentMechanismBiometry.StateHash
See: https://developer.apple.com/documentation/LocalAuthentication/LAEnvironment/MechanismBiometry
func LAEnvironmentMechanismBiometryFromID ¶
func LAEnvironmentMechanismBiometryFromID(id objc.ID) LAEnvironmentMechanismBiometry
LAEnvironmentMechanismBiometryFromID constructs a LAEnvironmentMechanismBiometry from an objc.ID.
func NewLAEnvironmentMechanismBiometry ¶
func NewLAEnvironmentMechanismBiometry() LAEnvironmentMechanismBiometry
NewLAEnvironmentMechanismBiometry creates a new LAEnvironmentMechanismBiometry instance.
func (LAEnvironmentMechanismBiometry) Autorelease ¶
func (e LAEnvironmentMechanismBiometry) Autorelease() LAEnvironmentMechanismBiometry
Autorelease adds the receiver to the current autorelease pool.
func (LAEnvironmentMechanismBiometry) BiometryType ¶
func (e LAEnvironmentMechanismBiometry) BiometryType() LABiometryType
Discussion ¶
Type of biometry supported by the device.
This property does not indicate whether biometry is available or not. It always reads the type of biometry supported by device hardware. You should check @c isUsable property to see if it is available for use.
func (LAEnvironmentMechanismBiometry) BuiltInSensorInaccessible ¶
func (e LAEnvironmentMechanismBiometry) BuiltInSensorInaccessible() bool
Discussion ¶
Whether the built in biometric sensor is inaccessible in the current configuration, preventing the use of biometry.
Currently, the only example of this is a Clamshell Mode on macOS. The user will be not able to use Touch ID if the MacBook lid is closed while connected to external monitor and keyboard, unless the external keyboard has Touch ID.
func (LAEnvironmentMechanismBiometry) Init ¶
func (e LAEnvironmentMechanismBiometry) Init() LAEnvironmentMechanismBiometry
Init initializes the instance.
func (LAEnvironmentMechanismBiometry) IsEnrolled ¶
func (e LAEnvironmentMechanismBiometry) IsEnrolled() bool
Discussion ¶
Whether the user has enrolled this biometry.
Even if biometry is enrolled, it does not necessarily mean that it can be used. You should check @c isUsable property to see if it is available for use.
func (LAEnvironmentMechanismBiometry) IsLockedOut ¶
func (e LAEnvironmentMechanismBiometry) IsLockedOut() bool
Discussion ¶
Whether biometry is locked out.
The system might lock the user out of biometry for various reasons. For example, with Face ID, the user is locked out after 5 failed match attempts in row. To recover from bio lockout, users need to enter their passcode (e.g. during device ulock).
func (LAEnvironmentMechanismBiometry) StateHash ¶
func (e LAEnvironmentMechanismBiometry) StateHash() foundation.NSData
Discussion ¶
The application specific state of the biometric enrollment as returned by @c LAContext.domainState.biometry.stateHash
This value represents the state of the enrollment and changes whenever the biometric enrollment is changed. It does not directly map to the enrolled templates, e.g. if a finger is added to Touch ID enrollement and then removed, the final state would be different. It also returns different values to different apps to prevent tracking of user identity.
type LAEnvironmentMechanismBiometryClass ¶
type LAEnvironmentMechanismBiometryClass struct {
// contains filtered or unexported fields
}
func GetLAEnvironmentMechanismBiometryClass ¶
func GetLAEnvironmentMechanismBiometryClass() LAEnvironmentMechanismBiometryClass
GetLAEnvironmentMechanismBiometryClass returns the class object for LAEnvironmentMechanismBiometry.
func (LAEnvironmentMechanismBiometryClass) Alloc ¶
func (lc LAEnvironmentMechanismBiometryClass) Alloc() LAEnvironmentMechanismBiometry
Alloc allocates memory for a new instance of the class.
func (LAEnvironmentMechanismBiometryClass) Class ¶
func (lc LAEnvironmentMechanismBiometryClass) Class() objc.Class
Class returns the underlying Objective-C class pointer.
type LAEnvironmentMechanismClass ¶
type LAEnvironmentMechanismClass struct {
// contains filtered or unexported fields
}
func GetLAEnvironmentMechanismClass ¶
func GetLAEnvironmentMechanismClass() LAEnvironmentMechanismClass
GetLAEnvironmentMechanismClass returns the class object for LAEnvironmentMechanism.
func (LAEnvironmentMechanismClass) Alloc ¶
func (lc LAEnvironmentMechanismClass) Alloc() LAEnvironmentMechanism
Alloc allocates memory for a new instance of the class.
func (LAEnvironmentMechanismClass) Class ¶
func (lc LAEnvironmentMechanismClass) Class() objc.Class
Class returns the underlying Objective-C class pointer.
type LAEnvironmentMechanismCompanion ¶
type LAEnvironmentMechanismCompanion struct {
LAEnvironmentMechanism
}
Instance Properties ¶
- LAEnvironmentMechanismCompanion.StateHash
- LAEnvironmentMechanismCompanion.Type: Type of the companion.
See: https://developer.apple.com/documentation/LocalAuthentication/LAEnvironment/MechanismCompanion
func LAEnvironmentMechanismCompanionFromID ¶
func LAEnvironmentMechanismCompanionFromID(id objc.ID) LAEnvironmentMechanismCompanion
LAEnvironmentMechanismCompanionFromID constructs a LAEnvironmentMechanismCompanion from an objc.ID.
func NewLAEnvironmentMechanismCompanion ¶
func NewLAEnvironmentMechanismCompanion() LAEnvironmentMechanismCompanion
NewLAEnvironmentMechanismCompanion creates a new LAEnvironmentMechanismCompanion instance.
func (LAEnvironmentMechanismCompanion) Autorelease ¶
func (e LAEnvironmentMechanismCompanion) Autorelease() LAEnvironmentMechanismCompanion
Autorelease adds the receiver to the current autorelease pool.
func (LAEnvironmentMechanismCompanion) Init ¶
func (e LAEnvironmentMechanismCompanion) Init() LAEnvironmentMechanismCompanion
Init initializes the instance.
func (LAEnvironmentMechanismCompanion) StateHash ¶
func (e LAEnvironmentMechanismCompanion) StateHash() foundation.NSData
Discussion ¶
Hash of the current companion pairing as returned by @c LAContext.domainState.companion.stateHash(for:)
If no companion are paired for this companion type, @c stateHash property is @c nil. If at least one companion is paired for this companion type, @c stateHash is not @c nil and it changes whenever the set of paired companions of this type is changed.
func (LAEnvironmentMechanismCompanion) Type ¶
func (e LAEnvironmentMechanismCompanion) Type() LACompanionType
Type of the companion.
See: https://developer.apple.com/documentation/LocalAuthentication/LAEnvironment/MechanismCompanion/type
type LAEnvironmentMechanismCompanionClass ¶
type LAEnvironmentMechanismCompanionClass struct {
// contains filtered or unexported fields
}
func GetLAEnvironmentMechanismCompanionClass ¶
func GetLAEnvironmentMechanismCompanionClass() LAEnvironmentMechanismCompanionClass
GetLAEnvironmentMechanismCompanionClass returns the class object for LAEnvironmentMechanismCompanion.
func (LAEnvironmentMechanismCompanionClass) Alloc ¶
func (lc LAEnvironmentMechanismCompanionClass) Alloc() LAEnvironmentMechanismCompanion
Alloc allocates memory for a new instance of the class.
func (LAEnvironmentMechanismCompanionClass) Class ¶
func (lc LAEnvironmentMechanismCompanionClass) Class() objc.Class
Class returns the underlying Objective-C class pointer.
type LAEnvironmentMechanismUserPassword ¶
type LAEnvironmentMechanismUserPassword struct {
LAEnvironmentMechanism
}
Instance Properties ¶
See: https://developer.apple.com/documentation/LocalAuthentication/LAEnvironment/MechanismUserPassword
func LAEnvironmentMechanismUserPasswordFromID ¶
func LAEnvironmentMechanismUserPasswordFromID(id objc.ID) LAEnvironmentMechanismUserPassword
LAEnvironmentMechanismUserPasswordFromID constructs a LAEnvironmentMechanismUserPassword from an objc.ID.
func NewLAEnvironmentMechanismUserPassword ¶
func NewLAEnvironmentMechanismUserPassword() LAEnvironmentMechanismUserPassword
NewLAEnvironmentMechanismUserPassword creates a new LAEnvironmentMechanismUserPassword instance.
func (LAEnvironmentMechanismUserPassword) Autorelease ¶
func (e LAEnvironmentMechanismUserPassword) Autorelease() LAEnvironmentMechanismUserPassword
Autorelease adds the receiver to the current autorelease pool.
func (LAEnvironmentMechanismUserPassword) Init ¶
func (e LAEnvironmentMechanismUserPassword) Init() LAEnvironmentMechanismUserPassword
Init initializes the instance.
func (LAEnvironmentMechanismUserPassword) IsSet ¶
func (e LAEnvironmentMechanismUserPassword) IsSet() bool
Discussion ¶
Whether the local user password or passcode is set on this device.
type LAEnvironmentMechanismUserPasswordClass ¶
type LAEnvironmentMechanismUserPasswordClass struct {
// contains filtered or unexported fields
}
func GetLAEnvironmentMechanismUserPasswordClass ¶
func GetLAEnvironmentMechanismUserPasswordClass() LAEnvironmentMechanismUserPasswordClass
GetLAEnvironmentMechanismUserPasswordClass returns the class object for LAEnvironmentMechanismUserPassword.
func (LAEnvironmentMechanismUserPasswordClass) Alloc ¶
func (lc LAEnvironmentMechanismUserPasswordClass) Alloc() LAEnvironmentMechanismUserPassword
Alloc allocates memory for a new instance of the class.
func (LAEnvironmentMechanismUserPasswordClass) Class ¶
func (lc LAEnvironmentMechanismUserPasswordClass) Class() objc.Class
Class returns the underlying Objective-C class pointer.
type LAEnvironmentObserver ¶
type LAEnvironmentObserver interface {
objectivec.IObject
}
LAEnvironmentObserver protocol.
See: https://developer.apple.com/documentation/LocalAuthentication/LAEnvironment/Observer
type LAEnvironmentObserverObject ¶
type LAEnvironmentObserverObject struct {
objectivec.Object
}
LAEnvironmentObserverObject wraps an existing Objective-C object that conforms to the LAEnvironmentObserver protocol.
func LAEnvironmentObserverObjectFromID ¶
func LAEnvironmentObserverObjectFromID(id objc.ID) LAEnvironmentObserverObject
LAEnvironmentObserverObjectFromID constructs a LAEnvironmentObserverObject from an objc.ID. The object is determined to conform to the protocol at runtime.
func (LAEnvironmentObserverObject) BaseObject ¶
func (o LAEnvironmentObserverObject) BaseObject() objectivec.Object
func (LAEnvironmentObserverObject) EnvironmentStateDidChangeFromOldState ¶
func (o LAEnvironmentObserverObject) EnvironmentStateDidChangeFromOldState(environment ILAEnvironment, oldState kernel.ID)
Called when there has been a change in the environment.
oldState: The old environment state (before update)
Discussion ¶
Invoked on a queue private to LocalAuthentication framework. At the moment of invocation of this method, @c LAEnvironment.state already contains the new updated state.
type LAEnvironmentState ¶
type LAEnvironmentState struct {
objectivec.Object
}
Instance Properties ¶
- LAEnvironmentState.AllMechanisms
- LAEnvironmentState.Biometry
- LAEnvironmentState.Companions
- LAEnvironmentState.UserPassword
See: https://developer.apple.com/documentation/LocalAuthentication/LAEnvironment/State-swift.class
func LAEnvironmentStateFromID ¶
func LAEnvironmentStateFromID(id objc.ID) LAEnvironmentState
LAEnvironmentStateFromID constructs a LAEnvironmentState from an objc.ID.
func NewLAEnvironmentState ¶
func NewLAEnvironmentState() LAEnvironmentState
NewLAEnvironmentState creates a new LAEnvironmentState instance.
func (LAEnvironmentState) AllMechanisms ¶
func (e LAEnvironmentState) AllMechanisms() []LAEnvironmentMechanism
Discussion ¶
Information about all authentication mechanisms.
This property aggregates @c biometry, @c userPassword, @c companions and any future authentication mechanisms.
func (LAEnvironmentState) Autorelease ¶
func (e LAEnvironmentState) Autorelease() LAEnvironmentState
Autorelease adds the receiver to the current autorelease pool.
func (LAEnvironmentState) Biometry ¶
func (e LAEnvironmentState) Biometry() ILAEnvironmentMechanismBiometry
Discussion ¶
Information about biometric authentication (Touch ID, Face ID or Optic ID).
@c nil if biometry is not supported by this device.
func (LAEnvironmentState) Companions ¶
func (e LAEnvironmentState) Companions() []LAEnvironmentMechanismCompanion
Discussion ¶
Companion authentication mechanisms.
Companion mechanisms such as Apple Watch can appear and disappear as they get in and out of reach, but this property enumerates paired companions, even if they are not reachable at the moment. Check @c isUsable property to determine if a particular companion type is available for use. Note that items in this array represent paired companion types, not individual devices. Therefore, even if the user has paired multiple Apple Watch devices for companion authentication, the array will contain only one
func (LAEnvironmentState) Init ¶
func (e LAEnvironmentState) Init() LAEnvironmentState
Init initializes the instance.
func (LAEnvironmentState) UserPassword ¶
func (e LAEnvironmentState) UserPassword() ILAEnvironmentMechanismUserPassword
Discussion ¶
Information about local user password (on macOS) or passcode (on embedded platforms).
@c nil if user password or passcode is not supported by this device.
type LAEnvironmentStateClass ¶
type LAEnvironmentStateClass struct {
// contains filtered or unexported fields
}
func GetLAEnvironmentStateClass ¶
func GetLAEnvironmentStateClass() LAEnvironmentStateClass
GetLAEnvironmentStateClass returns the class object for LAEnvironmentState.
func (LAEnvironmentStateClass) Alloc ¶
func (lc LAEnvironmentStateClass) Alloc() LAEnvironmentState
Alloc allocates memory for a new instance of the class.
func (LAEnvironmentStateClass) Class ¶
func (lc LAEnvironmentStateClass) Class() objc.Class
Class returns the underlying Objective-C class pointer.
type LAError ¶
type LAError int
See: https://developer.apple.com/documentation/LocalAuthentication/LAError-swift.struct/Code
const ( // LAErrorAppCancel: The app canceled authentication. LAErrorAppCancel LAError = -9 // LAErrorAuthenticationFailed: The user failed to provide valid credentials. LAErrorAuthenticationFailed LAError = -1 // LAErrorBiometryDisconnected: The device supports biometry only using a removable accessory, but the paired accessory isn’t connected. LAErrorBiometryDisconnected LAError = -13 // LAErrorBiometryLockout: Biometry is locked because there were too many failed attempts. LAErrorBiometryLockout LAError = -8 // LAErrorBiometryNotAvailable: Biometry is not available on the device. LAErrorBiometryNotAvailable LAError = -6 // LAErrorBiometryNotEnrolled: The user has no enrolled biometric identities. LAErrorBiometryNotEnrolled LAError = -7 // LAErrorBiometryNotPaired: The device supports biometry only using a removable accessory, but no accessory is paired. LAErrorBiometryNotPaired LAError = -12 // LAErrorCompanionNotAvailable: Authentication could not start because there was no paired companion device nearby. LAErrorCompanionNotAvailable LAError = -11 // LAErrorInvalidContext: The context was previously invalidated. LAErrorInvalidContext LAError = -10 LAErrorInvalidDimensions LAError = -12 // LAErrorNotInteractive: Displaying the required authentication user interface is forbidden. LAErrorNotInteractive LAError = -1004 // LAErrorPasscodeNotSet: A passcode isn’t set on the device. LAErrorPasscodeNotSet LAError = -5 // LAErrorSystemCancel: The system canceled authentication. LAErrorSystemCancel LAError = -4 // LAErrorUserCancel: The user tapped the cancel button in the authentication dialog. LAErrorUserCancel LAError = -2 // LAErrorUserFallback: The user tapped the fallback button in the authentication dialog, but no fallback is available for the authentication policy. LAErrorUserFallback LAError = -3 // Deprecated. LAErrorTouchIDLockout LAError = -6 // Deprecated. LAErrorTouchIDNotAvailable LAError = -6 // Deprecated. LAErrorTouchIDNotEnrolled LAError = -7 // Deprecated: use LAErrorCompanionNotAvailable. LAErrorWatchNotAvailable LAError = -11 )
type LAPersistedRight ¶
type LAPersistedRight struct {
LARight
}
A right that gates access to a key and a secret.
Overview ¶
An LAPersistedRight is a right that’s backed by a unique key in the Secure Enclave with an access control list that matches the authorization requirements of the right. You can access the key that backs a right to perform cryptographic operations like encryption, decryption, signing, and verification.
You can use the key that backs an LAPersistedRight to perform both public key and private key operations, but private key operations — like decryption, signing, and key exchange — are only available after you authorize the right. Public key operations like encryption and verification are always available.
The following generates a right with the default authorization requirements, stores it in the LARightStoreClass.SharedStore LARightStore, and exports the public key so that you can use it to verify signatures that the corresponding private key produces:
The following uses the private key associated with the right from the previous example to sign a challenge issued by a server:
The signature operation occurs after verifying that the user has the proper authorization and confirming that the private key supports the given signing algorithm.
Accessing persistent data ¶
- LAPersistedRight.Key: The private key that’s persisted by the right.
- LAPersistedRight.Secret: The data kept secret by the right.
See: https://developer.apple.com/documentation/LocalAuthentication/LAPersistedRight
func LAPersistedRightFromID ¶
func LAPersistedRightFromID(id objc.ID) LAPersistedRight
LAPersistedRightFromID constructs a LAPersistedRight from an objc.ID.
A right that gates access to a key and a secret.
func NewLAPersistedRight ¶
func NewLAPersistedRight() LAPersistedRight
NewLAPersistedRight creates a new LAPersistedRight instance.
func NewPersistedRightWithRequirement ¶
func NewPersistedRightWithRequirement(requirement ILAAuthenticationRequirement) LAPersistedRight
Creates a right with the authentication requirements you supply.
See: https://developer.apple.com/documentation/LocalAuthentication/LARight/init(requirement:)
func (LAPersistedRight) Autorelease ¶
func (p LAPersistedRight) Autorelease() LAPersistedRight
Autorelease adds the receiver to the current autorelease pool.
func (LAPersistedRight) Init ¶
func (p LAPersistedRight) Init() LAPersistedRight
Init initializes the instance.
func (LAPersistedRight) Key ¶
func (p LAPersistedRight) Key() ILAPrivateKey
The private key that’s persisted by the right.
See: https://developer.apple.com/documentation/LocalAuthentication/LAPersistedRight/key
func (LAPersistedRight) Secret ¶
func (p LAPersistedRight) Secret() ILASecret
The data kept secret by the right.
See: https://developer.apple.com/documentation/LocalAuthentication/LAPersistedRight/secret
type LAPersistedRightClass ¶
type LAPersistedRightClass struct {
// contains filtered or unexported fields
}
func GetLAPersistedRightClass ¶
func GetLAPersistedRightClass() LAPersistedRightClass
GetLAPersistedRightClass returns the class object for LAPersistedRight.
func (LAPersistedRightClass) Alloc ¶
func (lc LAPersistedRightClass) Alloc() LAPersistedRight
Alloc allocates memory for a new instance of the class.
func (LAPersistedRightClass) Class ¶
func (lc LAPersistedRightClass) Class() objc.Class
Class returns the underlying Objective-C class pointer.
type LAPersistedRightErrorHandler ¶
type LAPersistedRightErrorHandler = func(*LAPersistedRight, error)
LAPersistedRightErrorHandler handles A completion handler to call when the right access completes. The error can be type-asserted to *foundation.NSError for Domain, Code, and UserInfo.
Used by:
type LAPolicy ¶
type LAPolicy int
See: https://developer.apple.com/documentation/LocalAuthentication/LAPolicy
const ( // LAPolicyDeviceOwnerAuthentication: User authentication with biometry, Apple Watch, or the device passcode. LAPolicyDeviceOwnerAuthentication LAPolicy = 2 // LAPolicyDeviceOwnerAuthenticationWithBiometrics: User authentication with biometry. LAPolicyDeviceOwnerAuthenticationWithBiometrics LAPolicy = 1 // LAPolicyDeviceOwnerAuthenticationWithBiometricsOrCompanion: Device owner will be authenticated by biometry or a companion device e.g. LAPolicyDeviceOwnerAuthenticationWithBiometricsOrCompanion LAPolicy = 4 // LAPolicyDeviceOwnerAuthenticationWithCompanion: Device owner will be authenticated by a companion device e.g. LAPolicyDeviceOwnerAuthenticationWithCompanion LAPolicy = 3 // LAPolicyDeviceOwnerAuthenticationWithWristDetection: User authentication with wrist detection on watchOS. LAPolicyDeviceOwnerAuthenticationWithWristDetection LAPolicy = 5 // Deprecated: use LAPolicyDeviceOwnerAuthenticationWithBiometricsOrCompanion. LAPolicyDeviceOwnerAuthenticationWithBiometricsOrWatch LAPolicy = 4 // Deprecated: use LAPolicyDeviceOwnerAuthenticationWithCompanion. LAPolicyDeviceOwnerAuthenticationWithWatch LAPolicy = 3 )
type LAPrivateKey ¶
type LAPrivateKey struct {
objectivec.Object
}
The private portion of an asymmetric key pair.
Accessing the associated public key ¶
- LAPrivateKey.PublicKey: The public key that corresponds with the private key in a key pair.
Checking algorithm support ¶
- LAPrivateKey.CanDecryptUsingSecKeyAlgorithm: Checks whether the algorithm you supply is valid for decrypting data with the key.
- LAPrivateKey.CanExchangeKeysUsingSecKeyAlgorithm: Checks whether the algorithm you supply is valid for performing key exchanges.
- LAPrivateKey.CanSignUsingSecKeyAlgorithm: Checks whether the algorithm you supply is valid for signing data with the key.
Performing cryptographic operations ¶
- LAPrivateKey.DecryptDataSecKeyAlgorithmCompletion: Decrypts the data you supply with a given algorithm.
- LAPrivateKey.ExchangeKeysWithPublicKeySecKeyAlgorithmSecKeyParametersCompletion: Performs a Diffie-Hellman style key exchange operation.
- LAPrivateKey.SignDataSecKeyAlgorithmCompletion: Generates a digital signature for the data you supply.
See: https://developer.apple.com/documentation/LocalAuthentication/LAPrivateKey
func LAPrivateKeyFromID ¶
func LAPrivateKeyFromID(id objc.ID) LAPrivateKey
LAPrivateKeyFromID constructs a LAPrivateKey from an objc.ID.
The private portion of an asymmetric key pair.
func NewLAPrivateKey ¶
func NewLAPrivateKey() LAPrivateKey
NewLAPrivateKey creates a new LAPrivateKey instance.
func (LAPrivateKey) Autorelease ¶
func (p LAPrivateKey) Autorelease() LAPrivateKey
Autorelease adds the receiver to the current autorelease pool.
func (LAPrivateKey) CanDecryptUsingSecKeyAlgorithm ¶
func (p LAPrivateKey) CanDecryptUsingSecKeyAlgorithm(algorithm corefoundation.CFStringRef) bool
Checks whether the algorithm you supply is valid for decrypting data with the key.
algorithm: A cryptographic algorithm.
Return Value ¶
A Boolean value that indicates whether the algorithm you supply is valid for decrypting data with the key.
See: https://developer.apple.com/documentation/LocalAuthentication/LAPrivateKey/canDecrypt(using:)
func (LAPrivateKey) CanExchangeKeysUsingSecKeyAlgorithm ¶
func (p LAPrivateKey) CanExchangeKeysUsingSecKeyAlgorithm(algorithm corefoundation.CFStringRef) bool
Checks whether the algorithm you supply is valid for performing key exchanges.
algorithm: A cryptographic algorithm.
Return Value ¶
A Boolean value that indicates whether the algorithm you supply is valid for performing key exchanges.
See: https://developer.apple.com/documentation/LocalAuthentication/LAPrivateKey/canExchangeKeys(using:)
func (LAPrivateKey) CanSignUsingSecKeyAlgorithm ¶
func (p LAPrivateKey) CanSignUsingSecKeyAlgorithm(algorithm corefoundation.CFStringRef) bool
Checks whether the algorithm you supply is valid for signing data with the key.
algorithm: A cryptographic algorithm.
Return Value ¶
A Boolean value that indicates whether the algorithm you supply is valid for signing data with the key.
See: https://developer.apple.com/documentation/LocalAuthentication/LAPrivateKey/canSign(using:)
func (LAPrivateKey) DecryptDataSecKeyAlgorithmCompletion ¶
func (p LAPrivateKey) DecryptDataSecKeyAlgorithmCompletion(data foundation.NSData, algorithm corefoundation.CFStringRef, handler DataErrorHandler)
Decrypts the data you supply with a given algorithm.
data: The data to decrypt.
algorithm: The algorithm to use to decrypt the data.
handler: A completion handler to call when the decryption operation completes.
`data`: The decrypted data. `error`: An error object that indicates why the decryption failed, or `nil` if it succeeded.
Discussion ¶
func (LAPrivateKey) DecryptDataSecKeyAlgorithmCompletionSync ¶
func (p LAPrivateKey) DecryptDataSecKeyAlgorithmCompletionSync(ctx context.Context, data foundation.NSData, algorithm corefoundation.CFStringRef) (*foundation.NSData, error)
DecryptDataSecKeyAlgorithmCompletionSync is a synchronous wrapper around LAPrivateKey.DecryptDataSecKeyAlgorithmCompletion. It blocks until the completion handler fires or the context is cancelled.
func (LAPrivateKey) ExchangeKeysWithPublicKeySecKeyAlgorithmSecKeyParametersCompletion ¶
func (p LAPrivateKey) ExchangeKeysWithPublicKeySecKeyAlgorithmSecKeyParametersCompletion(publicKey foundation.NSData, algorithm corefoundation.CFStringRef, parameters foundation.INSDictionary, handler DataErrorHandler)
Performs a Diffie-Hellman style key exchange operation.
publicKey: The remote party’s public key.
algorithm: An algorithm suitable for performing this key exchange. For example, `ecdhKeyExchangeCofactorX963SHA256`.
parameters: A dictionary with parameters for this key exchange.
handler: A completion handler to call when the key exchange operation completes.
data: The result of the key exchange operation. error: An error object that indicates why the key exchange failed, or `nil` if the exchange succeeded.
Discussion ¶
The algorithm you use determines the parameters in the dictionary that are required or optional. For more information, see SecKeyKeyExchangeParameter.
func (LAPrivateKey) ExchangeKeysWithPublicKeySecKeyAlgorithmSecKeyParametersCompletionSync ¶
func (p LAPrivateKey) ExchangeKeysWithPublicKeySecKeyAlgorithmSecKeyParametersCompletionSync(ctx context.Context, publicKey foundation.NSData, algorithm corefoundation.CFStringRef, parameters foundation.INSDictionary) (*foundation.NSData, error)
ExchangeKeysWithPublicKeySecKeyAlgorithmSecKeyParametersCompletionSync is a synchronous wrapper around LAPrivateKey.ExchangeKeysWithPublicKeySecKeyAlgorithmSecKeyParametersCompletion. It blocks until the completion handler fires or the context is cancelled.
func (LAPrivateKey) PublicKey ¶
func (p LAPrivateKey) PublicKey() ILAPublicKey
The public key that corresponds with the private key in a key pair.
See: https://developer.apple.com/documentation/LocalAuthentication/LAPrivateKey/publicKey
func (LAPrivateKey) SignDataSecKeyAlgorithmCompletion ¶
func (p LAPrivateKey) SignDataSecKeyAlgorithmCompletion(data foundation.NSData, algorithm corefoundation.CFStringRef, handler DataErrorHandler)
Generates a digital signature for the data you supply.
data: The data to sign. The data is usually the digest of applying a cryptographic hash function to some actual data.
algorithm: An algorithm suitable for this data signing operation. For example, `ecdsaSignatureMessageX962SHA256`.
handler: A completion handler to call when the signing operation completes.
data: The signature of the data you supply. error: An error object that indicates why the signing operation failed, or `nil` if it succeeded.
Discussion ¶
func (LAPrivateKey) SignDataSecKeyAlgorithmCompletionSync ¶
func (p LAPrivateKey) SignDataSecKeyAlgorithmCompletionSync(ctx context.Context, data foundation.NSData, algorithm corefoundation.CFStringRef) (*foundation.NSData, error)
SignDataSecKeyAlgorithmCompletionSync is a synchronous wrapper around LAPrivateKey.SignDataSecKeyAlgorithmCompletion. It blocks until the completion handler fires or the context is cancelled.
type LAPrivateKeyClass ¶
type LAPrivateKeyClass struct {
// contains filtered or unexported fields
}
func GetLAPrivateKeyClass ¶
func GetLAPrivateKeyClass() LAPrivateKeyClass
GetLAPrivateKeyClass returns the class object for LAPrivateKey.
func (LAPrivateKeyClass) Alloc ¶
func (lc LAPrivateKeyClass) Alloc() LAPrivateKey
Alloc allocates memory for a new instance of the class.
func (LAPrivateKeyClass) Class ¶
func (lc LAPrivateKeyClass) Class() objc.Class
Class returns the underlying Objective-C class pointer.
type LAPublicKey ¶
type LAPublicKey struct {
objectivec.Object
}
The public portion of an asymmetric key pair.
Checking algorithm support ¶
- LAPublicKey.CanEncryptUsingSecKeyAlgorithm: Checks whether the algorithm you supply is valid for encrypting data with the key.
- LAPublicKey.CanVerifyUsingSecKeyAlgorithm: Checks whether the algorithm you supply is valid for verifying signatures with the key.
Performing cryptographic operations ¶
- LAPublicKey.EncryptDataSecKeyAlgorithmCompletion: Encrypts the data you supply with a given algorithm.
- LAPublicKey.ExportBytesWithCompletion: Exports the data that represents a public key.
- LAPublicKey.VerifyDataSignatureSecKeyAlgorithmCompletion: Verifies a digital signature for the data you supply.
See: https://developer.apple.com/documentation/LocalAuthentication/LAPublicKey
func LAPublicKeyFromID ¶
func LAPublicKeyFromID(id objc.ID) LAPublicKey
LAPublicKeyFromID constructs a LAPublicKey from an objc.ID.
The public portion of an asymmetric key pair.
func NewLAPublicKey ¶
func NewLAPublicKey() LAPublicKey
NewLAPublicKey creates a new LAPublicKey instance.
func (LAPublicKey) Autorelease ¶
func (p LAPublicKey) Autorelease() LAPublicKey
Autorelease adds the receiver to the current autorelease pool.
func (LAPublicKey) CanEncryptUsingSecKeyAlgorithm ¶
func (p LAPublicKey) CanEncryptUsingSecKeyAlgorithm(algorithm corefoundation.CFStringRef) bool
Checks whether the algorithm you supply is valid for encrypting data with the key.
algorithm: A cryptographic algorithm.
Return Value ¶
A Boolean value that indicates whether the algorithm you supply is valid for encrypting data with the key.
See: https://developer.apple.com/documentation/LocalAuthentication/LAPublicKey/canEncrypt(using:)
func (LAPublicKey) CanVerifyUsingSecKeyAlgorithm ¶
func (p LAPublicKey) CanVerifyUsingSecKeyAlgorithm(algorithm corefoundation.CFStringRef) bool
Checks whether the algorithm you supply is valid for verifying signatures with the key.
algorithm: A cryptographic algorithm.
Return Value ¶
A Boolean value that indicates whether the algorithm you supply is valid for verifying signatures with the key.
See: https://developer.apple.com/documentation/LocalAuthentication/LAPublicKey/canVerify(using:)
func (LAPublicKey) EncryptDataSecKeyAlgorithmCompletion ¶
func (p LAPublicKey) EncryptDataSecKeyAlgorithmCompletion(data foundation.NSData, algorithm corefoundation.CFStringRef, handler DataErrorHandler)
Encrypts the data you supply with a given algorithm.
data: The data to encrypt.
algorithm: The algorithm to use to encrypt the data.
handler: A completion handler to call when the encryption operation completes.
`data`: The encrypted data. `error`: An error object that indicates why the encryption failed, or `nil` if it succeeded.
Discussion ¶
func (LAPublicKey) EncryptDataSecKeyAlgorithmCompletionSync ¶
func (p LAPublicKey) EncryptDataSecKeyAlgorithmCompletionSync(ctx context.Context, data foundation.NSData, algorithm corefoundation.CFStringRef) (*foundation.NSData, error)
EncryptDataSecKeyAlgorithmCompletionSync is a synchronous wrapper around LAPublicKey.EncryptDataSecKeyAlgorithmCompletion. It blocks until the completion handler fires or the context is cancelled.
func (LAPublicKey) ExportBytes ¶
func (p LAPublicKey) ExportBytes(ctx context.Context) (*foundation.NSData, error)
ExportBytes is a synchronous wrapper around LAPublicKey.ExportBytesWithCompletion. It blocks until the completion handler fires or the context is cancelled.
func (LAPublicKey) ExportBytesWithCompletion ¶
func (p LAPublicKey) ExportBytesWithCompletion(handler DataErrorHandler)
Exports the data that represents a public key.
handler: A completion handler to call when the export operation completes.
`data`: The data that represents the public key. `error`: An error object that indicates why the export operation failed, or `nil` if it succeeded.
Discussion ¶
See: https://developer.apple.com/documentation/LocalAuthentication/LAPublicKey/exportBytes(completion:)
func (LAPublicKey) VerifyDataSignatureSecKeyAlgorithmCompletion ¶
func (p LAPublicKey) VerifyDataSignatureSecKeyAlgorithmCompletion(signedData foundation.NSData, signature foundation.NSData, algorithm corefoundation.CFStringRef, handler ErrorHandler)
Verifies a digital signature for the data you supply.
signedData: The signed data.
signature: The signature of the data.
algorithm: An algorithm suitable for verifying signatures with this public key.
handler: A completion handler to call when the verification operation completes.
`error`: An error object that indicates why the verification operation failed, or `nil` if it succeeded.
Discussion ¶
func (LAPublicKey) VerifyDataSignatureSecKeyAlgorithmCompletionSync ¶
func (p LAPublicKey) VerifyDataSignatureSecKeyAlgorithmCompletionSync(ctx context.Context, signedData foundation.NSData, signature foundation.NSData, algorithm corefoundation.CFStringRef) error
VerifyDataSignatureSecKeyAlgorithmCompletionSync is a synchronous wrapper around LAPublicKey.VerifyDataSignatureSecKeyAlgorithmCompletion. It blocks until the completion handler fires or the context is cancelled.
type LAPublicKeyClass ¶
type LAPublicKeyClass struct {
// contains filtered or unexported fields
}
func GetLAPublicKeyClass ¶
func GetLAPublicKeyClass() LAPublicKeyClass
GetLAPublicKeyClass returns the class object for LAPublicKey.
func (LAPublicKeyClass) Alloc ¶
func (lc LAPublicKeyClass) Alloc() LAPublicKey
Alloc allocates memory for a new instance of the class.
func (LAPublicKeyClass) Class ¶
func (lc LAPublicKeyClass) Class() objc.Class
Class returns the underlying Objective-C class pointer.
type LARight ¶
type LARight struct {
objectivec.Object
}
A grouped set of requirements that gate access to a resource or operation.
Overview ¶
Use LARight instances to protect access to portions of your app that may contain sensitive information. By default, LARight instances require people to authenticate with Face ID, Touch ID, Apple Watch, or the device passcode. The following creates an LARight with the default authentication requirements:
Authorizing a right ¶
- LARight.InitWithRequirement: Creates a right with the authentication requirements you supply.
- LARight.Tag: An integer you use to identify a right.
- LARight.SetTag
- LARight.AuthorizeWithLocalizedReasonCompletion: Performs an authorization on the right.
- LARight.AuthorizeWithLocalizedReasonInPresentationContextCompletion: Performs an authorization on the right with a window context you supply.
Deauthorizing a right ¶
- LARight.DeauthorizeWithCompletion: Invalidates a previously authorized right.
Monitoring authorization status ¶
- LARight.CheckCanAuthorizeWithCompletion: Checks whether the right has permission to perform authorization.
- LARight.State: The current authorization state for a right.
See: https://developer.apple.com/documentation/LocalAuthentication/LARight
func LARightFromID ¶
LARightFromID constructs a LARight from an objc.ID.
A grouped set of requirements that gate access to a resource or operation.
func NewRightWithRequirement ¶
func NewRightWithRequirement(requirement ILAAuthenticationRequirement) LARight
Creates a right with the authentication requirements you supply.
See: https://developer.apple.com/documentation/LocalAuthentication/LARight/init(requirement:)
func (LARight) AuthorizeWithLocalizedReasonCompletion ¶
func (r LARight) AuthorizeWithLocalizedReasonCompletion(localizedReason string, handler ErrorHandler)
Performs an authorization on the right.
localizedReason: A reason for the authorization that the system displays to the user.
handler: A completion handler called at the end of the authorization process.
`error`: If `nil`, the authorization is successful. Otherwise, the error contains information about the failure reason.
Discussion ¶
func (LARight) AuthorizeWithLocalizedReasonCompletionSync ¶
func (r LARight) AuthorizeWithLocalizedReasonCompletionSync(ctx context.Context, localizedReason string) error
AuthorizeWithLocalizedReasonCompletionSync is a synchronous wrapper around LARight.AuthorizeWithLocalizedReasonCompletion. It blocks until the completion handler fires or the context is cancelled.
func (LARight) AuthorizeWithLocalizedReasonInPresentationContextCompletion ¶
func (r LARight) AuthorizeWithLocalizedReasonInPresentationContextCompletion(localizedReason string, presentationContext unsafe.Pointer, handler ErrorHandler)
Performs an authorization on the right with a window context you supply.
Discussion ¶
func (LARight) AuthorizeWithLocalizedReasonInPresentationContextCompletionSync ¶
func (r LARight) AuthorizeWithLocalizedReasonInPresentationContextCompletionSync(ctx context.Context, localizedReason string, presentationContext unsafe.Pointer) error
AuthorizeWithLocalizedReasonInPresentationContextCompletionSync is a synchronous wrapper around LARight.AuthorizeWithLocalizedReasonInPresentationContextCompletion. It blocks until the completion handler fires or the context is cancelled.
func (LARight) Autorelease ¶
Autorelease adds the receiver to the current autorelease pool.
func (LARight) CheckCanAuthorize ¶
CheckCanAuthorize is a synchronous wrapper around LARight.CheckCanAuthorizeWithCompletion. It blocks until the completion handler fires or the context is cancelled.
func (LARight) CheckCanAuthorizeWithCompletion ¶
func (r LARight) CheckCanAuthorizeWithCompletion(handler ErrorHandler)
Checks whether the right has permission to perform authorization.
handler: A completion handler called when the authorization check finishes.
`error`: If `nil`, the right can be authorized.
Discussion ¶
See: https://developer.apple.com/documentation/LocalAuthentication/LARight/checkCanAuthorize(completion:)
func (LARight) Deauthorize ¶
Deauthorize is a synchronous wrapper around LARight.DeauthorizeWithCompletion. It blocks until the completion handler fires or the context is cancelled.
func (LARight) DeauthorizeWithCompletion ¶
func (r LARight) DeauthorizeWithCompletion(handler VoidHandler)
Invalidates a previously authorized right.
Discussion ¶
See: https://developer.apple.com/documentation/LocalAuthentication/LARight/deauthorize(completion:)
func (LARight) InitWithRequirement ¶
func (r LARight) InitWithRequirement(requirement ILAAuthenticationRequirement) LARight
Creates a right with the authentication requirements you supply.
See: https://developer.apple.com/documentation/LocalAuthentication/LARight/init(requirement:)
func (LARight) State ¶
func (r LARight) State() LARightState
The current authorization state for a right.
See: https://developer.apple.com/documentation/LocalAuthentication/LARight/state-swift.property
func (LARight) Tag ¶
An integer you use to identify a right.
See: https://developer.apple.com/documentation/LocalAuthentication/LARight/tag
type LARightClass ¶
type LARightClass struct {
// contains filtered or unexported fields
}
func GetLARightClass ¶
func GetLARightClass() LARightClass
GetLARightClass returns the class object for LARight.
func (LARightClass) Alloc ¶
func (lc LARightClass) Alloc() LARight
Alloc allocates memory for a new instance of the class.
func (LARightClass) Class ¶
func (lc LARightClass) Class() objc.Class
Class returns the underlying Objective-C class pointer.
type LARightState ¶
type LARightState int
See: https://developer.apple.com/documentation/LocalAuthentication/LARight/State-swift.enum
const ( // LARightStateAuthorized: The authorization completed successfully. LARightStateAuthorized LARightState = 2 // LARightStateAuthorizing: The authorization is in progress but not completed. LARightStateAuthorizing LARightState = 1 // LARightStateNotAuthorized: The authorization failed. LARightStateNotAuthorized LARightState = 3 // LARightStateUnknown: The authorization is in an unknown state. LARightStateUnknown LARightState = 0 )
func (LARightState) String ¶
func (e LARightState) String() string
type LARightStore ¶
type LARightStore struct {
objectivec.Object
}
A container for data protected by a right.
Overview ¶
Use an LARightStore along with an LARight to make secrets accessible only after certain conditions, including authentication, are met. Storing secrets this way lets you tie the availability of sensitive resources to the authorization status of the user.
The following stores a named access token behind the default authorization requirements:
The system stores your secret in the keychain and protects it with a unique key in the Secure Enclave. The system associates the key with your right and with an access control list that ensures that the data is only accessible after your access requirements are met.
You can retrieve stored secrets later using the right’s identifier:
Accessing rights ¶
- LARightStore.RightForIdentifierCompletion: Fetches a previously stored right from the shared right store.
Storing rights ¶
- LARightStore.SaveRightIdentifierCompletion: Saves a right to a persistent right store.
- LARightStore.SaveRightIdentifierSecretCompletion: Saves a right to a persistent store along with secret data you supply.
Removing stored rights ¶
- LARightStore.RemoveRightCompletion: Removes a right from the right store given an instance of that right.
- LARightStore.RemoveRightForIdentifierCompletion: Removes a right from the right store given its unique identifier.
- LARightStore.RemoveAllRightsWithCompletion: Removes all rights associated with this client from the right store.
See: https://developer.apple.com/documentation/LocalAuthentication/LARightStore
func LARightStoreFromID ¶
func LARightStoreFromID(id objc.ID) LARightStore
LARightStoreFromID constructs a LARightStore from an objc.ID.
A container for data protected by a right.
func NewLARightStore ¶
func NewLARightStore() LARightStore
NewLARightStore creates a new LARightStore instance.
func (LARightStore) Autorelease ¶
func (r LARightStore) Autorelease() LARightStore
Autorelease adds the receiver to the current autorelease pool.
func (LARightStore) RemoveAllRights ¶
func (r LARightStore) RemoveAllRights(ctx context.Context) error
RemoveAllRights is a synchronous wrapper around LARightStore.RemoveAllRightsWithCompletion. It blocks until the completion handler fires or the context is cancelled.
func (LARightStore) RemoveAllRightsWithCompletion ¶
func (r LARightStore) RemoveAllRightsWithCompletion(handler ErrorHandler)
Removes all rights associated with this client from the right store.
handler: A completion handler to call when the removal operation completes.
`error`: An error object that indicates why the removal operation failed, or `nil` if it succeeded.
Discussion ¶
Removing rights also removes any resources stored along with the rights, such as secrets.
func (LARightStore) RemoveRightCompletion ¶
func (r LARightStore) RemoveRightCompletion(right ILAPersistedRight, handler ErrorHandler)
Removes a right from the right store given an instance of that right.
right: An instance that represents the right to remove.
handler: A completion handler to call when the removal operation completes.
`error`: An error object that indicates why the removal operation failed, or `nil` if it succeeded.
Discussion ¶
Removing a right also removes any resources stored along with the right, such as secrets.
func (LARightStore) RemoveRightCompletionSync ¶
func (r LARightStore) RemoveRightCompletionSync(ctx context.Context, right ILAPersistedRight) error
RemoveRightCompletionSync is a synchronous wrapper around LARightStore.RemoveRightCompletion. It blocks until the completion handler fires or the context is cancelled.
func (LARightStore) RemoveRightForIdentifierCompletion ¶
func (r LARightStore) RemoveRightForIdentifierCompletion(identifier string, handler ErrorHandler)
Removes a right from the right store given its unique identifier.
identifier: The identifier for the right to remove.
handler: A completion handler to call when the removal operation completes.
`error`: An error object that indicates why the removal operation failed, or `nil` if it succeeded.
Discussion ¶
Removing a right also removes any resources stored along with the right, such as secrets.
func (LARightStore) RemoveRightForIdentifierCompletionSync ¶
func (r LARightStore) RemoveRightForIdentifierCompletionSync(ctx context.Context, identifier string) error
RemoveRightForIdentifierCompletionSync is a synchronous wrapper around LARightStore.RemoveRightForIdentifierCompletion. It blocks until the completion handler fires or the context is cancelled.
func (LARightStore) RightForIdentifierCompletion ¶
func (r LARightStore) RightForIdentifierCompletion(identifier string, handler LAPersistedRightErrorHandler)
Fetches a previously stored right from the shared right store.
identifier: The unique identifier of the right.
handler: A completion handler to call when the right access completes.
`right`: The right that matches the `identifier` you supply. `error`: An error object that indicates why the `right` parameter is `nil`, or `nil` if the right parameter is non-`nil`.
Discussion ¶
func (LARightStore) RightForIdentifierCompletionSync ¶
func (r LARightStore) RightForIdentifierCompletionSync(ctx context.Context, identifier string) (*LAPersistedRight, error)
RightForIdentifierCompletionSync is a synchronous wrapper around LARightStore.RightForIdentifierCompletion. It blocks until the completion handler fires or the context is cancelled.
func (LARightStore) SaveRightIdentifierCompletion ¶
func (r LARightStore) SaveRightIdentifierCompletion(right ILARight, identifier string, handler LAPersistedRightErrorHandler)
Saves a right to a persistent right store.
right: The right to store.
identifier: A unique identifier for the right.
handler: A completion handler to call when the save operation completes.
`right`: The persisted form of the right that the save operation stores. `error`: An error object that indicates why the `right` parameter is `nil`, or `nil` if the right parameter is non-`nil`.
Discussion ¶
func (LARightStore) SaveRightIdentifierCompletionSync ¶
func (r LARightStore) SaveRightIdentifierCompletionSync(ctx context.Context, right ILARight, identifier string) (*LAPersistedRight, error)
SaveRightIdentifierCompletionSync is a synchronous wrapper around LARightStore.SaveRightIdentifierCompletion. It blocks until the completion handler fires or the context is cancelled.
func (LARightStore) SaveRightIdentifierSecretCompletion ¶
func (r LARightStore) SaveRightIdentifierSecretCompletion(right ILARight, identifier string, secret foundation.NSData, handler LAPersistedRightErrorHandler)
Saves a right to a persistent store along with secret data you supply.
right: The right to store.
identifier: A unique identifier for the right.
secret: Secret data that’s stored with the right.
handler: A completion handler to call when the save operation completes.
`right`: The persisted form of the right that the save operation stores. `error`: An error object that indicates why the `right` parameter is `nil`, or `nil` if the right parameter is non-`nil`.
Discussion ¶
func (LARightStore) SaveRightIdentifierSecretCompletionSync ¶
func (r LARightStore) SaveRightIdentifierSecretCompletionSync(ctx context.Context, right ILARight, identifier string, secret foundation.NSData) (*LAPersistedRight, error)
SaveRightIdentifierSecretCompletionSync is a synchronous wrapper around LARightStore.SaveRightIdentifierSecretCompletion. It blocks until the completion handler fires or the context is cancelled.
type LARightStoreClass ¶
type LARightStoreClass struct {
// contains filtered or unexported fields
}
func GetLARightStoreClass ¶
func GetLARightStoreClass() LARightStoreClass
GetLARightStoreClass returns the class object for LARightStore.
func (LARightStoreClass) Alloc ¶
func (lc LARightStoreClass) Alloc() LARightStore
Alloc allocates memory for a new instance of the class.
func (LARightStoreClass) Class ¶
func (lc LARightStoreClass) Class() objc.Class
Class returns the underlying Objective-C class pointer.
func (LARightStoreClass) SharedStore ¶
func (_LARightStoreClass LARightStoreClass) SharedStore() LARightStore
A shared object that stores rights.
See: https://developer.apple.com/documentation/LocalAuthentication/LARightStore/shared
type LASecret ¶
type LASecret struct {
objectivec.Object
}
Data that’s protected by a persisted right.
Overview ¶
You create LASecret instances when you store an LAPersistedRight; you can’t create them directly.
Loading secret data ¶
- LASecret.LoadDataWithCompletion: Retrieves data stored in a secret.
See: https://developer.apple.com/documentation/LocalAuthentication/LASecret
func LASecretFromID ¶
LASecretFromID constructs a LASecret from an objc.ID.
Data that’s protected by a persisted right.
func (LASecret) Autorelease ¶
Autorelease adds the receiver to the current autorelease pool.
func (LASecret) LoadData ¶
LoadData is a synchronous wrapper around LASecret.LoadDataWithCompletion. It blocks until the completion handler fires or the context is cancelled.
func (LASecret) LoadDataWithCompletion ¶
func (s LASecret) LoadDataWithCompletion(handler DataErrorHandler)
Retrieves data stored in a secret.
handler: A completion handler that provides the data stored in a secret.
Discussion ¶
See: https://developer.apple.com/documentation/LocalAuthentication/LASecret/loadData(completion:)
type LASecretClass ¶
type LASecretClass struct {
// contains filtered or unexported fields
}
func GetLASecretClass ¶
func GetLASecretClass() LASecretClass
GetLASecretClass returns the class object for LASecret.
func (LASecretClass) Alloc ¶
func (lc LASecretClass) Alloc() LASecret
Alloc allocates memory for a new instance of the class.
func (LASecretClass) Class ¶
func (lc LASecretClass) Class() objc.Class
Class returns the underlying Objective-C class pointer.
type VoidHandler ¶
type VoidHandler = func()
VoidHandler is the signature for a completion handler block.
Used by:
Source Files
¶
- blocks.gen.go
- doc.gen.go
- enums.gen.go
- environment_observer_protocol.gen.go
- functions.gen.go
- generate.go
- global_vars.gen.go
- la_authentication_requirement.gen.go
- la_biometry_fallback_requirement.gen.go
- la_context.gen.go
- la_domain_state.gen.go
- la_domain_state_biometry.gen.go
- la_domain_state_companion.gen.go
- la_environment.gen.go
- la_environment_mechanism.gen.go
- la_environment_mechanism_biometry.gen.go
- la_environment_mechanism_companion.gen.go
- la_environment_mechanism_user_password.gen.go
- la_environment_state.gen.go
- la_persisted_right.gen.go
- la_private_key.gen.go
- la_public_key.gen.go
- la_right.gen.go
- la_right_store.gen.go
- la_secret.gen.go
- types.gen.go
- undefined_types.gen.go