@haex-space/vault-sdk 3.7.0 → 4.1.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 +51 -19
- package/dist/cli/index.js +437 -355
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/index.mjs +428 -339
- package/dist/cli/index.mjs.map +1 -1
- package/dist/{client-DH4Km77u.d.ts → client-CD5QZi7F.d.ts} +76 -12
- package/dist/{client-Dn4AbXbT.d.mts → client-Cx4ZyQFL.d.mts} +76 -12
- package/dist/haex_bundle_bg.wasm +0 -0
- package/dist/index.d.mts +16 -61
- package/dist/index.d.ts +16 -61
- package/dist/index.js +185 -116
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +204 -134
- package/dist/index.mjs.map +1 -1
- package/dist/node.d.mts +53 -2
- package/dist/node.d.ts +53 -2
- package/dist/node.js +319 -2
- package/dist/node.js.map +1 -1
- package/dist/node.mjs +320 -5
- package/dist/node.mjs.map +1 -1
- package/dist/nuxt.js +7 -5
- package/dist/nuxt.js.map +1 -1
- package/dist/nuxt.mjs +3 -2
- package/dist/nuxt.mjs.map +1 -1
- package/dist/react.d.mts +2 -2
- package/dist/react.d.ts +2 -2
- package/dist/react.js +192 -18
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +212 -38
- package/dist/react.mjs.map +1 -1
- package/dist/runtime/nuxt.plugin.client.d.mts +2 -2
- package/dist/runtime/nuxt.plugin.client.d.ts +2 -2
- package/dist/runtime/nuxt.plugin.client.js +100 -18
- package/dist/runtime/nuxt.plugin.client.js.map +1 -1
- package/dist/runtime/nuxt.plugin.client.mjs +100 -18
- package/dist/runtime/nuxt.plugin.client.mjs.map +1 -1
- package/dist/svelte.d.mts +2 -2
- package/dist/svelte.d.ts +2 -2
- package/dist/svelte.js +192 -18
- package/dist/svelte.js.map +1 -1
- package/dist/svelte.mjs +212 -38
- package/dist/svelte.mjs.map +1 -1
- package/dist/{types-DQZCRfC-.d.mts → types-BwFKGH70.d.mts} +11 -3
- package/dist/{types-DQZCRfC-.d.ts → types-BwFKGH70.d.ts} +11 -3
- package/dist/vue.d.mts +2 -2
- package/dist/vue.d.ts +2 -2
- package/dist/vue.js +192 -18
- package/dist/vue.js.map +1 -1
- package/dist/vue.mjs +212 -38
- package/dist/vue.mjs.map +1 -1
- package/package.json +9 -7
package/README.md
CHANGED
|
@@ -1037,6 +1037,20 @@ const depTable = client.getDependencyTableName(
|
|
|
1037
1037
|
// → "MCowBQYDK2VwAyEAp1q2r3s4t5u6v7w8x9y0z1a2b3c4d5e6f7g8h9i0j1k__password-manager__credentials"
|
|
1038
1038
|
```
|
|
1039
1039
|
|
|
1040
|
+
### Dialogs
|
|
1041
|
+
|
|
1042
|
+
Extensions run in a sandboxed frame without `allow-modals`: `window.confirm()` returns `false` at once.
|
|
1043
|
+
Ask through the host instead; it draws the dialog over your own tab:
|
|
1044
|
+
|
|
1045
|
+
```ts
|
|
1046
|
+
const sure = await client.dialog.confirm({
|
|
1047
|
+
message: "Delete this note?",
|
|
1048
|
+
confirmLabel: "Delete",
|
|
1049
|
+
destructive: true,
|
|
1050
|
+
});
|
|
1051
|
+
if (sure) await deleteNoteAsync(id);
|
|
1052
|
+
```
|
|
1053
|
+
|
|
1040
1054
|
### Database Operations
|
|
1041
1055
|
|
|
1042
1056
|
#### Query
|
|
@@ -1221,20 +1235,24 @@ Your extension needs a `manifest.json` file:
|
|
|
1221
1235
|
"version": "1.0.0",
|
|
1222
1236
|
"description": "My awesome extension",
|
|
1223
1237
|
|
|
1224
|
-
"publicKey": "
|
|
1225
|
-
"signature": "...",
|
|
1238
|
+
"publicKey": "<64 hex digits, written by haex sign>",
|
|
1226
1239
|
|
|
1227
1240
|
"namespace": "johndoe",
|
|
1228
1241
|
"displayName": "My Extension",
|
|
1229
1242
|
"author": "John Doe <john@example.com>",
|
|
1230
1243
|
"icon": "icon.png",
|
|
1231
|
-
"
|
|
1244
|
+
"entry": "index.html",
|
|
1232
1245
|
|
|
1233
|
-
"permissions":
|
|
1246
|
+
"permissions": {
|
|
1247
|
+
"database": [],
|
|
1248
|
+
"filesystem": [],
|
|
1249
|
+
"http": [],
|
|
1250
|
+
"shell": []
|
|
1251
|
+
},
|
|
1234
1252
|
|
|
1235
1253
|
"dependencies": [
|
|
1236
1254
|
{
|
|
1237
|
-
"publicKey": "
|
|
1255
|
+
"publicKey": "<64 hex digits: public key of the password-manager extension>",
|
|
1238
1256
|
"name": "password-manager",
|
|
1239
1257
|
"minVersion": "1.0.0",
|
|
1240
1258
|
"reason": "To access stored credentials",
|
|
@@ -1287,7 +1305,7 @@ await db.insert(credentialsTable, {
|
|
|
1287
1305
|
|
|
1288
1306
|
"dependencies": [
|
|
1289
1307
|
{
|
|
1290
|
-
"publicKey": "
|
|
1308
|
+
"publicKey": "<64 hex digits: public key of the password-manager extension>",
|
|
1291
1309
|
"name": "password-manager",
|
|
1292
1310
|
"minVersion": "1.0.0",
|
|
1293
1311
|
"reason": "Access stored credentials for email sync",
|
|
@@ -1392,7 +1410,7 @@ Then build and package:
|
|
|
1392
1410
|
npm run build:release
|
|
1393
1411
|
```
|
|
1394
1412
|
|
|
1395
|
-
This creates `your-extension-1.0.0.
|
|
1413
|
+
This creates `your-extension-1.0.0.xt` - a signed ZIP file ready for distribution.
|
|
1396
1414
|
|
|
1397
1415
|
**OR** build your extension and run:
|
|
1398
1416
|
|
|
@@ -1400,25 +1418,34 @@ This creates `your-extension-1.0.0.haextension` - a signed ZIP file ready for di
|
|
|
1400
1418
|
npx haex sign dist -k private.key
|
|
1401
1419
|
```
|
|
1402
1420
|
|
|
1403
|
-
### 4. What Gets Signed?
|
|
1421
|
+
### 4. What Gets Signed? (format `haextension-bundle/2`)
|
|
1422
|
+
|
|
1423
|
+
`haex sign`:
|
|
1404
1424
|
|
|
1405
|
-
|
|
1425
|
+
1. Collects the build output, the extra files of `haextension/` and the migrations (`migrationsDir`).
|
|
1426
|
+
Symlinks abort signing; `haextension.config.json`, `public.key` and `private.key` are never packaged.
|
|
1427
|
+
2. Writes `haextension/manifest.json` as canonical JSON (RFC 8785) without a `signature` field.
|
|
1428
|
+
3. Writes `haextension/signature.json` listing path, size and SHA-256 of every file, signed with
|
|
1429
|
+
Ed25519 over `"haextension-bundle/2\n"` + the canonical JSON of that list and the public key.
|
|
1430
|
+
4. Packs everything into a deterministic `.xt` ZIP (fixed timestamps, no directory entries) and verifies it.
|
|
1406
1431
|
|
|
1407
|
-
|
|
1408
|
-
2. Signs the hash with your private key using Ed25519
|
|
1409
|
-
3. Adds `public_key` and `signature` to your `manifest.json`
|
|
1410
|
-
4. Creates a `.haextension` file (ZIP archive)
|
|
1432
|
+
Moving content between files, renaming, adding or removing a file all break the signature.
|
|
1411
1433
|
|
|
1412
1434
|
### 5. Verification
|
|
1413
1435
|
|
|
1414
|
-
|
|
1436
|
+
```bash
|
|
1437
|
+
npx haex verify your-extension-1.0.0.xt
|
|
1438
|
+
```
|
|
1415
1439
|
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1440
|
+
checks the bundle exactly like the host does and names the first failing rule (for example
|
|
1441
|
+
`file_mismatch { path: "index.html" }`). Bundles signed by SDK 3.x (signature inside the manifest) are
|
|
1442
|
+
rejected with `legacy_signature_format`: re-sign them with `haex sign`. Shared test vectors for hosts are in
|
|
1443
|
+
`test-vectors/bundles/`.
|
|
1420
1444
|
|
|
1421
|
-
|
|
1445
|
+
The format has exactly one implementation: the Rust crate `crates/haex-bundle`. Hosts such as holzi use it
|
|
1446
|
+
natively, and `haex sign` / `haex verify` call its WebAssembly build, so the tool and the hosts cannot apply
|
|
1447
|
+
different rules. From Node.js the same functions are available as `verifyBundle` and `buildBundle` from
|
|
1448
|
+
`@haex-space/vault-sdk/node`.
|
|
1422
1449
|
|
|
1423
1450
|
### 6. Key Management Best Practices
|
|
1424
1451
|
|
|
@@ -1499,6 +1526,11 @@ try {
|
|
|
1499
1526
|
|
|
1500
1527
|
## Development
|
|
1501
1528
|
|
|
1529
|
+
Building and testing need, besides Node.js and pnpm, a Rust toolchain with the `wasm32-unknown-unknown`
|
|
1530
|
+
target and `wasm-bindgen` in the version `crates/haex-bundle/Cargo.toml` pins
|
|
1531
|
+
(`cargo install wasm-bindgen-cli --version <pin>`). `pnpm build`, `pnpm test` and `pnpm typecheck` build the
|
|
1532
|
+
WebAssembly module first (`pnpm build:wasm`); run that once before `pnpm test:watch`.
|
|
1533
|
+
|
|
1502
1534
|
```bash
|
|
1503
1535
|
# Install dependencies
|
|
1504
1536
|
pnpm install
|