@vibr8vault/sdk 0.5.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.
Files changed (2) hide show
  1. package/README.md +142 -0
  2. package/package.json +49 -0
package/README.md ADDED
@@ -0,0 +1,142 @@
1
+ # @vibr8vault/sdk
2
+
3
+ TypeScript SDK for [Vibr8Vault](https://vault.vibr8lab.work) — a self-hosted secrets manager.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install @vibr8vault/sdk
9
+ ```
10
+
11
+ ## Quick Start
12
+
13
+ ```typescript
14
+ import { Vibr8Vault } from "@vibr8vault/sdk";
15
+
16
+ const vault = new Vibr8Vault({
17
+ address: "http://localhost:8200",
18
+ token: "your-service-token",
19
+ });
20
+
21
+ // Read a secret
22
+ const secret = await vault.secrets.read("apps/backend/prod");
23
+ console.log(secret.data.DB_PASSWORD);
24
+
25
+ // List secrets under a prefix
26
+ const listing = await vault.secrets.list("apps/");
27
+ console.log(listing.keys);
28
+
29
+ // Check vault health
30
+ const health = await vault.sys.health();
31
+ console.log(health.status);
32
+ ```
33
+
34
+ ## API Reference
35
+
36
+ ### Secrets
37
+
38
+ ```typescript
39
+ vault.secrets.read(path, { version? }) // Read a secret (optionally a specific version)
40
+ vault.secrets.write(path, data) // Write key-value pairs to a path
41
+ vault.secrets.delete(path, { hard? }) // Soft-delete (or hard-delete) a secret
42
+ vault.secrets.list(prefix) // List secret paths under a prefix
43
+ vault.secrets.versions(path) // List all versions of a secret
44
+ ```
45
+
46
+ Namespace-scoped variants: `readNs`, `writeNs`, `deleteNs`, `listNs`, `versionsNs` — each takes `ns` as the first argument.
47
+
48
+ ### Tokens
49
+
50
+ ```typescript
51
+ vault.tokens.create({ type?, ttl?, policies?, max_uses? })
52
+ vault.tokens.revoke(id)
53
+ vault.tokens.list()
54
+ ```
55
+
56
+ ### Auth
57
+
58
+ ```typescript
59
+ vault.auth.login(username, password);
60
+ vault.auth.me();
61
+ ```
62
+
63
+ ### Users
64
+
65
+ ```typescript
66
+ vault.users.create({ username, password, policies? })
67
+ vault.users.list()
68
+ vault.users.get(id)
69
+ vault.users.update(id, { password?, policies? })
70
+ vault.users.delete(id)
71
+ ```
72
+
73
+ ### System
74
+
75
+ ```typescript
76
+ vault.sys.health();
77
+ vault.sys.status();
78
+ vault.sys.init();
79
+ vault.sys.unseal(key);
80
+ vault.sys.seal();
81
+ vault.sys.rotate();
82
+ ```
83
+
84
+ ### Namespaces
85
+
86
+ ```typescript
87
+ vault.namespaces.list();
88
+ vault.namespaces.get(name);
89
+ vault.namespaces.create(name);
90
+ vault.namespaces.delete(name);
91
+ ```
92
+
93
+ ### Policies
94
+
95
+ ```typescript
96
+ vault.policies.list(ns?)
97
+ vault.policies.get(name, ns?)
98
+ vault.policies.create(yaml, ns?)
99
+ vault.policies.delete(name, ns?)
100
+ ```
101
+
102
+ ### Audit
103
+
104
+ ```typescript
105
+ vault.audit.list({ action?, username?, namespace?, severity?, limit?, offset?, ... })
106
+ ```
107
+
108
+ ### Client Management
109
+
110
+ ```typescript
111
+ vault.setToken(token); // Change the auth token after construction
112
+ ```
113
+
114
+ Constructor options:
115
+
116
+ ```typescript
117
+ new Vibr8Vault({ address: string, token?: string })
118
+ ```
119
+
120
+ ## Error Handling
121
+
122
+ ```typescript
123
+ import { Vibr8Vault, Vibr8VaultError } from "@vibr8vault/sdk";
124
+
125
+ const vault = new Vibr8Vault({
126
+ address: "http://localhost:8200",
127
+ token: "your-token",
128
+ });
129
+
130
+ try {
131
+ const secret = await vault.secrets.read("nonexistent/path");
132
+ } catch (e) {
133
+ if (e instanceof Vibr8VaultError) {
134
+ console.log(`Error: ${e.message} (HTTP ${e.status})`);
135
+ }
136
+ }
137
+ ```
138
+
139
+ ## Requirements
140
+
141
+ - Node.js 18+
142
+ - A running Vibr8Vault instance
package/package.json ADDED
@@ -0,0 +1,49 @@
1
+ {
2
+ "name": "@vibr8vault/sdk",
3
+ "version": "0.5.0",
4
+ "description": "TypeScript SDK for Vibr8Vault secrets manager",
5
+ "type": "module",
6
+ "main": "dist/index.js",
7
+ "types": "dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.js"
12
+ }
13
+ },
14
+ "engines": {
15
+ "node": ">=18"
16
+ },
17
+ "scripts": {
18
+ "build": "tsc",
19
+ "test": "vitest run",
20
+ "test:watch": "vitest"
21
+ },
22
+ "devDependencies": {
23
+ "typescript": "^5.0.0",
24
+ "vitest": "^3.0.0"
25
+ },
26
+ "files": [
27
+ "dist"
28
+ ],
29
+ "license": "MIT",
30
+ "author": "Vibr8Soft",
31
+ "repository": {
32
+ "type": "git",
33
+ "url": "git+https://github.com/vibr8soft/Vibr8Vault-TypeScript-sdk.git",
34
+ "directory": "lib/sdk/typescript"
35
+ },
36
+ "homepage": "https://github.com/vibr8soft/Vibr8Vault-TypeScript-sdk#readme",
37
+ "bugs": {
38
+ "url": "https://github.com/vibr8soft/Vibr8Vault-TypeScript-sdk/issues"
39
+ },
40
+ "keywords": [
41
+ "vibr8vault",
42
+ "secrets",
43
+ "vault",
44
+ "secrets-manager",
45
+ "sdk",
46
+ "typescript"
47
+ ],
48
+ "sideEffects": false
49
+ }