@cipherstash/stack 0.11.0 → 0.13.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/CHANGELOG.md +12 -0
- package/README.md +52 -32
- package/package.json +5 -9
- package/dist/bin/stash.js +0 -5210
- package/dist/bin/stash.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @cipherstash/stack
|
|
2
2
|
|
|
3
|
+
## 0.13.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 068f820: Release the consolidated CipherStash CLI npm package.
|
|
8
|
+
|
|
9
|
+
## 0.12.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- 15764a8: Implement stack auth into stash cli flow.
|
|
14
|
+
|
|
3
15
|
## 0.11.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -44,19 +44,29 @@ pnpm add @cipherstash/stack
|
|
|
44
44
|
|
|
45
45
|
## Quick Start
|
|
46
46
|
|
|
47
|
+
### 1. Initialize and authenticate your project
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
npx @cipherstash/cli init
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
The wizard will authenticate you, walk you through choosing a database connection method, build an encryption schema, and install the required dependencies.
|
|
54
|
+
|
|
55
|
+
### 2. Encrypt and decrypt
|
|
56
|
+
|
|
47
57
|
```typescript
|
|
48
58
|
import { Encryption } from "@cipherstash/stack"
|
|
49
59
|
import { encryptedTable, encryptedColumn } from "@cipherstash/stack/schema"
|
|
50
60
|
|
|
51
|
-
//
|
|
61
|
+
// Define a schema
|
|
52
62
|
const users = encryptedTable("users", {
|
|
53
63
|
email: encryptedColumn("email").equality().freeTextSearch(),
|
|
54
64
|
})
|
|
55
65
|
|
|
56
|
-
//
|
|
66
|
+
// Create a client
|
|
57
67
|
const client = await Encryption({ schemas: [users] })
|
|
58
68
|
|
|
59
|
-
//
|
|
69
|
+
// Encrypt a value
|
|
60
70
|
const encrypted = await client.encrypt("hello@example.com", {
|
|
61
71
|
column: users.email,
|
|
62
72
|
table: users,
|
|
@@ -68,7 +78,7 @@ if (encrypted.failure) {
|
|
|
68
78
|
console.log("Encrypted payload:", encrypted.data)
|
|
69
79
|
}
|
|
70
80
|
|
|
71
|
-
//
|
|
81
|
+
// Decrypt the value
|
|
72
82
|
const decrypted = await client.decrypt(encrypted.data)
|
|
73
83
|
|
|
74
84
|
if (decrypted.failure) {
|
|
@@ -428,51 +438,67 @@ await secrets.delete("DATABASE_URL")
|
|
|
428
438
|
|
|
429
439
|
## CLI Reference
|
|
430
440
|
|
|
431
|
-
The
|
|
441
|
+
The CLI is available via `npx @cipherstash/cli` after install.
|
|
442
|
+
|
|
443
|
+
### `npx @cipherstash/cli auth`
|
|
444
|
+
|
|
445
|
+
Authenticate with CipherStash.
|
|
432
446
|
|
|
433
|
-
|
|
447
|
+
```bash
|
|
448
|
+
npx @cipherstash/cli auth login
|
|
449
|
+
```
|
|
450
|
+
|
|
451
|
+
This runs the device code flow: it opens your browser, you confirm the code, and a token is saved to `~/.cipherstash/auth.json`. No environment variables or credentials files are needed for local development.
|
|
452
|
+
|
|
453
|
+
### `npx @cipherstash/cli init`
|
|
434
454
|
|
|
435
455
|
Initialize CipherStash for your project with an interactive wizard.
|
|
436
456
|
|
|
437
457
|
```bash
|
|
438
|
-
npx
|
|
439
|
-
npx
|
|
458
|
+
npx @cipherstash/cli init
|
|
459
|
+
npx @cipherstash/cli init --supabase
|
|
440
460
|
```
|
|
441
461
|
|
|
442
462
|
The wizard will:
|
|
443
|
-
1.
|
|
444
|
-
2.
|
|
445
|
-
3.
|
|
463
|
+
1. Authenticate with CipherStash (device code flow)
|
|
464
|
+
2. Bind your device to the default Keyset
|
|
465
|
+
3. Choose your database connection method (Drizzle ORM, Supabase JS, Prisma, or Raw SQL)
|
|
466
|
+
4. Build an encryption schema interactively or use a placeholder, then generate the encryption client file
|
|
467
|
+
5. Install `@cipherstash/cli` as a dev dependency for database tooling
|
|
446
468
|
|
|
447
|
-
After
|
|
469
|
+
After init, run `npx @cipherstash/cli db setup` to configure your database.
|
|
448
470
|
|
|
449
471
|
| Flag | Description |
|
|
450
472
|
|------|-------------|
|
|
451
473
|
| `--supabase` | Use Supabase-specific setup flow |
|
|
452
474
|
|
|
453
|
-
### `
|
|
475
|
+
### `npx @cipherstash/cli secrets`
|
|
454
476
|
|
|
455
477
|
Manage encrypted secrets from the terminal.
|
|
456
478
|
|
|
457
479
|
```bash
|
|
458
|
-
npx
|
|
459
|
-
npx
|
|
460
|
-
npx
|
|
461
|
-
npx
|
|
480
|
+
npx @cipherstash/cli secrets set -name DATABASE_URL -value "postgres://..." -environment production
|
|
481
|
+
npx @cipherstash/cli secrets get -name DATABASE_URL -environment production
|
|
482
|
+
npx @cipherstash/cli secrets list -environment production
|
|
483
|
+
npx @cipherstash/cli secrets delete -name DATABASE_URL -environment production
|
|
462
484
|
```
|
|
463
485
|
|
|
464
486
|
| Command | Flags | Aliases | Description |
|
|
465
487
|
|-----|----|-----|-------|
|
|
466
|
-
| `
|
|
467
|
-
| `
|
|
468
|
-
| `
|
|
469
|
-
| `
|
|
470
|
-
|
|
471
|
-
The CLI reads credentials from the same `CS_*` environment variables described in [Configuration](#configuration).
|
|
488
|
+
| `npx @cipherstash/cli secrets set` | `-name`, `-value`, `-environment` | `-n`, `-V`, `-e` | Encrypt and store a secret |
|
|
489
|
+
| `npx @cipherstash/cli secrets get` | `-name`, `-environment` | `-n`, `-e` | Retrieve and decrypt a secret |
|
|
490
|
+
| `npx @cipherstash/cli secrets list` | `-environment` | `-e` | List all secret names in an environment |
|
|
491
|
+
| `npx @cipherstash/cli secrets delete` | `-name`, `-environment`, `-yes` | `-n`, `-e`, `-y` | Delete a secret (prompts for confirmation unless `-yes`) |
|
|
472
492
|
|
|
473
493
|
## Configuration
|
|
474
494
|
|
|
475
|
-
###
|
|
495
|
+
### Local Development
|
|
496
|
+
|
|
497
|
+
No environment variables or credentials are needed for local development. Run `npx @cipherstash/stack auth login` to authenticate via the device code flow, and the SDK and CLI will use the token saved to `~/.cipherstash/auth.json`.
|
|
498
|
+
|
|
499
|
+
### Going to Production
|
|
500
|
+
|
|
501
|
+
For production, CI/CD, and deployed environments, you'll need to set up machine credentials via environment variables:
|
|
476
502
|
|
|
477
503
|
| Variable | Description |
|
|
478
504
|
|-----|-------|
|
|
@@ -481,13 +507,7 @@ The CLI reads credentials from the same `CS_*` environment variables described i
|
|
|
481
507
|
| `CS_CLIENT_KEY` | Client key material used with ZeroKMS for encryption |
|
|
482
508
|
| `CS_CLIENT_ACCESS_KEY` | API key for authenticating with the CipherStash API |
|
|
483
509
|
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
Sign up at [cipherstash.com/signup](https://cipherstash.com/signup) and follow the onboarding to generate credentials.
|
|
487
|
-
|
|
488
|
-
### TOML Config
|
|
489
|
-
|
|
490
|
-
You can also configure credentials via `cipherstash.toml` and `cipherstash.secret.toml` files in your project root. See the [CipherStash docs](https://cipherstash.com/docs) for format details.
|
|
510
|
+
See the [Going to Production](https://cipherstash.com/docs/stack/going-to-production) guide for full details on creating machine clients, setting up access keys, and configuring CI/CD pipelines.
|
|
491
511
|
|
|
492
512
|
### Programmatic Config
|
|
493
513
|
|
|
@@ -656,7 +676,7 @@ If you are migrating from `@cipherstash/protect`, the following table maps the o
|
|
|
656
676
|
| `csColumn(name)` | `encryptedColumn(name)` | `@cipherstash/stack/schema` |
|
|
657
677
|
| `import { LockContext } from "@cipherstash/protect/identify"` | `import { LockContext } from "@cipherstash/stack/identity"` | `@cipherstash/stack/identity` |
|
|
658
678
|
| N/A | `Secrets` class | `@cipherstash/stack/secrets` |
|
|
659
|
-
| N/A |
|
|
679
|
+
| N/A | CLI | `npx @cipherstash/cli` |
|
|
660
680
|
|
|
661
681
|
All method signatures on the encryption client (`encrypt`, `decrypt`, `encryptModel`, etc.) remain the same. The `Result` pattern (`data` / `failure`) is unchanged.
|
|
662
682
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cipherstash/stack",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.0",
|
|
4
4
|
"description": "CipherStash Stack for TypeScript and JavaScript",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"encrypted",
|
|
@@ -27,9 +27,6 @@
|
|
|
27
27
|
"CHANGELOG.md"
|
|
28
28
|
],
|
|
29
29
|
"type": "module",
|
|
30
|
-
"bin": {
|
|
31
|
-
"stash": "./dist/bin/stash.js"
|
|
32
|
-
},
|
|
33
30
|
"main": "./dist/index.cjs",
|
|
34
31
|
"module": "./dist/index.js",
|
|
35
32
|
"sideEffects": false,
|
|
@@ -199,10 +196,10 @@
|
|
|
199
196
|
"access": "public"
|
|
200
197
|
},
|
|
201
198
|
"dependencies": {
|
|
202
|
-
"@byteslice/result": "
|
|
203
|
-
"@cipherstash/protect-ffi": "0.21.
|
|
204
|
-
"evlog": "
|
|
205
|
-
"uuid": "
|
|
199
|
+
"@byteslice/result": "0.2.0",
|
|
200
|
+
"@cipherstash/protect-ffi": "0.21.2",
|
|
201
|
+
"evlog": "1.9.0",
|
|
202
|
+
"uuid": "13.0.0",
|
|
206
203
|
"zod": "3.24.2"
|
|
207
204
|
},
|
|
208
205
|
"peerDependencies": {
|
|
@@ -222,7 +219,6 @@
|
|
|
222
219
|
},
|
|
223
220
|
"scripts": {
|
|
224
221
|
"build": "tsup",
|
|
225
|
-
"postbuild": "chmod +x ./dist/bin/stash.js",
|
|
226
222
|
"dev": "tsup --watch",
|
|
227
223
|
"test": "vitest run",
|
|
228
224
|
"release": "tsup"
|