@octane-xplat/biometrics 0.0.1 → 0.9.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/LICENSE ADDED
@@ -0,0 +1,21 @@
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.
package/README.md CHANGED
@@ -1,3 +1,30 @@
1
- # @octane-xplat/biometrics
1
+ # `@octane-xplat/biometrics`
2
2
 
3
- Version 0.0.1 is a reservation stub so the automated release can publish this package name. It has no supported API. Use a later release for the implementation.
3
+ Local biometric verification — Face ID / Touch ID / fingerprint or device
4
+ credential — behind one capability object. iOS and Android run
5
+ `@nativescript/biometrics`; web and the macOS AppKit host report
6
+ `supported: false` (WebAuthn is an authentication ceremony, not a
7
+ local-presence check, and the dev host has no LocalAuthentication bridge).
8
+
9
+ ```sh
10
+ pnpm add @octane-xplat/biometrics
11
+ ```
12
+
13
+ ```ts
14
+ import { biometrics } from '@octane-xplat/biometrics'
15
+
16
+ if ((await biometrics.ensure()) === 'granted') {
17
+ const ok = await biometrics.impl!.verify('Unlock your saved trips')
18
+ }
19
+ ```
20
+
21
+ The shared capability contract: `supported` reports whether an
22
+ implementation exists on this target — branch on it rather than catching —
23
+ `ensure()` resolves `'granted' | 'denied' | 'unsupported'`, and `impl` is
24
+ the service once usable. `verify(reason)` resolves `false` for a declined
25
+ or failed prompt rather than throwing.
26
+
27
+ Guide: [Using device features](../../docs/platform-services.md);
28
+ per-target availability: [platform notes](../../docs/platform-notes.md).
29
+ Exercised by the harness `Services` screen
30
+ ([`packages/app/src/Services.tsrx`](../app/src/Services.tsrx)).
package/package.json CHANGED
@@ -1,19 +1,69 @@
1
1
  {
2
2
  "name": "@octane-xplat/biometrics",
3
- "version": "0.0.1",
3
+ "version": "0.9.0",
4
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",
5
19
  "license": "MIT",
6
20
  "repository": {
7
21
  "type": "git",
8
- "url": "https://github.com/octane-xplat/octane-xplat.git",
22
+ "url": "https://github.com/octane-xplat/octane-xplat",
9
23
  "directory": "packages/biometrics"
10
24
  },
11
- "homepage": "https://github.com/octane-xplat/octane-xplat/tree/main/packages/biometrics",
12
- "main": "./index.js",
13
- "types": "./index.d.ts",
14
25
  "files": [
15
- "README.md",
16
- "index.js",
17
- "index.d.ts"
18
- ]
19
- }
26
+ "src"
27
+ ],
28
+ "type": "module",
29
+ "exports": {
30
+ ".": {
31
+ "macos": "./src/index.macos.ts",
32
+ "default": "./src/index.ts"
33
+ },
34
+ "./*": "./src/*"
35
+ },
36
+ "publishConfig": {
37
+ "access": "public"
38
+ },
39
+ "dependencies": {
40
+ "@nativescript/biometrics": "1.3.1"
41
+ },
42
+ "devDependencies": {
43
+ "@nativescript-community/octane": "0.2.4",
44
+ "@nativescript/core": "9.1.2",
45
+ "octane": "0.6.3"
46
+ },
47
+ "peerDependencies": {
48
+ "@nativescript-community/octane": ">=0.2.1 <1",
49
+ "@nativescript/core": ">=9.1.0 <10",
50
+ "octane": ">=0.6.3 <1"
51
+ },
52
+ "peerDependenciesMeta": {
53
+ "@nativescript-community/octane": {
54
+ "optional": true
55
+ },
56
+ "@nativescript/core": {
57
+ "optional": true
58
+ }
59
+ },
60
+ "nativescript": {
61
+ "platforms": {
62
+ "android": "9.1.0",
63
+ "ios": "9.1.0"
64
+ }
65
+ },
66
+ "scripts": {
67
+ "test:packed": "node tests/packed-consumer.mjs"
68
+ }
69
+ }
@@ -0,0 +1,9 @@
1
+ // Biometrics — AppKit host leaf. No LocalAuthentication bridge exists on the
2
+ // dev host.
3
+ import type { Capability, BiometricsImpl } from './types'
4
+
5
+ export const biometrics: Capability<BiometricsImpl> = {
6
+ supported: false,
7
+ ensure: async () => 'unsupported',
8
+ impl: null,
9
+ }
@@ -0,0 +1,24 @@
1
+ // Biometrics — FaceID/TouchID/fingerprint via @nativescript/biometrics.
2
+ import { BiometricAuth } from '@nativescript/biometrics'
3
+ import type { Capability } from './types'
4
+ import type { BiometricsImpl } from './types'
5
+
6
+ const bio = new BiometricAuth()
7
+
8
+ export const biometrics: Capability<BiometricsImpl> = {
9
+ supported: true,
10
+ async ensure() {
11
+ const r = await bio.available()
12
+ return r.any ? 'granted' : 'unsupported'
13
+ },
14
+ impl: {
15
+ async verify(reason) {
16
+ try {
17
+ const r = await bio.verifyBiometric({ title: reason })
18
+ return r.code === 0
19
+ } catch {
20
+ return false
21
+ }
22
+ },
23
+ },
24
+ }
@@ -0,0 +1,13 @@
1
+ // Biometrics — web leaf. WebAuthn is an authentication ceremony, not a
2
+ // standalone local-presence API: it requires an RP challenge and a registered
3
+ // credential, and may require a user gesture. Do not claim it implements the
4
+ // native verify(reason) contract by creating an ephemeral passkey.
5
+ import type { BiometricsImpl, Capability } from './types'
6
+
7
+ export const biometrics: Capability<BiometricsImpl> = {
8
+ supported: false,
9
+ async ensure() {
10
+ return 'unsupported'
11
+ },
12
+ impl: null,
13
+ }
@@ -0,0 +1,2 @@
1
+ export * from './types'
2
+ export { biometrics } from './biometrics.macos'
package/src/index.ts ADDED
@@ -0,0 +1,2 @@
1
+ export * from './types'
2
+ export { biometrics } from './biometrics'
package/src/types.ts ADDED
@@ -0,0 +1,11 @@
1
+ /** Optional capability — never throws for absence (docs/platform-services.md). */
2
+ export interface Capability<T> {
3
+ supported: boolean
4
+ ensure(): Promise<'granted' | 'denied' | 'unsupported'>
5
+ /** usable iff supported && ensured */
6
+ impl: T | null
7
+ }
8
+
9
+ export interface BiometricsImpl {
10
+ verify(reason: string): Promise<boolean>
11
+ }
package/index.d.ts DELETED
@@ -1 +0,0 @@
1
- export {}
package/index.js DELETED
@@ -1,2 +0,0 @@
1
- // Reservation stub; implementation will arrive in a later release.
2
- module.exports = {}