Documentation
¶
Overview ¶
Package localauthentication binds LAContext of Apple's LocalAuthentication framework without cgo, to authenticate the user with Touch ID or the device password.
It works only on macOS.
Index ¶
- Variables
- type Code
- type Context
- func (c *Context) CFTypeRef() uintptr
- func (c *Context) CanEvaluatePolicy(policy Policy) error
- func (c *Context) EvaluatePolicy(policy Policy, reason string) error
- func (c *Context) Invalidate()
- func (c *Context) SetLocalizedCancelTitle(title string)
- func (c *Context) SetLocalizedFallbackTitle(title string)
- func (c *Context) SetTouchIDAuthenticationAllowableReuseDuration(d time.Duration)
- type Error
- type Policy
Constants ¶
This section is empty.
Variables ¶
ErrUnavailable reports a function or class missing from the running macOS.
Functions ¶
This section is empty.
Types ¶
type Code ¶
type Code int
Code is an LAError code. It can be compared with an *Error through errors.Is.
const ( ErrAuthenticationFailed Code = -1 ErrUserCancel Code = -2 ErrUserFallback Code = -3 ErrSystemCancel Code = -4 ErrPasscodeNotSet Code = -5 ErrBiometryNotAvailable Code = -6 ErrBiometryNotEnrolled Code = -7 ErrBiometryLockout Code = -8 ErrAppCancel Code = -9 ErrInvalidContext Code = -10 ErrCompanionNotAvailable Code = -11 ErrBiometryNotPaired Code = -12 ErrBiometryDisconnected Code = -13 ErrInvalidDimensions Code = -14 ErrNotInteractive Code = -1004 )
type Context ¶
type Context struct {
// contains filtered or unexported fields
}
Context is an LAContext. It is released when it becomes unreachable.
func (*Context) CFTypeRef ¶
CFTypeRef returns the underlying LAContext, such as for calls through purego/objc. The caller must keep c reachable while using it. Pass c itself as the value of security.UseAuthenticationContext.
func (*Context) CanEvaluatePolicy ¶
CanEvaluatePolicy calls canEvaluatePolicy:error: and returns nil when the policy can be evaluated.
func (*Context) EvaluatePolicy ¶
EvaluatePolicy calls evaluatePolicy:localizedReason:reply: and waits for the reply. It returns nil when the user is authenticated.
func (*Context) Invalidate ¶
func (c *Context) Invalidate()
Invalidate calls invalidate, which cancels a pending evaluation.
func (*Context) SetLocalizedCancelTitle ¶
SetLocalizedCancelTitle sets localizedCancelTitle.
func (*Context) SetLocalizedFallbackTitle ¶
SetLocalizedFallbackTitle sets localizedFallbackTitle. An empty title hides the fallback button.
func (*Context) SetTouchIDAuthenticationAllowableReuseDuration ¶
SetTouchIDAuthenticationAllowableReuseDuration sets touchIDAuthenticationAllowableReuseDuration.