@haex-space/vault-sdk 1.0.0 → 1.0.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 +40 -40
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
# @haex-space/sdk
|
|
1
|
+
# @haex-space/vault-sdk
|
|
2
2
|
|
|
3
|
-
[](https://www.npmjs.com/package/@haex-space/sdk)
|
|
3
|
+
[](https://www.npmjs.com/package/@haex-space/vault-sdk)
|
|
4
|
+
[](https://www.npmjs.com/package/@haex-space/vault-sdk)
|
|
5
5
|
|
|
6
6
|
Official SDK for building HaexVault extensions with cryptographic identity and granular permissions.
|
|
7
7
|
|
|
8
8
|
## Installation
|
|
9
9
|
|
|
10
10
|
```bash
|
|
11
|
-
npm install @haex-space/sdk
|
|
11
|
+
npm install @haex-space/vault-sdk
|
|
12
12
|
# or
|
|
13
|
-
pnpm add @haex-space/sdk
|
|
13
|
+
pnpm add @haex-space/vault-sdk
|
|
14
14
|
# or
|
|
15
|
-
yarn add @haex-space/sdk
|
|
15
|
+
yarn add @haex-space/vault-sdk
|
|
16
16
|
```
|
|
17
17
|
|
|
18
18
|
## Quick Start
|
|
@@ -25,7 +25,7 @@ npm create vite@latest my-extension -- --template react-ts
|
|
|
25
25
|
|
|
26
26
|
# Install SDK
|
|
27
27
|
cd my-extension
|
|
28
|
-
npm install @haex-space/sdk
|
|
28
|
+
npm install @haex-space/vault-sdk
|
|
29
29
|
|
|
30
30
|
# Initialize extension structure
|
|
31
31
|
npx haex init
|
|
@@ -228,7 +228,7 @@ onMounted(async () => {
|
|
|
228
228
|
```tsx
|
|
229
229
|
// src/App.tsx
|
|
230
230
|
import { useState, useEffect } from 'react';
|
|
231
|
-
import { useHaexVault } from '@haex-space/sdk/react';
|
|
231
|
+
import { useHaexVault } from '@haex-space/vault-sdk/react';
|
|
232
232
|
import manifest from './manifest.json';
|
|
233
233
|
|
|
234
234
|
function App() {
|
|
@@ -278,7 +278,7 @@ function App() {
|
|
|
278
278
|
<!-- src/App.svelte -->
|
|
279
279
|
<script lang="ts">
|
|
280
280
|
import { onMount } from 'svelte';
|
|
281
|
-
import { initHaexVault, haexHub, isSetupComplete } from '@haex-space/sdk/svelte';
|
|
281
|
+
import { initHaexVault, haexHub, isSetupComplete } from '@haex-space/vault-sdk/svelte';
|
|
282
282
|
import manifest from '../haextension/manifest.json';
|
|
283
283
|
|
|
284
284
|
onMount(async () => {
|
|
@@ -319,7 +319,7 @@ function App() {
|
|
|
319
319
|
|
|
320
320
|
```typescript
|
|
321
321
|
// src/main.ts
|
|
322
|
-
import { createHaexVaultClient } from '@haex-space/sdk';
|
|
322
|
+
import { createHaexVaultClient } from '@haex-space/vault-sdk';
|
|
323
323
|
import manifest from '../haextension/manifest.json';
|
|
324
324
|
|
|
325
325
|
const client = createHaexVaultClient({ manifest });
|
|
@@ -413,12 +413,12 @@ The HaexVault SDK provides **framework-specific adapters** for seamless integrat
|
|
|
413
413
|
<summary><b>Vue 3</b> - Composable with reactive refs</summary>
|
|
414
414
|
|
|
415
415
|
```bash
|
|
416
|
-
npm install @haex-space/sdk
|
|
416
|
+
npm install @haex-space/vault-sdk
|
|
417
417
|
```
|
|
418
418
|
|
|
419
419
|
```vue
|
|
420
420
|
<script setup lang="ts">
|
|
421
|
-
import { useHaexVault } from '@haex-space/sdk/vue';
|
|
421
|
+
import { useHaexVault } from '@haex-space/vault-sdk/vue';
|
|
422
422
|
import manifest from './manifest.json';
|
|
423
423
|
|
|
424
424
|
const { client, context, getTableName } = useHaexVault({ manifest });
|
|
@@ -470,11 +470,11 @@ const users = await client.query<User>(`SELECT * FROM ${tableName}`);
|
|
|
470
470
|
<summary><b>React</b> - Hook with automatic state updates</summary>
|
|
471
471
|
|
|
472
472
|
```bash
|
|
473
|
-
npm install @haex-space/sdk
|
|
473
|
+
npm install @haex-space/vault-sdk
|
|
474
474
|
```
|
|
475
475
|
|
|
476
476
|
```tsx
|
|
477
|
-
import { useHaexVault } from '@haex-space/sdk/react';
|
|
477
|
+
import { useHaexVault } from '@haex-space/vault-sdk/react';
|
|
478
478
|
import { useEffect, useState } from 'react';
|
|
479
479
|
import manifest from './manifest.json';
|
|
480
480
|
|
|
@@ -550,13 +550,13 @@ export default App;
|
|
|
550
550
|
<summary><b>Svelte</b> - Stores with $-syntax reactivity</summary>
|
|
551
551
|
|
|
552
552
|
```bash
|
|
553
|
-
npm install @haex-space/sdk
|
|
553
|
+
npm install @haex-space/vault-sdk
|
|
554
554
|
```
|
|
555
555
|
|
|
556
556
|
```svelte
|
|
557
557
|
<script lang="ts">
|
|
558
558
|
import { onMount } from 'svelte';
|
|
559
|
-
import { initHaexVault, haexHub, context } from '@haex-space/sdk/svelte';
|
|
559
|
+
import { initHaexVault, haexHub, context } from '@haex-space/vault-sdk/svelte';
|
|
560
560
|
import manifest from '../haextension/manifest.json';
|
|
561
561
|
|
|
562
562
|
let users = [];
|
|
@@ -620,11 +620,11 @@ npm install @haex-space/sdk
|
|
|
620
620
|
<summary><b>Vanilla JS / Other Frameworks</b> - Core SDK</summary>
|
|
621
621
|
|
|
622
622
|
```bash
|
|
623
|
-
npm install @haex-space/sdk
|
|
623
|
+
npm install @haex-space/vault-sdk
|
|
624
624
|
```
|
|
625
625
|
|
|
626
626
|
```typescript
|
|
627
|
-
import { createHaexVaultClient } from '@haex-space/sdk';
|
|
627
|
+
import { createHaexVaultClient } from '@haex-space/vault-sdk';
|
|
628
628
|
import manifest from '../haextension/manifest.json';
|
|
629
629
|
|
|
630
630
|
const client = createHaexVaultClient({ manifest });
|
|
@@ -668,10 +668,10 @@ console.log(users);
|
|
|
668
668
|
|
|
669
669
|
| Framework | Import Path | Features |
|
|
670
670
|
|-----------|-------------|----------|
|
|
671
|
-
| **Vue 3** | `@haex-space/sdk/vue` | Composable with `ref` reactivity |
|
|
672
|
-
| **React** | `@haex-space/sdk/react` | Hook with state management |
|
|
673
|
-
| **Svelte** | `@haex-space/sdk/svelte` | Stores with `$` syntax |
|
|
674
|
-
| **Core** | `@haex-space/sdk` | Framework-agnostic client |
|
|
671
|
+
| **Vue 3** | `@haex-space/vault-sdk/vue` | Composable with `ref` reactivity |
|
|
672
|
+
| **React** | `@haex-space/vault-sdk/react` | Hook with state management |
|
|
673
|
+
| **Svelte** | `@haex-space/vault-sdk/svelte` | Stores with `$` syntax |
|
|
674
|
+
| **Core** | `@haex-space/vault-sdk` | Framework-agnostic client |
|
|
675
675
|
|
|
676
676
|
## Built-in Polyfills
|
|
677
677
|
|
|
@@ -689,7 +689,7 @@ The SDK automatically includes polyfills for browser APIs that don't work in cus
|
|
|
689
689
|
When you import the SDK:
|
|
690
690
|
|
|
691
691
|
```typescript
|
|
692
|
-
import { createHaexVaultClient } from '@haex-space/sdk';
|
|
692
|
+
import { createHaexVaultClient } from '@haex-space/vault-sdk';
|
|
693
693
|
// Polyfills are automatically active!
|
|
694
694
|
```
|
|
695
695
|
|
|
@@ -730,7 +730,7 @@ interface ApplicationContext {
|
|
|
730
730
|
```vue
|
|
731
731
|
<script setup lang="ts">
|
|
732
732
|
import { watch } from 'vue';
|
|
733
|
-
import { useHaexVault } from '@haex-space/sdk/vue';
|
|
733
|
+
import { useHaexVault } from '@haex-space/vault-sdk/vue';
|
|
734
734
|
import manifest from './manifest.json';
|
|
735
735
|
|
|
736
736
|
const { context } = useHaexVault({ manifest });
|
|
@@ -753,7 +753,7 @@ watch(() => context.value, (ctx) => {
|
|
|
753
753
|
|
|
754
754
|
```tsx
|
|
755
755
|
import { useEffect } from 'react';
|
|
756
|
-
import { useHaexVault } from '@haex-space/sdk/react';
|
|
756
|
+
import { useHaexVault } from '@haex-space/vault-sdk/react';
|
|
757
757
|
import manifest from './manifest.json';
|
|
758
758
|
|
|
759
759
|
function App() {
|
|
@@ -779,7 +779,7 @@ function App() {
|
|
|
779
779
|
|
|
780
780
|
```svelte
|
|
781
781
|
<script lang="ts">
|
|
782
|
-
import { initHaexVault, context } from '@haex-space/sdk/svelte';
|
|
782
|
+
import { initHaexVault, context } from '@haex-space/vault-sdk/svelte';
|
|
783
783
|
import manifest from '../haextension/manifest.json';
|
|
784
784
|
|
|
785
785
|
initHaexVault({ manifest });
|
|
@@ -800,7 +800,7 @@ function App() {
|
|
|
800
800
|
<summary><b>Vanilla JS / Vite</b></summary>
|
|
801
801
|
|
|
802
802
|
```typescript
|
|
803
|
-
import { createHaexVaultClient } from '@haex-space/sdk';
|
|
803
|
+
import { createHaexVaultClient } from '@haex-space/vault-sdk';
|
|
804
804
|
import manifest from '../haextension/manifest.json';
|
|
805
805
|
|
|
806
806
|
const client = createHaexVaultClient({ manifest });
|
|
@@ -927,7 +927,7 @@ const creds = await client.database.query(`SELECT * FROM ${depTable}`);
|
|
|
927
927
|
### Vue 3 Adapter
|
|
928
928
|
|
|
929
929
|
```typescript
|
|
930
|
-
import { useHaexVault } from '@haex-space/sdk/vue';
|
|
930
|
+
import { useHaexVault } from '@haex-space/vault-sdk/vue';
|
|
931
931
|
|
|
932
932
|
const {
|
|
933
933
|
client, // Raw HaexVaultClient instance
|
|
@@ -947,7 +947,7 @@ watch(() => extensionInfo.value, (info) => {
|
|
|
947
947
|
### React Adapter
|
|
948
948
|
|
|
949
949
|
```typescript
|
|
950
|
-
import { useHaexVault } from '@haex-space/sdk/react';
|
|
950
|
+
import { useHaexVault } from '@haex-space/vault-sdk/react';
|
|
951
951
|
|
|
952
952
|
function MyComponent() {
|
|
953
953
|
const {
|
|
@@ -968,11 +968,11 @@ function MyComponent() {
|
|
|
968
968
|
|
|
969
969
|
```typescript
|
|
970
970
|
// Initialize once in +layout.svelte
|
|
971
|
-
import { initHaexVault } from '@haex-space/sdk/svelte';
|
|
971
|
+
import { initHaexVault } from '@haex-space/vault-sdk/svelte';
|
|
972
972
|
initHaexVault({ debug: true });
|
|
973
973
|
|
|
974
974
|
// Use stores anywhere
|
|
975
|
-
import { extensionInfo, context, haexHub } from '@haex-space/sdk/svelte';
|
|
975
|
+
import { extensionInfo, context, haexHub } from '@haex-space/vault-sdk/svelte';
|
|
976
976
|
|
|
977
977
|
// In templates with $ syntax
|
|
978
978
|
<h1>{$extensionInfo?.name}</h1>
|
|
@@ -987,7 +987,7 @@ await haexHub.database.query(`SELECT * FROM ${tableName}`);
|
|
|
987
987
|
#### Client Initialization
|
|
988
988
|
|
|
989
989
|
```typescript
|
|
990
|
-
import { createHaexVaultClient } from '@haex-space/sdk';
|
|
990
|
+
import { createHaexVaultClient } from '@haex-space/vault-sdk';
|
|
991
991
|
|
|
992
992
|
const client = createHaexVaultClient({
|
|
993
993
|
debug: true, // Optional: Enable debug logging
|
|
@@ -1255,7 +1255,7 @@ Your extension needs a `manifest.json` file:
|
|
|
1255
1255
|
### Extension A: Password Manager
|
|
1256
1256
|
|
|
1257
1257
|
```typescript
|
|
1258
|
-
import { useHaexVault } from '@haex-space/sdk/vue';
|
|
1258
|
+
import { useHaexVault } from '@haex-space/vault-sdk/vue';
|
|
1259
1259
|
|
|
1260
1260
|
const { db, getTableName } = useHaexVault();
|
|
1261
1261
|
|
|
@@ -1306,7 +1306,7 @@ await db.insert(credentialsTable, {
|
|
|
1306
1306
|
**Code:**
|
|
1307
1307
|
|
|
1308
1308
|
```typescript
|
|
1309
|
-
import { useHaexVault } from '@haex-space/sdk/react';
|
|
1309
|
+
import { useHaexVault } from '@haex-space/vault-sdk/react';
|
|
1310
1310
|
|
|
1311
1311
|
function EmailClient() {
|
|
1312
1312
|
const { db, client } = useHaexVault();
|
|
@@ -1381,7 +1381,7 @@ Add scripts to your `package.json`:
|
|
|
1381
1381
|
"build:release": "npm run build && npm run package"
|
|
1382
1382
|
},
|
|
1383
1383
|
"devDependencies": {
|
|
1384
|
-
"@haex-space/sdk": "^
|
|
1384
|
+
"@haex-space/vault-sdk": "^1.0.0"
|
|
1385
1385
|
}
|
|
1386
1386
|
}
|
|
1387
1387
|
```
|
|
@@ -1476,13 +1476,13 @@ import type {
|
|
|
1476
1476
|
ApplicationContext,
|
|
1477
1477
|
DatabaseQueryResult,
|
|
1478
1478
|
PermissionStatus
|
|
1479
|
-
} from '@haex-space/sdk';
|
|
1479
|
+
} from '@haex-space/vault-sdk';
|
|
1480
1480
|
```
|
|
1481
1481
|
|
|
1482
1482
|
## Error Handling
|
|
1483
1483
|
|
|
1484
1484
|
```typescript
|
|
1485
|
-
import { ErrorCode } from '@haex-space/sdk';
|
|
1485
|
+
import { ErrorCode } from '@haex-space/vault-sdk';
|
|
1486
1486
|
|
|
1487
1487
|
try {
|
|
1488
1488
|
await client.database.query(`SELECT * FROM ${someTable}`);
|
|
@@ -1546,6 +1546,6 @@ ISC
|
|
|
1546
1546
|
|
|
1547
1547
|
## Support
|
|
1548
1548
|
|
|
1549
|
-
- Documentation: https://github.com/haex-space/sdk
|
|
1550
|
-
- GitHub: https://github.com/haex-space/sdk
|
|
1551
|
-
- Issues: https://github.com/haex-space/sdk/issues
|
|
1549
|
+
- Documentation: https://github.com/haex-space/vault-sdk
|
|
1550
|
+
- GitHub: https://github.com/haex-space/vault-sdk
|
|
1551
|
+
- Issues: https://github.com/haex-space/vault-sdk/issues
|