@octane-xplat/biometrics 0.18.0 → 0.20.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 +2 -46
- package/package.json +90 -91
- package/src/biometrics.macos.ts +118 -114
- package/src/biometrics.ts +45 -42
- package/src/biometrics.web.ts +8 -8
- package/src/types.ts +10 -5
- package/types/generated/.tsrx-typegen-manifest.json +0 -3
- package/types/generated/biometrics.d.ts +1 -0
- package/types/generated/types.d.ts +5 -0
- package/LICENSE +0 -21
- package/types/generated/biometrics.macos.d.ts +0 -3
- package/types/generated/biometrics.web.d.ts +0 -3
- package/types/generated/index.macos.d.ts +0 -2
package/README.md
CHANGED
|
@@ -1,49 +1,5 @@
|
|
|
1
1
|
# `@octane-xplat/biometrics`
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
pnpm add @octane-xplat/biometrics
|
|
5
|
-
```
|
|
3
|
+
[Documentation](https://octane-xplat.goddardai.org/package-biometrics).
|
|
6
4
|
|
|
7
|
-
|
|
8
|
-
credential — behind one capability object. iOS and Android run
|
|
9
|
-
`@nativescript/biometrics`; macOS AppKit uses Apple LocalAuthentication
|
|
10
|
-
for Touch ID. Web reports `supported: false` because WebAuthn requires
|
|
11
|
-
a registered credential and an authentication ceremony.
|
|
12
|
-
|
|
13
|
-
```ts
|
|
14
|
-
import { biometrics } from '@octane-xplat/biometrics'
|
|
15
|
-
|
|
16
|
-
if ((await biometrics.requestPermissions()).granted) {
|
|
17
|
-
const ok = await biometrics.verify('Unlock your saved trips')
|
|
18
|
-
}
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
The shared service contract: `supported` reports whether an
|
|
22
|
-
implementation exists on this target — branch on it rather than catching —
|
|
23
|
-
`getPermissions()`/`requestPermissions()` resolve
|
|
24
|
-
`{status: 'granted' | 'denied' | 'unsupported', granted, canAskAgain}`.
|
|
25
|
-
`verify(reason)` resolves `false` for a declined
|
|
26
|
-
or failed prompt rather than throwing.
|
|
27
|
-
|
|
28
|
-
On macOS, availability checks do not open a prompt. Missing hardware,
|
|
29
|
-
enrollment, pairing, or a connected sensor returns `unsupported`; lockout
|
|
30
|
-
or an interaction restriction returns `denied`. A host without the Objective-C
|
|
31
|
-
LocalAuthentication bridge reports `supported: false` and `verify()` rejects
|
|
32
|
-
`UnavailabilityError`.
|
|
33
|
-
Verification uses biometrics only, hides password fallback, and returns
|
|
34
|
-
`false` on cancellation, failure, or an overlapping prompt.
|
|
35
|
-
|
|
36
|
-
```ts
|
|
37
|
-
import { biometrics } from '@octane-xplat/biometrics'
|
|
38
|
-
|
|
39
|
-
const availability = await biometrics.requestPermissions()
|
|
40
|
-
if (availability.granted) {
|
|
41
|
-
const verified = await biometrics.verify('Unlock your saved trips')
|
|
42
|
-
console.log(verified ? 'Unlocked' : 'Still locked')
|
|
43
|
-
}
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
Guide: [Using device features](../../docs/platform/platform-services.md);
|
|
47
|
-
per-target availability: [platform notes](../../.agents/docs/notes/platform-notes.md).
|
|
48
|
-
Exercised by the harness `Services` screen
|
|
49
|
-
([`packages/app/src/Services.tsrx`](../app/src/Services.tsrx)).
|
|
5
|
+
[API reference](https://octane-xplat.goddardai.org/api-biometrics).
|
package/package.json
CHANGED
|
@@ -1,92 +1,91 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
}
|
|
2
|
+
"name": "@octane-xplat/biometrics",
|
|
3
|
+
"version": "0.20.0",
|
|
4
|
+
"description": "Biometric verification (FaceID/TouchID/fingerprint) for Octane xplat — matching web + NativeScript implementations",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"android",
|
|
7
|
+
"biometrics",
|
|
8
|
+
"cross-platform",
|
|
9
|
+
"faceid",
|
|
10
|
+
"fingerprint",
|
|
11
|
+
"ios",
|
|
12
|
+
"nativescript",
|
|
13
|
+
"octane",
|
|
14
|
+
"touchid",
|
|
15
|
+
"web",
|
|
16
|
+
"xplat"
|
|
17
|
+
],
|
|
18
|
+
"homepage": "https://github.com/octane-xplat/octane-xplat/tree/main/packages/biometrics",
|
|
19
|
+
"license": "MIT",
|
|
20
|
+
"repository": {
|
|
21
|
+
"type": "git",
|
|
22
|
+
"url": "https://github.com/octane-xplat/octane-xplat",
|
|
23
|
+
"directory": "packages/biometrics"
|
|
24
|
+
},
|
|
25
|
+
"files": [
|
|
26
|
+
"src",
|
|
27
|
+
"types",
|
|
28
|
+
"!src/**/*.test.*",
|
|
29
|
+
"!src/**/*.spec.*"
|
|
30
|
+
],
|
|
31
|
+
"type": "module",
|
|
32
|
+
"exports": {
|
|
33
|
+
".": {
|
|
34
|
+
"types": "./types/generated/index.d.ts",
|
|
35
|
+
"macos": "./src/index.macos.ts",
|
|
36
|
+
"default": "./src/index.ts"
|
|
37
|
+
},
|
|
38
|
+
"./*": {
|
|
39
|
+
"types": "./types/generated/*.d.ts",
|
|
40
|
+
"default": "./src/*"
|
|
41
|
+
},
|
|
42
|
+
"./*.ts": {
|
|
43
|
+
"types": "./types/generated/*.d.ts",
|
|
44
|
+
"default": "./src/*.ts"
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
"publishConfig": {
|
|
48
|
+
"access": "public"
|
|
49
|
+
},
|
|
50
|
+
"scripts": {
|
|
51
|
+
"test:packed": "node tests/packed-consumer.mjs",
|
|
52
|
+
"test": "node --test tests/*.test.mjs",
|
|
53
|
+
"test:macos-runtime": "node ../../apps/macos/test/verify-biometrics.mjs",
|
|
54
|
+
"typegen": "tsrx-typegen --project tsconfig.types.json",
|
|
55
|
+
"prepack": "bun run typegen && tsrx-typegen --pack-check",
|
|
56
|
+
"pack:check": "tsrx-typegen --pack-check"
|
|
57
|
+
},
|
|
58
|
+
"dependencies": {
|
|
59
|
+
"@nativescript/biometrics": "1.3.1",
|
|
60
|
+
"@octane-xplat/lib": "0.20.0"
|
|
61
|
+
},
|
|
62
|
+
"devDependencies": {
|
|
63
|
+
"@nativescript-community/octane": "0.2.5",
|
|
64
|
+
"@nativescript/core": "9.1.3",
|
|
65
|
+
"@nativescript/types": "9.1.4",
|
|
66
|
+
"octane": "0.16.3",
|
|
67
|
+
"tsrx-typegen": "0.6.1",
|
|
68
|
+
"typescript": "7.1.0-beta",
|
|
69
|
+
"@tsrx/content-mapper": "0.1.2",
|
|
70
|
+
"typescript-classic": "npm:typescript@5.9.3"
|
|
71
|
+
},
|
|
72
|
+
"peerDependencies": {
|
|
73
|
+
"@nativescript-community/octane": ">=0.2.1 <1",
|
|
74
|
+
"@nativescript/core": ">=9.1.0 <10",
|
|
75
|
+
"octane": ">=0.6.3 <1"
|
|
76
|
+
},
|
|
77
|
+
"peerDependenciesMeta": {
|
|
78
|
+
"@nativescript-community/octane": {
|
|
79
|
+
"optional": true
|
|
80
|
+
},
|
|
81
|
+
"@nativescript/core": {
|
|
82
|
+
"optional": true
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
"nativescript": {
|
|
86
|
+
"platforms": {
|
|
87
|
+
"android": "9.1.0",
|
|
88
|
+
"ios": "9.1.0"
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
package/src/biometrics.macos.ts
CHANGED
|
@@ -8,14 +8,14 @@ declare const interop: { Reference: new () => { value?: { domain: string; code:
|
|
|
8
8
|
declare const LAContext: { new: () => AuthenticationContext }
|
|
9
9
|
|
|
10
10
|
interface AuthenticationContext {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
11
|
+
localizedFallbackTitle: string
|
|
12
|
+
canEvaluatePolicyError(policy: number, error: InstanceType<typeof interop.Reference>): boolean
|
|
13
|
+
evaluatePolicyLocalizedReasonReply(
|
|
14
|
+
policy: number,
|
|
15
|
+
reason: string,
|
|
16
|
+
reply: (success: boolean, error: unknown) => void,
|
|
17
|
+
): void
|
|
18
|
+
invalidate(): void
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
// LAPolicyDeviceOwnerAuthenticationWithBiometrics: do not silently substitute
|
|
@@ -23,130 +23,134 @@ interface AuthenticationContext {
|
|
|
23
23
|
const biometricPolicy = 1
|
|
24
24
|
|
|
25
25
|
function frameworkAvailable(): boolean {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
26
|
+
try {
|
|
27
|
+
objc.import('LocalAuthentication')
|
|
28
|
+
} catch {
|
|
29
|
+
// Some hosts have already bound the symbols; others cannot provide them.
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return (
|
|
33
|
+
typeof LAContext !== 'undefined' &&
|
|
34
|
+
typeof interop !== 'undefined' &&
|
|
35
|
+
typeof interop.Reference !== 'undefined'
|
|
36
|
+
)
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
function availability(context: AuthenticationContext): 'granted' | 'denied' | 'unsupported' {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
40
|
+
const error = new interop.Reference()
|
|
41
|
+
|
|
42
|
+
if (context.canEvaluatePolicyError(biometricPolicy, error)) {
|
|
43
|
+
return 'granted'
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// Missing hardware (-6), enrollment (-7), pairing (-12) or a connected
|
|
47
|
+
// sensor (-13) is absence, not a permission denial.
|
|
48
|
+
// Lockout (-8), interaction restrictions and other failures remain denied.
|
|
49
|
+
return error.value?.domain === 'com.apple.LocalAuthentication' &&
|
|
50
|
+
[-6, -7, -12, -13].includes(Number(error.value.code))
|
|
51
|
+
? 'unsupported'
|
|
52
|
+
: 'denied'
|
|
52
53
|
}
|
|
53
54
|
|
|
54
55
|
function invalidate(context: AuthenticationContext | null): void {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
56
|
+
try {
|
|
57
|
+
context?.invalidate()
|
|
58
|
+
} catch {
|
|
59
|
+
// Cleanup must not turn a failed authentication into a rejected promise.
|
|
60
|
+
}
|
|
60
61
|
}
|
|
61
62
|
|
|
62
63
|
// Root both the context and callback until completion; native callbacks may
|
|
63
64
|
// outlive the JS call. Refuse concurrent prompts rather than canceling one.
|
|
64
65
|
let active: {
|
|
65
|
-
|
|
66
|
-
|
|
66
|
+
context: AuthenticationContext | null
|
|
67
|
+
reply: ((success: boolean, error: unknown) => void) | null
|
|
67
68
|
} | null = null
|
|
68
69
|
|
|
69
70
|
const implementation: BiometricsImpl = {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
71
|
+
verify(reason) {
|
|
72
|
+
if (active || !frameworkAvailable() || typeof reason !== 'string' || !reason.trim()) {
|
|
73
|
+
return Promise.resolve(false)
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
const operation = {
|
|
77
|
+
context: null as AuthenticationContext | null,
|
|
78
|
+
reply: null as ((success: boolean, error: unknown) => void) | null,
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
active = operation
|
|
82
|
+
return new Promise<boolean>((resolve) => {
|
|
83
|
+
let settled = false
|
|
84
|
+
const finish = (success: boolean) => {
|
|
85
|
+
if (settled) {
|
|
86
|
+
return
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
settled = true
|
|
90
|
+
if (active === operation) {
|
|
91
|
+
active = null
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
invalidate(operation.context)
|
|
95
|
+
operation.context = null
|
|
96
|
+
operation.reply = null
|
|
97
|
+
resolve(success)
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
try {
|
|
101
|
+
operation.context = LAContext.new()
|
|
102
|
+
if (availability(operation.context) !== 'granted') {
|
|
103
|
+
finish(false)
|
|
104
|
+
return
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
operation.context.localizedFallbackTitle = ''
|
|
108
|
+
operation.reply = (success, error) => finish(Boolean(success) && !error)
|
|
109
|
+
operation.context.evaluatePolicyLocalizedReasonReply(
|
|
110
|
+
biometricPolicy,
|
|
111
|
+
reason,
|
|
112
|
+
operation.reply,
|
|
113
|
+
)
|
|
114
|
+
} catch {
|
|
115
|
+
finish(false)
|
|
116
|
+
}
|
|
117
|
+
})
|
|
118
|
+
},
|
|
118
119
|
}
|
|
119
120
|
|
|
120
121
|
const ensure = async (): Promise<PermissionResponse> => {
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
122
|
+
if (!frameworkAvailable()) {
|
|
123
|
+
return { status: 'unsupported', granted: false, canAskAgain: false }
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
let context: AuthenticationContext | null = null
|
|
127
|
+
|
|
128
|
+
try {
|
|
129
|
+
context = LAContext.new()
|
|
130
|
+
|
|
131
|
+
const status = availability(context)
|
|
132
|
+
|
|
133
|
+
return {
|
|
134
|
+
status,
|
|
135
|
+
granted: status === 'granted',
|
|
136
|
+
canAskAgain: status === 'granted',
|
|
137
|
+
}
|
|
138
|
+
} catch {
|
|
139
|
+
return { status: 'denied', granted: false, canAskAgain: false }
|
|
140
|
+
} finally {
|
|
141
|
+
invalidate(context)
|
|
142
|
+
}
|
|
139
143
|
}
|
|
140
144
|
|
|
141
145
|
export const biometrics: Permissioned<BiometricsImpl> = {
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
146
|
+
get supported() {
|
|
147
|
+
return frameworkAvailable()
|
|
148
|
+
},
|
|
149
|
+
isAvailable: async () => frameworkAvailable(),
|
|
150
|
+
getPermissions: ensure,
|
|
151
|
+
requestPermissions: ensure,
|
|
152
|
+
verify: (reason) =>
|
|
153
|
+
frameworkAvailable()
|
|
154
|
+
? implementation.verify(reason)
|
|
155
|
+
: Promise.reject(new UnavailabilityError('biometrics')),
|
|
152
156
|
}
|
package/src/biometrics.ts
CHANGED
|
@@ -13,49 +13,52 @@ const bio = new BiometricAuth()
|
|
|
13
13
|
let verifying = false
|
|
14
14
|
|
|
15
15
|
const available = async (): Promise<PermissionResponse> => {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
16
|
+
try {
|
|
17
|
+
const r = await bio.available()
|
|
18
|
+
// Android reports `any` for a secure lockscreen without biometrics —
|
|
19
|
+
// verify() requires BIOMETRIC_STRONG, so that state is not usable.
|
|
20
|
+
const usable = !!(r.any && (isIOS || r.biometrics))
|
|
21
|
+
|
|
22
|
+
return {
|
|
23
|
+
status: usable ? 'granted' : 'unsupported',
|
|
24
|
+
granted: usable,
|
|
25
|
+
canAskAgain: usable,
|
|
26
|
+
}
|
|
27
|
+
} catch {
|
|
28
|
+
// Android rejects when the device lacks biometric hardware,
|
|
29
|
+
// enrollment, or a secure lockscreen — absence, not an error.
|
|
30
|
+
return { status: 'unsupported', granted: false, canAskAgain: false }
|
|
31
|
+
}
|
|
31
32
|
}
|
|
32
33
|
|
|
34
|
+
/** Biometrics service backed by @nativescript/biometrics. */
|
|
33
35
|
export const biometrics: Permissioned<BiometricsImpl> = {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
36
|
+
supported: true,
|
|
37
|
+
isAvailable: async () => (await available()).granted,
|
|
38
|
+
getPermissions: available,
|
|
39
|
+
requestPermissions: available,
|
|
40
|
+
async verify(reason) {
|
|
41
|
+
if (verifying) {
|
|
42
|
+
return false
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
verifying = true
|
|
46
|
+
try {
|
|
47
|
+
// iOS ignores `title` on its default keychain path — route
|
|
48
|
+
// through LAContext (pinFallback selects that path; customFallback
|
|
49
|
+
// keeps the biometrics-only policy) so `message` surfaces the
|
|
50
|
+
// caller's reason, matching Android's dialog title.
|
|
51
|
+
const options: VerifyBiometricOptions = isIOS
|
|
52
|
+
? { title: reason, message: reason, pinFallback: true, ios: { customFallback: true } }
|
|
53
|
+
: { title: reason }
|
|
54
|
+
|
|
55
|
+
const r = await bio.verifyBiometric(options)
|
|
56
|
+
|
|
57
|
+
return r.code === 0
|
|
58
|
+
} catch {
|
|
59
|
+
return false
|
|
60
|
+
} finally {
|
|
61
|
+
verifying = false
|
|
62
|
+
}
|
|
63
|
+
},
|
|
61
64
|
}
|
package/src/biometrics.web.ts
CHANGED
|
@@ -7,15 +7,15 @@ import type { Permissioned, PermissionResponse } from '@octane-xplat/lib/capabil
|
|
|
7
7
|
import type { BiometricsImpl } from './types'
|
|
8
8
|
|
|
9
9
|
const UNSUPPORTED: PermissionResponse = {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
status: 'unsupported',
|
|
11
|
+
granted: false,
|
|
12
|
+
canAskAgain: false,
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
export const biometrics: Permissioned<BiometricsImpl> = {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
16
|
+
supported: false,
|
|
17
|
+
isAvailable: async () => false,
|
|
18
|
+
getPermissions: async () => UNSUPPORTED,
|
|
19
|
+
requestPermissions: async () => UNSUPPORTED,
|
|
20
|
+
verify: () => Promise.reject(new UnavailabilityError('biometrics')),
|
|
21
21
|
}
|
package/src/types.ts
CHANGED
|
@@ -1,11 +1,16 @@
|
|
|
1
|
+
/** Biometric verification façade (Face ID / Touch ID / Android BIOMETRIC_STRONG). */
|
|
1
2
|
export interface BiometricsImpl {
|
|
2
|
-
|
|
3
|
+
/** Prompt the user for biometric verification, showing `reason` as the
|
|
4
|
+
* dialog title/message. Resolves false on failure, cancel, or lockout —
|
|
5
|
+
* it does not reject. Only one prompt runs at a time; overlapping calls
|
|
6
|
+
* resolve false immediately rather than queuing. */
|
|
7
|
+
verify(reason: string): Promise<boolean>
|
|
3
8
|
}
|
|
4
9
|
|
|
5
10
|
export { UnavailabilityError } from '@octane-xplat/lib/capability'
|
|
6
11
|
export type {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
12
|
+
Permissioned,
|
|
13
|
+
PermissionResponse,
|
|
14
|
+
PermissionStatus,
|
|
15
|
+
Service,
|
|
11
16
|
} from '@octane-xplat/lib/capability'
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
+
/** Biometric verification façade (Face ID / Touch ID / Android BIOMETRIC_STRONG). */
|
|
1
2
|
export interface BiometricsImpl {
|
|
3
|
+
/** Prompt the user for biometric verification, showing `reason` as the
|
|
4
|
+
* dialog title/message. Resolves false on failure, cancel, or lockout —
|
|
5
|
+
* it does not reject. Only one prompt runs at a time; overlapping calls
|
|
6
|
+
* resolve false immediately rather than queuing. */
|
|
2
7
|
verify(reason: string): Promise<boolean>;
|
|
3
8
|
}
|
|
4
9
|
export { UnavailabilityError } from '@octane-xplat/lib/capability';
|
package/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
The MIT License (MIT)
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2026 Alec Larson
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in
|
|
13
|
-
all copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
-
THE SOFTWARE.
|