pontive 1.18.0 → 1.20.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 +137 -4
- package/dist/cli.js +2390 -433
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@ instance into your workspace whenever you sign up.
|
|
|
9
9
|
npx pontive@latest init
|
|
10
10
|
```
|
|
11
11
|
|
|
12
|
-
Node.js 20 or later. Nothing to install first.
|
|
12
|
+
Node.js 20.16 or later, or 22.3 or later. Nothing to install first.
|
|
13
13
|
|
|
14
14
|
## Commands
|
|
15
15
|
|
|
@@ -19,6 +19,7 @@ Node.js 20 or later. Nothing to install first.
|
|
|
19
19
|
| `pontive claim` | Mints a claim link, opens it in your browser, and waits up to 5 minutes for the claim. |
|
|
20
20
|
| `pontive status` | The instance, its region, when it is deleted unless claimed (or that it is claimed), and which `PONTIVE_*` variables are set. Names only, never values. |
|
|
21
21
|
| `pontive init --reset` | Creates a new unclaimed instance and points `.env.local` at it, after asking (or with `--yes`). |
|
|
22
|
+
| `pontive migrate` | Moves users, passwords, TOTP, social sign-ins and organizations from Auth0, Clerk, Supabase, Firebase or Cognito into an instance. See [Migrating users](#migrating-users-pontive-migrate). |
|
|
22
23
|
|
|
23
24
|
`pontive <command> --help` lists each command's options.
|
|
24
25
|
|
|
@@ -26,8 +27,8 @@ Node.js 20 or later. Nothing to install first.
|
|
|
26
27
|
|
|
27
28
|
| Framework | Detected by | Installs | Writes |
|
|
28
29
|
| --- | --- | --- | --- |
|
|
29
|
-
| Next.js | `next` | `@pontive/pontkit-nextjs` | `lib/pontive.ts
|
|
30
|
-
| Vite + React | `vite` and `react` | `@pontive/pontkit-react`, `@pontive/pontkit-loader` | `src/pontive.tsx` (the provider), `vite.pontive.ts` (the dev server's `/__pontive` proxy) |
|
|
30
|
+
| Next.js | `next` | `@pontive/pontkit-nextjs` | `lib/pontive.ts` (`pontiveAuth()`), `app/api/auth/[...pontive]/route.ts`, `app/pontive-provider.tsx` (rendered with `pontive.providerProps()`, so no `NEXT_PUBLIC_` copy), `middleware.ts` (`proxy.ts` from Next 16); under `src/` when the app is |
|
|
31
|
+
| Vite + React | `vite` and `react` | `@pontive/pontkit-react`, `@pontive/pontkit-loader` | `src/pontive.tsx` (the provider), `vite.pontive.ts` (the dev server's `/__pontive` proxy; it hands the browser the client id and no other variable) |
|
|
31
32
|
| Express | `express` | `@pontive/pontkit-server` | `pontive.ts`: `pontiveRoutes` and `pontiveSession` middleware |
|
|
32
33
|
| Node | anything else | `@pontive/pontkit-server` | `pontive.ts`: `handlePontive(req, res)` for `node:http` |
|
|
33
34
|
|
|
@@ -52,7 +53,9 @@ and writes:
|
|
|
52
53
|
|
|
53
54
|
The secrets come back encrypted to a P-256 key the CLI generates for the call
|
|
54
55
|
and keeps only in memory, so they never travel in a response body anything in
|
|
55
|
-
between could keep.
|
|
56
|
+
between could keep. The files are written by `@pontive/pontkit-server/keyless`,
|
|
57
|
+
the same code pontkit's dev server uses in keyless mode, under the same lock
|
|
58
|
+
(`.pontive/keyless.lock`), so the two never create two instances. An instance already in `.pontive/keyless.json`, or already
|
|
56
59
|
configured in `.env.local`, is used rather than replaced.
|
|
57
60
|
|
|
58
61
|
| Option | |
|
|
@@ -90,6 +93,134 @@ says so and stops (exit `5`); it never creates a replacement silently, since
|
|
|
90
93
|
the new instance would have none of your users. `pontive init --reset` creates
|
|
91
94
|
a new one when you choose to.
|
|
92
95
|
|
|
96
|
+
## Migrating users: `pontive migrate`
|
|
97
|
+
|
|
98
|
+
Moves users, their passwords, TOTP and social sign-ins, and organizations with
|
|
99
|
+
their members from another system into a Pontive instance. Everything goes
|
|
100
|
+
through the management API with the instance's secret key, read from
|
|
101
|
+
`PONTIVE_SECRET_KEY` (never a flag); the key's region picks the API
|
|
102
|
+
(`pontive_sk_live_us_…` → `api.us.pontive.com`), and `PONTIVE_MGMT_URL`
|
|
103
|
+
overrides it in development.
|
|
104
|
+
|
|
105
|
+
```sh
|
|
106
|
+
export PONTIVE_SECRET_KEY=pontive_sk_live_us_…
|
|
107
|
+
pontive migrate source create --name "Auth0 production" --type auth0 # → msrc_…
|
|
108
|
+
pontive migrate export auth0 --hashes hashes.ndjson # → pontive-users.ndjson
|
|
109
|
+
pontive migrate import pontive-users.ndjson --source msrc_… # a dry run
|
|
110
|
+
pontive migrate import pontive-users.ndjson --source msrc_… --apply # asks, then imports
|
|
111
|
+
pontive migrate records uimp_… --outcome failed
|
|
112
|
+
pontive migrate revert uimp_… --apply # undo
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
| Subcommand | Does |
|
|
116
|
+
| --- | --- |
|
|
117
|
+
| `export <provider> [--out file]` | Writes the provider's users, then its organizations, as `pontive-users/v1`. |
|
|
118
|
+
| `import <file> [--run uimp_…] [--source msrc_…] [--apply]` | Creates an import run (or uses `--run`), sends users in batches of 100, then organizations in batches of 100 rows and 1,000 members, one batch at a time. |
|
|
119
|
+
| `run <provider> --source msrc_… [--apply]` | `export` and `import` in one go, with nothing written to disk. |
|
|
120
|
+
| `status [uimp_…]` | A run with its options and counters, or the latest runs. |
|
|
121
|
+
| `records <uimp_…> [--outcome failed] [--kind user\|organization]` | Every record of a run, page by page. |
|
|
122
|
+
| `revert <uimp_…> [--apply]` | What the run created that can be deleted; with `--apply`, deletes it, calling until nothing remains. |
|
|
123
|
+
| `source create\|get\|update\|validate\|list\|delete` | Migration sources: `--name`, `--type`, and Firebase's hash parameters. |
|
|
124
|
+
|
|
125
|
+
**Dry run first, always.** `import`, `run` and `revert` only dry-run without
|
|
126
|
+
`--apply`: every batch is sent with `dry_run: true` and the report says what
|
|
127
|
+
would happen. With `--apply` the CLI runs the full dry run, prints its
|
|
128
|
+
summary, asks, and then applies the same batches. `--yes` answers the
|
|
129
|
+
question. In a dry run, an organization whose members are users the same
|
|
130
|
+
import creates is reported as *pending users*, not failed: a dry run creates
|
|
131
|
+
no users for it to find.
|
|
132
|
+
|
|
133
|
+
**Resumable.** `import` keeps `.pontive-import-state.json` beside the file:
|
|
134
|
+
the run, the file's SHA-256, the phase and the last batch applied. Run the
|
|
135
|
+
same command again and it continues in the same run from the next batch;
|
|
136
|
+
batches are idempotent anyway, since a re-sent row matches what it created and
|
|
137
|
+
is skipped. Changing the run's options part way is refused; delete the state
|
|
138
|
+
file to start a new run.
|
|
139
|
+
|
|
140
|
+
**Import options**, fixed on the run once its first batch is applied:
|
|
141
|
+
|
|
142
|
+
| Option | |
|
|
143
|
+
| --- | --- |
|
|
144
|
+
| `--on-existing skip\|update` | A row matching an existing user, by its legacy id or `external_id` (never by email). Default `skip`. |
|
|
145
|
+
| `--allow-weak-passwords` | An imported password that breaks the password policy is not forced to change at first sign-in. |
|
|
146
|
+
| `--identity-connection google=app_…:google` | Import external identities of that type into that app's connection. Repeatable. Without one for a type, those identities are left out (counted in the report) and the users re-link by email at their first sign-in. |
|
|
147
|
+
| `--totp-app app_…` | Store imported TOTP secrets under that app's issuer. Repeatable. Without one, TOTP secrets are left out and the users enroll again. |
|
|
148
|
+
| `--no-events` | No `pontive.user.created` per imported user. |
|
|
149
|
+
| `--role-map org:admin=owner,org:member=member` | Organization roles. With a map, a member holding a role it does not name is left out and reported (`role_not_mapped`); without one, roles are sent as exported. A new organization needs an `owner`. |
|
|
150
|
+
| `--name <name>` | The run's name. |
|
|
151
|
+
| `--delete-after` | With `--apply`: delete the file and its state once applied. |
|
|
152
|
+
|
|
153
|
+
**The report** at the end has the counts (created, updated, skipped, failed)
|
|
154
|
+
for users and organizations, the failures grouped by error code with the rows'
|
|
155
|
+
keys (`identifier_conflict`, `owners_required`, `password_hash_invalid`, …),
|
|
156
|
+
the warnings, how many password users were exported without a hash (they set
|
|
157
|
+
a new password by email at their first Pontive sign-in), and what to do next.
|
|
158
|
+
|
|
159
|
+
### Exporters
|
|
160
|
+
|
|
161
|
+
Each reads its provider's own credentials from the environment. The heavy SDKs
|
|
162
|
+
are not installed with `pontive`: run with `npx -p pontive -p pg pontive …`,
|
|
163
|
+
or `npm install --no-save pg` in the directory, and the CLI says which.
|
|
164
|
+
|
|
165
|
+
| Provider | Reads | Environment | Passwords | TOTP | Organizations |
|
|
166
|
+
| --- | --- | --- | --- | --- | --- |
|
|
167
|
+
| `auth0` | Management API users export job; organizations and members with roles | `AUTH0_DOMAIN`, `AUTH0_CLIENT_ID`, `AUTH0_CLIENT_SECRET` (scopes `read:users`, `read:organizations`, `read:organization_members`, `read:organization_member_roles`) | bcrypt, from Auth0 support's hash export, decrypted, with `--hashes <file>` | not exported | yes |
|
|
168
|
+
| `clerk` | Backend API users, organizations, memberships | `CLERK_SECRET_KEY` | from the dashboard's CSV export, `--csv <file>` | from the same CSV | yes |
|
|
169
|
+
| `supabase` | `auth.users`, `auth.identities`, `auth.mfa_factors` over Postgres; never the app's tables | `SUPABASE_DB_URL` (or `--db-url`); needs `pg` | bcrypt | verified TOTP factors | none |
|
|
170
|
+
| `firebase` | Admin SDK `listUsers` | `GOOGLE_APPLICATION_CREDENTIALS`; needs `firebase-admin` | Firebase scrypt; the account needs `firebaseauth.configs.getHashConfig` | not exportable | none |
|
|
171
|
+
| `cognito` | `ListUsers`, groups as `metadata.cognito_groups` | AWS credentials, `--user-pool-id`; needs `@aws-sdk/client-cognito-identity-provider` | none: users reset | none | none |
|
|
172
|
+
|
|
173
|
+
`--external-id none` leaves `external_id` unset; by default it is the
|
|
174
|
+
provider's user id, as `legacy_subject` always is, so an app whose database
|
|
175
|
+
keys users by the old id keeps working. Users without an email (phone-only)
|
|
176
|
+
are left out and listed: Pontive requires one. Microsoft and Entra identities
|
|
177
|
+
are left out (their subject differs per app registration, so Pontive cannot
|
|
178
|
+
import it); those users re-link by email. Firebase's hash parameters go on the
|
|
179
|
+
migration source, never in the file:
|
|
180
|
+
|
|
181
|
+
```sh
|
|
182
|
+
FIREBASE_SIGNER_KEY=… pontive migrate source create --name Firebase --type firebase \
|
|
183
|
+
--salt-separator Bw== --rounds 8 --mem-cost 14 # or --hash-config <file>
|
|
184
|
+
PONTIVE_SAMPLE_PASSWORD=… pontive migrate source validate msrc_… --file pontive-users.ndjson --email known@user.com
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
### The `pontive-users/v1` format
|
|
188
|
+
|
|
189
|
+
NDJSON, one JSON object per line. Any system can write it and skip `export`:
|
|
190
|
+
|
|
191
|
+
```json
|
|
192
|
+
{"format":"pontive-users/v1","source_type":"auth0","exported_at":"2026-12-02T10:00:00Z"}
|
|
193
|
+
{"kind":"user","legacy_subject":"auth0|65f2c1…","email":"jane@acme.com","email_verified":true,"password_hash":{"hasher":"bcrypt","value":"$2b$10$…"}}
|
|
194
|
+
{"kind":"organization","external_id":"org_8Hq2…","name":"Acme Corp","members":[{"legacy_subject":"auth0|65f2c1…","roles":["owner"]}]}
|
|
195
|
+
{"kind":"summary","users":1,"organizations":1,"password_users_without_hash":0}
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
- The header (first line) and the summary (last line) are optional.
|
|
199
|
+
- A `user` line is `POST /v1/users/import`'s user object, an `organization`
|
|
200
|
+
line `POST /v1/organizations/import`'s organization object, each with
|
|
201
|
+
`kind` beside its fields. Users come before organizations.
|
|
202
|
+
- `legacy_subject` needs a migration source on the run (`--source`).
|
|
203
|
+
|
|
204
|
+
An export holds password hashes and TOTP secrets: the CLI writes it with mode
|
|
205
|
+
`0600` and refuses to overwrite one (`--force`). Keep it out of git and delete
|
|
206
|
+
it once imported (`--delete-after`). The CLI never prints a credential, hash,
|
|
207
|
+
TOTP secret or password.
|
|
208
|
+
|
|
209
|
+
### Agent mode
|
|
210
|
+
|
|
211
|
+
As for every command (below): JSON only on stdout, and never a prompt, so
|
|
212
|
+
`import --apply`, `run --apply`, `revert --apply` and `source delete` need
|
|
213
|
+
`--yes`; without it they stop before calling anything, with exit `2`. An
|
|
214
|
+
agent runs the dry run, reads its `report`, and applies with
|
|
215
|
+
`--apply --yes`.
|
|
216
|
+
|
|
217
|
+
```json
|
|
218
|
+
{ "ok": true, "command": "migrate", "run_id": "uimp_…", "applied": false,
|
|
219
|
+
"report": { "dry_run": true, "users": { "created": 97, "updated": 0, "skipped": 1, "failed": 2 },
|
|
220
|
+
"failures": [{ "code": "identifier_conflict", "kind": "user", "count": 2, "keys": ["auth0|7a01…", "jo@acme.com"] }],
|
|
221
|
+
"password_users_without_hash": 0, "next_steps": ["…"] } }
|
|
222
|
+
```
|
|
223
|
+
|
|
93
224
|
## Agent mode
|
|
94
225
|
|
|
95
226
|
On when `CLAUDECODE`, `CURSOR_AGENT`, `CODEX_SANDBOX`, `GEMINI_CLI` or `CI` is
|
|
@@ -125,6 +256,8 @@ with the same idempotency key, so a retry never creates a second instance.
|
|
|
125
256
|
| Variable | |
|
|
126
257
|
| --- | --- |
|
|
127
258
|
| `PONTIVE_API_URL` | Where the provisioning routes live. Default `https://api.pontive.com`. |
|
|
259
|
+
| `PONTIVE_SECRET_KEY` | `migrate`: the instance's secret key. |
|
|
260
|
+
| `PONTIVE_MGMT_URL` | `migrate`: the management API. Default `https://api.{region}.pontive.com`, the key's region. |
|
|
128
261
|
| `PONTIVE_REGION` | The default for `--region`. |
|
|
129
262
|
| `PONTIVE_MCP_URL` | The MCP server `init` connects agents to. Default `https://mcp.<region>.pontive.com/mcp`. |
|
|
130
263
|
|