@symbiote-native/local-auth 1.0.0 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +76 -71
- package/package.json +14 -14
package/README.md
CHANGED
|
@@ -15,6 +15,10 @@ re-exports of the same `core`.
|
|
|
15
15
|
npm install @symbiote-native/local-auth
|
|
16
16
|
```
|
|
17
17
|
|
|
18
|
+
Scaffolding or extending a SymbioteNative app? `npx @symbiote-native/cli new --local-auth` (or
|
|
19
|
+
`add --local-auth` in an existing app) installs and wires this for you — see
|
|
20
|
+
[`@symbiote-native/cli`](../cli).
|
|
21
|
+
|
|
18
22
|
`expo-local-authentication` and `expo-modules-core` come along as regular dependencies, pinned
|
|
19
23
|
to exact versions — never install either yourself, and never add the `expo` meta-package to
|
|
20
24
|
your project (it bundles its own Metro/Babel pipeline, which conflicts with this project's own).
|
|
@@ -65,7 +69,7 @@ src/angular/ @symbiote-native/local-auth/angular — export * from '../core'
|
|
|
65
69
|
```tsx
|
|
66
70
|
// React
|
|
67
71
|
import { useEffect, useState } from 'react';
|
|
68
|
-
import { Platform
|
|
72
|
+
import { Platform } from '@symbiote-native/react';
|
|
69
73
|
import {
|
|
70
74
|
authenticateAsync,
|
|
71
75
|
cancelAuthenticate,
|
|
@@ -92,26 +96,26 @@ function LocalAuthScreen() {
|
|
|
92
96
|
};
|
|
93
97
|
|
|
94
98
|
return (
|
|
95
|
-
<
|
|
96
|
-
<
|
|
99
|
+
<view>
|
|
100
|
+
<text>
|
|
97
101
|
{hasHardware && isEnrolled
|
|
98
102
|
? 'Ready to authenticate'
|
|
99
103
|
: 'No biometrics enrolled'}
|
|
100
|
-
</
|
|
101
|
-
<
|
|
102
|
-
<
|
|
103
|
-
</
|
|
104
|
+
</text>
|
|
105
|
+
<pressable onPress={handleAuthenticate}>
|
|
106
|
+
<text>Authenticate</text>
|
|
107
|
+
</pressable>
|
|
104
108
|
{Platform.OS === 'android' && (
|
|
105
|
-
<
|
|
106
|
-
<
|
|
107
|
-
</
|
|
109
|
+
<pressable onPress={() => cancelAuthenticate()}>
|
|
110
|
+
<text>Cancel</text>
|
|
111
|
+
</pressable>
|
|
108
112
|
)}
|
|
109
113
|
{authResult && (
|
|
110
|
-
<
|
|
114
|
+
<text>
|
|
111
115
|
{authResult.success ? 'Success' : `Failed: ${authResult.error}`}
|
|
112
|
-
</
|
|
116
|
+
</text>
|
|
113
117
|
)}
|
|
114
|
-
</
|
|
118
|
+
</view>
|
|
115
119
|
);
|
|
116
120
|
}
|
|
117
121
|
```
|
|
@@ -120,7 +124,7 @@ function LocalAuthScreen() {
|
|
|
120
124
|
<!-- Vue -->
|
|
121
125
|
<script setup lang="ts">
|
|
122
126
|
import { onMounted, ref } from 'vue';
|
|
123
|
-
import { Platform
|
|
127
|
+
import { Platform } from '@symbiote-native/vue';
|
|
124
128
|
import {
|
|
125
129
|
authenticateAsync,
|
|
126
130
|
cancelAuthenticate,
|
|
@@ -146,29 +150,29 @@ function handleAuthenticate(): void {
|
|
|
146
150
|
</script>
|
|
147
151
|
|
|
148
152
|
<template>
|
|
149
|
-
<
|
|
150
|
-
<
|
|
153
|
+
<view>
|
|
154
|
+
<text>{{
|
|
151
155
|
hasHardware && isEnrolled
|
|
152
156
|
? 'Ready to authenticate'
|
|
153
157
|
: 'No biometrics enrolled'
|
|
154
|
-
}}</
|
|
155
|
-
<
|
|
156
|
-
<
|
|
157
|
-
</
|
|
158
|
-
<
|
|
159
|
-
<
|
|
160
|
-
</
|
|
161
|
-
<
|
|
158
|
+
}}</text>
|
|
159
|
+
<pressable @press="handleAuthenticate">
|
|
160
|
+
<text>Authenticate</text>
|
|
161
|
+
</pressable>
|
|
162
|
+
<pressable v-if="Platform.OS === 'android'" @press="cancelAuthenticate">
|
|
163
|
+
<text>Cancel</text>
|
|
164
|
+
</pressable>
|
|
165
|
+
<text v-if="authResult">{{
|
|
162
166
|
authResult.success ? 'Success' : `Failed: ${authResult.error}`
|
|
163
|
-
}}</
|
|
164
|
-
</
|
|
167
|
+
}}</text>
|
|
168
|
+
</view>
|
|
165
169
|
</template>
|
|
166
170
|
```
|
|
167
171
|
|
|
168
172
|
```svelte
|
|
169
173
|
<!-- Svelte -->
|
|
170
174
|
<script lang="ts">
|
|
171
|
-
import { Platform
|
|
175
|
+
import { Platform } from '@symbiote-native/svelte';
|
|
172
176
|
import {
|
|
173
177
|
authenticateAsync,
|
|
174
178
|
cancelAuthenticate,
|
|
@@ -193,28 +197,31 @@ function handleAuthenticate(): void {
|
|
|
193
197
|
}
|
|
194
198
|
</script>
|
|
195
199
|
|
|
196
|
-
<
|
|
197
|
-
<
|
|
198
|
-
{hasHardware && isEnrolled
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
200
|
+
<view>
|
|
201
|
+
<text>
|
|
202
|
+
{hasHardware && isEnrolled
|
|
203
|
+
? 'Ready to authenticate'
|
|
204
|
+
: 'No biometrics enrolled'}
|
|
205
|
+
</text>
|
|
206
|
+
<pressable onPress={handleAuthenticate}>
|
|
207
|
+
<text>Authenticate</text>
|
|
208
|
+
</pressable>
|
|
203
209
|
{#if Platform.OS === 'android'}
|
|
204
|
-
<
|
|
205
|
-
<
|
|
206
|
-
</
|
|
210
|
+
<pressable onPress={() => cancelAuthenticate()}>
|
|
211
|
+
<text>Cancel</text>
|
|
212
|
+
</pressable>
|
|
207
213
|
{/if}
|
|
208
214
|
{#if authResult}
|
|
209
|
-
<
|
|
215
|
+
<text>{authResult.success ? 'Success' : `Failed: ${authResult.error}`}</text
|
|
216
|
+
>
|
|
210
217
|
{/if}
|
|
211
|
-
</
|
|
218
|
+
</view>
|
|
212
219
|
```
|
|
213
220
|
|
|
214
221
|
```tsx
|
|
215
222
|
// Solid
|
|
216
223
|
import { Show, createSignal, onMount } from 'solid-js';
|
|
217
|
-
import { Platform
|
|
224
|
+
import { Platform } from '@symbiote-native/solid';
|
|
218
225
|
import {
|
|
219
226
|
authenticateAsync,
|
|
220
227
|
cancelAuthenticate,
|
|
@@ -241,28 +248,26 @@ function LocalAuthScreen() {
|
|
|
241
248
|
};
|
|
242
249
|
|
|
243
250
|
return (
|
|
244
|
-
<
|
|
245
|
-
<
|
|
251
|
+
<view>
|
|
252
|
+
<text>
|
|
246
253
|
{hasHardware() && isEnrolled()
|
|
247
254
|
? 'Ready to authenticate'
|
|
248
255
|
: 'No biometrics enrolled'}
|
|
249
|
-
</
|
|
250
|
-
<
|
|
251
|
-
<
|
|
252
|
-
</
|
|
256
|
+
</text>
|
|
257
|
+
<pressable onPress={handleAuthenticate}>
|
|
258
|
+
<text>Authenticate</text>
|
|
259
|
+
</pressable>
|
|
253
260
|
{Platform.OS === 'android' && (
|
|
254
|
-
<
|
|
255
|
-
<
|
|
256
|
-
</
|
|
261
|
+
<pressable onPress={() => cancelAuthenticate()}>
|
|
262
|
+
<text>Cancel</text>
|
|
263
|
+
</pressable>
|
|
257
264
|
)}
|
|
258
265
|
<Show when={authResult()} keyed>
|
|
259
266
|
{result => (
|
|
260
|
-
<
|
|
261
|
-
{result.success ? 'Success' : `Failed: ${result.error}`}
|
|
262
|
-
</Text>
|
|
267
|
+
<text>{result.success ? 'Success' : `Failed: ${result.error}`}</text>
|
|
263
268
|
)}
|
|
264
269
|
</Show>
|
|
265
|
-
</
|
|
270
|
+
</view>
|
|
266
271
|
);
|
|
267
272
|
}
|
|
268
273
|
```
|
|
@@ -270,7 +275,7 @@ function LocalAuthScreen() {
|
|
|
270
275
|
```ts
|
|
271
276
|
// Angular
|
|
272
277
|
import { Component, signal } from '@angular/core';
|
|
273
|
-
import { Platform,
|
|
278
|
+
import { Platform, SYMBIOTE_ELEMENTS } from '@symbiote-native/angular';
|
|
274
279
|
import {
|
|
275
280
|
authenticateAsync,
|
|
276
281
|
cancelAuthenticate,
|
|
@@ -281,28 +286,28 @@ import type { ILocalAuthenticationResult } from '@symbiote-native/local-auth/ang
|
|
|
281
286
|
|
|
282
287
|
@Component({
|
|
283
288
|
standalone: true,
|
|
284
|
-
imports: [
|
|
289
|
+
imports: [SYMBIOTE_ELEMENTS],
|
|
285
290
|
template: `
|
|
286
|
-
<
|
|
287
|
-
<
|
|
291
|
+
<view>
|
|
292
|
+
<text>{{
|
|
288
293
|
hasHardware() && isEnrolled()
|
|
289
294
|
? 'Ready to authenticate'
|
|
290
295
|
: 'No biometrics enrolled'
|
|
291
|
-
}}</
|
|
292
|
-
<
|
|
293
|
-
<
|
|
294
|
-
</
|
|
296
|
+
}}</text>
|
|
297
|
+
<pressable (press)="handleAuthenticate()">
|
|
298
|
+
<text>Authenticate</text>
|
|
299
|
+
</pressable>
|
|
295
300
|
@if (Platform.OS === 'android') {
|
|
296
|
-
<
|
|
297
|
-
<
|
|
298
|
-
</
|
|
301
|
+
<pressable (press)="handleCancel()">
|
|
302
|
+
<text>Cancel</text>
|
|
303
|
+
</pressable>
|
|
299
304
|
}
|
|
300
305
|
@if (authResult(); as result) {
|
|
301
|
-
<
|
|
306
|
+
<text>{{
|
|
302
307
|
result.success ? 'Success' : 'Failed: ' + result.error
|
|
303
|
-
}}</
|
|
308
|
+
}}</text>
|
|
304
309
|
}
|
|
305
|
-
</
|
|
310
|
+
</view>
|
|
306
311
|
`,
|
|
307
312
|
})
|
|
308
313
|
export class LocalAuthScreen {
|
|
@@ -329,13 +334,13 @@ export class LocalAuthScreen {
|
|
|
329
334
|
```
|
|
330
335
|
|
|
331
336
|
There's no per-instance service to `inject()` in the Angular case — every function is a plain
|
|
332
|
-
free function off the core package, called straight from the constructor. The
|
|
333
|
-
|
|
337
|
+
free function off the core package, called straight from the constructor. The examples above are
|
|
338
|
+
trimmed from the real canary demo screens, which exist for all six Expo canaries
|
|
334
339
|
(`examples/expo-react/screens/LocalAuthScreen.tsx`,
|
|
335
340
|
`examples/expo-vue-sfc/screens/LocalAuthScreen.vue`, `examples/expo-vue-tsx/screens/LocalAuthScreen.tsx`,
|
|
341
|
+
`examples/expo-svelte/screens/LocalAuthScreen.svelte`, `examples/expo-solid/screens/LocalAuthScreen.tsx`,
|
|
336
342
|
`examples/expo-angular/src/screens/LocalAuthScreen.ts`), which also cover
|
|
337
|
-
`getEnrolledLevelAsync`/`supportedAuthenticationTypesAsync` and render a capabilities card.
|
|
338
|
-
canary demo screen exists yet for Svelte/Solid — the two snippets above follow the same surface.
|
|
343
|
+
`getEnrolledLevelAsync`/`supportedAuthenticationTypesAsync` and render a capabilities card.
|
|
339
344
|
|
|
340
345
|
## API
|
|
341
346
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@symbiote-native/local-auth",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"description": "expo-local-authentication wrapped for SymbioteNative — one framework-agnostic core, built once and reachable from the React, Vue, Svelte, Solid, and Angular adapters. FaceID/TouchID on iOS, the Fingerprint/Biometric API on Android.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -81,12 +81,12 @@
|
|
|
81
81
|
"solid-js": ">=1.9.0",
|
|
82
82
|
"svelte": ">=5.56.0",
|
|
83
83
|
"vue": ">=3.5.0",
|
|
84
|
-
"@symbiote-native/angular": "^
|
|
85
|
-
"@symbiote-native/engine": "^0.
|
|
86
|
-
"@symbiote-native/react": "^
|
|
87
|
-
"@symbiote-native/solid": "^
|
|
88
|
-
"@symbiote-native/svelte": "^
|
|
89
|
-
"@symbiote-native/vue": "^
|
|
84
|
+
"@symbiote-native/angular": "^3.0.0",
|
|
85
|
+
"@symbiote-native/engine": "^1.0.0",
|
|
86
|
+
"@symbiote-native/react": "^3.0.0",
|
|
87
|
+
"@symbiote-native/solid": "^3.0.0",
|
|
88
|
+
"@symbiote-native/svelte": "^3.0.0",
|
|
89
|
+
"@symbiote-native/vue": "^3.0.0"
|
|
90
90
|
},
|
|
91
91
|
"peerDependenciesMeta": {
|
|
92
92
|
"@symbiote-native/angular": {
|
|
@@ -135,13 +135,13 @@
|
|
|
135
135
|
"solid-js": "^1.9.14",
|
|
136
136
|
"svelte": "^5.56.0",
|
|
137
137
|
"typescript": "~6.0.0",
|
|
138
|
-
"@symbiote-native/angular": "
|
|
139
|
-
"@symbiote-native/engine": "0.
|
|
140
|
-
"@symbiote-native/react": "
|
|
141
|
-
"@symbiote-native/solid": "
|
|
142
|
-
"@symbiote-native/svelte": "
|
|
143
|
-
"@symbiote-native/test-utils": "0.3.
|
|
144
|
-
"@symbiote-native/vue": "
|
|
138
|
+
"@symbiote-native/angular": "3.0.0",
|
|
139
|
+
"@symbiote-native/engine": "1.0.0",
|
|
140
|
+
"@symbiote-native/react": "3.0.0",
|
|
141
|
+
"@symbiote-native/solid": "3.0.0",
|
|
142
|
+
"@symbiote-native/svelte": "3.0.0",
|
|
143
|
+
"@symbiote-native/test-utils": "0.3.1",
|
|
144
|
+
"@symbiote-native/vue": "3.0.0"
|
|
145
145
|
},
|
|
146
146
|
"scripts": {
|
|
147
147
|
"typecheck": "tsc --build",
|