@nacrejs/local-authentication
v0.0.1
Published
Nacre 的面容 ID / 触控 ID 认证能力:LAContext。装了才有
Readme
@nacrejs/local-authentication
A capability package for Nacre, a JavaScript runtime for iOS apps: Face ID and Touch ID authentication. It provides LAContext. The app has it only if the project installs this package.
Install
In a Nacre project, three steps.
1. Install the package.
npm install @nacrejs/local-authentication2. Bring in its types at the top of the entry file.
/// <reference types="@nacrejs/types" />
/// <reference types="@nacrejs/local-authentication" />3. Write its usage description in nacre.config.json.
{
"ios": {
"infoPlist": {
"NSFaceIDUsageDescription": "Used to unlock your account"
}
}
}NSFaceIDUsageDescription is the sentence iOS shows the user when the app uses Face ID for the first time. Only you can write it, so the package doesn't ship one. If it's missing, nacre generate stops with an error that names the key. See Writing usage descriptions.
Effect: after you regenerate ios/ and rebuild, the app includes this capability, and typeof LAContext !== 'undefined' is true.
Without the package, its classes don't exist: reading one throws ReferenceError, and type checking reports it first.
For how to use it, see LAContext. For all capability packages, see Core and capability packages.
License
FSL-1.1-MIT, see LICENSE.md.
