tauri-plugin-secure-element-api 0.1.0-alpha.4 → 0.1.0-beta.1
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 +61 -6
- package/dist-js/index.d.ts +6 -3
- package/package.json +10 -4
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Tauri Plugin Secure Element
|
|
2
2
|
|
|
3
|
-
A Tauri plugin for secure element functionality on iOS (Secure Enclave) and Android (
|
|
3
|
+
A Tauri plugin for secure element functionality on macOS & iOS (Secure Enclave) and Android (StrongBox and TEE).
|
|
4
4
|
|
|
5
5
|
## Features
|
|
6
6
|
|
|
@@ -9,7 +9,7 @@ A Tauri plugin for secure element functionality on iOS (Secure Enclave) and Andr
|
|
|
9
9
|
- List and manage secure keys
|
|
10
10
|
- Check secure element support on the device
|
|
11
11
|
- Support for biometric and PIN authentication modes
|
|
12
|
-
- Cross-platform support for iOS and Android
|
|
12
|
+
- Cross-platform support for macOS, Windows, iOS, and Android
|
|
13
13
|
|
|
14
14
|
## Installation
|
|
15
15
|
|
|
@@ -27,7 +27,7 @@ yarn add tauri-plugin-secure-element-api
|
|
|
27
27
|
|
|
28
28
|
```toml
|
|
29
29
|
[dependencies]
|
|
30
|
-
tauri-plugin-secure-element = "0.1.0"
|
|
30
|
+
tauri-plugin-secure-element = "0.1.0-beta.1"
|
|
31
31
|
```
|
|
32
32
|
|
|
33
33
|
## Setup
|
|
@@ -143,7 +143,17 @@ Generates a new secure key in the device's secure element.
|
|
|
143
143
|
- `keyName`: Unique name for the key
|
|
144
144
|
- `authMode`: Authentication mode (`'none'`, `'pinOrBiometric'`, or `'biometricOnly'`)
|
|
145
145
|
|
|
146
|
-
**Returns:** `Promise<
|
|
146
|
+
**Returns:** `Promise<GenerateSecureKeyResult>`
|
|
147
|
+
|
|
148
|
+
```typescript
|
|
149
|
+
interface GenerateSecureKeyResult {
|
|
150
|
+
publicKey: string;
|
|
151
|
+
keyName: string;
|
|
152
|
+
hardwareBacking: "secureEnclave" | "strongBox" | "tee";
|
|
153
|
+
}
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
**Note:** The `biometricOnly` mode requires Android 11 (API 30) or higher. On older Android versions, this mode will be rejected with an error. Use `checkSecureElementSupport().canEnforceBiometricOnly` to check support before creating biometric-only keys.
|
|
147
157
|
|
|
148
158
|
### `listKeys(keyName?: string, publicKey?: string)`
|
|
149
159
|
|
|
@@ -155,7 +165,6 @@ Lists keys stored in the secure element. Can filter by key name or public key.
|
|
|
155
165
|
interface KeyInfo {
|
|
156
166
|
keyName: string;
|
|
157
167
|
publicKey: string;
|
|
158
|
-
requiresAuthentication?: boolean;
|
|
159
168
|
}
|
|
160
169
|
```
|
|
161
170
|
|
|
@@ -176,10 +185,56 @@ Deletes a key from the secure element. At least one parameter must be provided.
|
|
|
176
185
|
|
|
177
186
|
**Returns:** `Promise<boolean>` - Success status
|
|
178
187
|
|
|
188
|
+
## Public Key Format
|
|
189
|
+
|
|
190
|
+
Public keys are returned as base64-encoded strings in **X9.62 uncompressed point format** (65 bytes), consistent across all platforms:
|
|
191
|
+
|
|
192
|
+
| Byte(s) | Content |
|
|
193
|
+
| ------- | ----------------------- |
|
|
194
|
+
| 0 | `0x04` (uncompressed) |
|
|
195
|
+
| 1-32 | X coordinate (32 bytes) |
|
|
196
|
+
| 33-64 | Y coordinate (32 bytes) |
|
|
197
|
+
|
|
198
|
+
All keys use the **secp256r1 (P-256)** elliptic curve.
|
|
199
|
+
|
|
179
200
|
## Platform Support
|
|
180
201
|
|
|
181
202
|
- **iOS**: Uses Secure Enclave for key generation and signing
|
|
182
|
-
- **Android**: Uses
|
|
203
|
+
- **Android**: Uses StrongBox and TEE (Trusted Execution Environment) when available
|
|
204
|
+
- **Windows**: Uses TPM 2.0 for key generation and signing
|
|
205
|
+
- **macOS**: Uses Secure Enclave for key generation and signing
|
|
206
|
+
|
|
207
|
+
## Platform Limitations
|
|
208
|
+
|
|
209
|
+
### Windows
|
|
210
|
+
|
|
211
|
+
- Windows 11 (build 22000 or higher) requires TPM 2.0
|
|
212
|
+
- TPM 2.0 is supported on Windows 10 (since version 1507)
|
|
213
|
+
|
|
214
|
+
### macOS
|
|
215
|
+
|
|
216
|
+
- Secure Enclave is available on Macs with Apple Silicon (M1/M2/M3/M4) or T2 chip
|
|
217
|
+
|
|
218
|
+
### Android
|
|
219
|
+
|
|
220
|
+
| Feature | Requirement | Notes |
|
|
221
|
+
| ------------------------- | ----------- | -------------------------------- |
|
|
222
|
+
| Hardware-backed keys | API 23+ | TEE or StrongBox required |
|
|
223
|
+
| StrongBox | API 28+ | Falls back to TEE if unavailable |
|
|
224
|
+
| `biometricOnly` auth mode | API 30+ | Rejected on older versions |
|
|
225
|
+
|
|
226
|
+
### iOS
|
|
227
|
+
|
|
228
|
+
- Secure Enclave is available on all devices with A7 chip or later (iPhone 5s+)
|
|
229
|
+
- Simulator does not support Secure Enclave - test on physical devices
|
|
230
|
+
|
|
231
|
+
### Authentication Modes
|
|
232
|
+
|
|
233
|
+
| Mode | iOS/MacOS | Android | Windows |
|
|
234
|
+
| ---------------- | --------------------------------- | ------------------------------------ | ------------------- |
|
|
235
|
+
| `none` | ✅ No auth required | ✅ No auth required | ✅ No auth required |
|
|
236
|
+
| `pinOrBiometric` | ✅ Face ID, Touch ID, or passcode | ✅ Biometric or PIN/pattern/password | ✅ Windows Hello |
|
|
237
|
+
| `biometricOnly` | ❌ Not supported | ✅ API 30+ only, biometric only | ❌ Not supported |
|
|
183
238
|
|
|
184
239
|
## License
|
|
185
240
|
|
package/dist-js/index.d.ts
CHANGED
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
export interface KeyInfo {
|
|
2
2
|
keyName: string;
|
|
3
3
|
publicKey: string;
|
|
4
|
-
requiresAuthentication?: boolean;
|
|
5
4
|
}
|
|
6
5
|
export declare function ping(value: string): Promise<string | null>;
|
|
7
6
|
export type AuthenticationMode = "none" | "pinOrBiometric" | "biometricOnly";
|
|
8
|
-
export
|
|
7
|
+
export type HardwareBacking = "secureEnclave" | "strongBox" | "tee";
|
|
8
|
+
export interface GenerateSecureKeyResult {
|
|
9
9
|
publicKey: string;
|
|
10
10
|
keyName: string;
|
|
11
|
-
|
|
11
|
+
/** The type of hardware backing used for this key */
|
|
12
|
+
hardwareBacking: HardwareBacking;
|
|
13
|
+
}
|
|
14
|
+
export declare function generateSecureKey(keyName: string, authMode?: AuthenticationMode): Promise<GenerateSecureKeyResult>;
|
|
12
15
|
export declare function listKeys(keyName?: string, publicKey?: string): Promise<KeyInfo[]>;
|
|
13
16
|
export declare function signWithKey(keyName: string, data: Uint8Array): Promise<Uint8Array>;
|
|
14
17
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tauri-plugin-secure-element-api",
|
|
3
|
-
"version": "0.1.0-
|
|
3
|
+
"version": "0.1.0-beta.1",
|
|
4
4
|
"description": "Tauri plugin for secure element use on iOS (Secure Enclave) and Android (Strongbox and TEE).",
|
|
5
5
|
"repository": "https://github.com/dkackman/tauri-plugin-secure-element",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -38,6 +38,11 @@
|
|
|
38
38
|
"build": "rollup -c",
|
|
39
39
|
"prepublishOnly": "pnpm build",
|
|
40
40
|
"pretest": "pnpm build",
|
|
41
|
+
"test": "pnpm test:rust && (pnpm test:swift || echo '⚠️ Swift tests skipped (require iOS simulator). To run: cd ios && xcodebuild test -scheme tauri-plugin-secure-element -destination \"platform=iOS Simulator,name=iPhone 15\"') && pnpm test:android",
|
|
42
|
+
"test:rust": "cargo test",
|
|
43
|
+
"test:swift": "cd ios && swift test",
|
|
44
|
+
"test:android": "cd android && (./gradlew test || gradle test || echo 'Note: Gradle wrapper not found. Install Gradle or run from Android Studio')",
|
|
45
|
+
"test:android:instrumented": "cd android && (./gradlew connectedAndroidTest || gradle connectedAndroidTest || echo 'Note: Gradle wrapper not found. Install Gradle or run from Android Studio')",
|
|
41
46
|
"format": "prettier --write . && cargo fmt && swiftformat ios/ 2>/dev/null || echo 'Note: swiftformat not installed. Install with: brew install swiftformat' && pnpm format:kotlin",
|
|
42
47
|
"format:check": "prettier --check . && cargo fmt --check && (swiftformat --lint ios/ 2>/dev/null || echo 'Note: swiftformat not installed') && pnpm format:check:kotlin",
|
|
43
48
|
"format:js": "prettier --write .",
|
|
@@ -54,11 +59,12 @@
|
|
|
54
59
|
"@tauri-apps/api": "^2.0.0"
|
|
55
60
|
},
|
|
56
61
|
"devDependencies": {
|
|
57
|
-
"@rollup/plugin-typescript": "^12.0.0",
|
|
58
62
|
"@naturalcycles/ktlint": "^1.16.0",
|
|
63
|
+
"@rollup/plugin-typescript": "^12.0.0",
|
|
64
|
+
"@rollup/rollup-win32-arm64-msvc": "^4.54.0",
|
|
59
65
|
"prettier": "^3.7.4",
|
|
60
66
|
"rollup": "^4.9.6",
|
|
61
|
-
"
|
|
62
|
-
"
|
|
67
|
+
"tslib": "^2.6.2",
|
|
68
|
+
"typescript": "^5.3.3"
|
|
63
69
|
}
|
|
64
70
|
}
|