@happyvertical/smrt-users 0.57.13 → 0.57.15
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/AGENTS.md +6 -1
- package/README.md +86 -0
- package/dist/chunks/PasswordCredentialService-CyB9FmYp.js +6092 -0
- package/dist/chunks/PasswordCredentialService-CyB9FmYp.js.map +1 -0
- package/dist/chunks/{TerminalAuthService-BdLiwaaO.js → TerminalAuthService-DUdmRz4P.js} +173 -6247
- package/dist/chunks/TerminalAuthService-DUdmRz4P.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +79 -4
- package/dist/index.js.map +1 -1
- package/dist/manifest.json +1 -1
- package/dist/operator.d.ts +32 -0
- package/dist/operator.d.ts.map +1 -0
- package/dist/operator.js +114 -0
- package/dist/operator.js.map +1 -0
- package/dist/password-readiness.d.ts +20 -0
- package/dist/password-readiness.d.ts.map +1 -0
- package/dist/services/PasswordCredentialService.d.ts +7 -0
- package/dist/services/PasswordCredentialService.d.ts.map +1 -1
- package/dist/smrt-knowledge.json +6 -5
- package/dist/sveltekit/resource-list-handler.d.ts.map +1 -1
- package/dist/sveltekit.js +54 -19
- package/dist/sveltekit.js.map +1 -1
- package/package.json +14 -10
- package/dist/chunks/TerminalAuthService-BdLiwaaO.js.map +0 -1
package/AGENTS.md
CHANGED
|
@@ -99,7 +99,12 @@ are not prerequisites for unrelated user-package work.
|
|
|
99
99
|
`setPin` ends that session; do not grant it authority another way.
|
|
100
100
|
- `UsersPasswordCredential` is one row per person, sensitive, with no
|
|
101
101
|
generated surface; `PasswordCredentialService` and its handlers are its only
|
|
102
|
-
read/write paths.
|
|
102
|
+
session-authorized read/write paths. The separate Node `./operator` entrypoint
|
|
103
|
+
provisions new PostgreSQL owners from trusted database custody, atomically;
|
|
104
|
+
never mount it in a browser/REST/MCP handler. Exact retries verify existing
|
|
105
|
+
credentials without writes; partial/conflicting identities fail closed.
|
|
106
|
+
See README "Trusted deployment owner provisioning".
|
|
107
|
+
Sign-in normalizes the email like `emailKey`, reserves
|
|
103
108
|
before work, always runs one scrypt verify (dummy hash when absent), never
|
|
104
109
|
creates a user, and maps every non-rate-limit refusal to one
|
|
105
110
|
`PasswordCredentialError`. It re-checks the credential after the mint (a
|
package/README.md
CHANGED
|
@@ -904,6 +904,14 @@ Other credential kinds (a fob or badge reader, say) implement
|
|
|
904
904
|
|
|
905
905
|
### Password sign-in
|
|
906
906
|
|
|
907
|
+
For a self-hosted public password deployment, set
|
|
908
|
+
`SMRT_AUTH_READINESS_MODULE=@happyvertical/smrt-users`. The existing
|
|
909
|
+
app-runtime provider-readiness factory then opens the configured PostgreSQL
|
|
910
|
+
database and requires the password, session, membership, and login-limiter
|
|
911
|
+
schema used by `PasswordCredentialService`; it never creates schema. Browser
|
|
912
|
+
owner bootstrap remains local-only, so production owners are provisioned by a
|
|
913
|
+
separate operator path.
|
|
914
|
+
|
|
907
915
|
`PasswordCredentialService` (#3274) gives an app without an identity provider
|
|
908
916
|
email-or-username + password sign-in for **existing, active** users. It never creates a
|
|
909
917
|
user. The password lives in its own object, `UsersPasswordCredential`
|
|
@@ -1092,6 +1100,57 @@ What the app must do:
|
|
|
1092
1100
|
|
|
1093
1101
|
Passkeys/WebAuthn are a separate credential (#3275).
|
|
1094
1102
|
|
|
1103
|
+
### Trusted deployment owner provisioning
|
|
1104
|
+
|
|
1105
|
+
Self-hosted password deployments keep browser owner bootstrap disabled. After
|
|
1106
|
+
building the app, run migrations and provision the owner from a trusted operator
|
|
1107
|
+
shell using the compiled registration entry. These commands need Node and the
|
|
1108
|
+
published packages, without a Vite runtime:
|
|
1109
|
+
|
|
1110
|
+
```sh
|
|
1111
|
+
node --import ./.smrt/runtime/register.js node_modules/@happyvertical/smrt-cli/bin/smrt.js db:migrate
|
|
1112
|
+
node --import ./.smrt/runtime/register.js node_modules/@happyvertical/smrt-cli/bin/smrt.js users:provision-owner \
|
|
1113
|
+
--tenant-id 2acb0135-6d63-40dc-a8d4-fd87d37cd197 --tenant-name Hearth \
|
|
1114
|
+
--user-id 753d9480-fd17-4f21-8771-345e83833fe3 \
|
|
1115
|
+
--email owner@example.com --username owner --password-stdin < /run/secrets/owner-password
|
|
1116
|
+
```
|
|
1117
|
+
|
|
1118
|
+
Use your own stable UUIDs and identities; retain them for retries. The database
|
|
1119
|
+
comes from normal CLI configuration (`packages.cli.database`, or `DATABASE_URL`
|
|
1120
|
+
and `DATABASE_TYPE=postgres`). Supply at least one email or username. The password
|
|
1121
|
+
must be one UTF-8 line; a final newline is removed. `--password-file` also accepts
|
|
1122
|
+
a regular mode-0400/0600 file (no final symlink); stdin redirection works with
|
|
1123
|
+
mounted secret symlinks. Password arguments and environment inputs are unsupported.
|
|
1124
|
+
|
|
1125
|
+
The Node-only `@happyvertical/smrt-users/operator` export provides
|
|
1126
|
+
`provisionPasswordOwner(db, input, passwordPolicy?)` for operator tools that use
|
|
1127
|
+
the application's custom password policy or pepper. The CLI uses the ordinary
|
|
1128
|
+
default policy. Never expose this function through browser, REST, MCP, or
|
|
1129
|
+
session handlers: possession of the database connection is its authority.
|
|
1130
|
+
|
|
1131
|
+
Provisioning supports PostgreSQL only. It creates the tenant, User, owner
|
|
1132
|
+
membership, and ordinary password credential in one transaction, without minting
|
|
1133
|
+
a session. A fresh authority catalog receives the standard roles and grants;
|
|
1134
|
+
existing role grants are never reseeded. Both creation and exact retries require
|
|
1135
|
+
at least one effective permission, resolved with tenant and membership DENY
|
|
1136
|
+
overrides inside that transaction. Existing restricted roles remain restricted;
|
|
1137
|
+
success does not promise every application permission. An empty or fully denied
|
|
1138
|
+
permission set refuses with the ordinary sanitized error and CLI exit status 1,
|
|
1139
|
+
rolling back new identities and leaving existing credentials and grants intact.
|
|
1140
|
+
If roles were initialized without grants, inspect the intended authority policy
|
|
1141
|
+
and explicitly seed approved grants using `RoleCollection.seedSystemRoles({
|
|
1142
|
+
seedPermissions: true })` from a trusted operator tool, or administer the desired
|
|
1143
|
+
restricted grants through the public role services, before retrying. Provisioning
|
|
1144
|
+
never restores deliberately revoked grants automatically.
|
|
1145
|
+
|
|
1146
|
+
An existing target tenant must be an
|
|
1147
|
+
active root tenant with the exact name and no memberships. Existing or partial
|
|
1148
|
+
User identities are refused except for a complete exact retry with the same
|
|
1149
|
+
active owner membership and password, which returns `unchanged` without writes.
|
|
1150
|
+
It never resets a password, reactivates an account, or adopts an ambiguous
|
|
1151
|
+
identity. After provisioning, the owner signs in using the normal password
|
|
1152
|
+
route. Local loopback bootstrap remains unchanged.
|
|
1153
|
+
|
|
1095
1154
|
### Request-scoped database access
|
|
1096
1155
|
|
|
1097
1156
|
Generated SvelteKit helpers and custom server code can read the current
|
|
@@ -1627,3 +1686,30 @@ settings. Instance-only storage fails closed on an invalidated connection; it
|
|
|
1627
1686
|
never silently drops PRAGMAs or temporary state. PostgreSQL does not require
|
|
1628
1687
|
this option. The [transaction notes](agents/oauth-authorization.md#recoverable-local-sqlite-connections)
|
|
1629
1688
|
show the factory contract.
|
|
1689
|
+
|
|
1690
|
+
### HTTP CLI collection action discovery
|
|
1691
|
+
|
|
1692
|
+
`createResourceListHandler` can discover custom actions on registered typed
|
|
1693
|
+
collections when `cli.include` names the methods and the API exposes them.
|
|
1694
|
+
Generated SvelteKit startup supplies the action host's discovery metadata,
|
|
1695
|
+
including collection ancestry; an undecorated domain collection parent retains
|
|
1696
|
+
its inherited behavior without extra annotations. Collection defaults,
|
|
1697
|
+
wildcard-only includes, and `mirror: 'api'` alone stay hidden; collection CRUD is never advertised. Static and instance collection
|
|
1698
|
+
methods use collection-scoped URLs. Explicit `@smrt({ collection })` chooses
|
|
1699
|
+
the route namespace independently of the backing model's storage.
|
|
1700
|
+
|
|
1701
|
+
When a collection inherits its item's namespace and both expose commands,
|
|
1702
|
+
discovery composes disjoint commands under the model's resource identity.
|
|
1703
|
+
The generated startup binds the exact live host constructor; composition requires
|
|
1704
|
+
that host's registered item model and the same canonical collection receiver.
|
|
1705
|
+
Each command retains its originating class's policy context and HTTP route.
|
|
1706
|
+
Denied commands are omitted independently. Explicit duplicate namespaces,
|
|
1707
|
+
unrelated resources, multiple hosts and overlapping command names/routes still
|
|
1708
|
+
fail closed as configuration collisions.
|
|
1709
|
+
|
|
1710
|
+
The existing `commandPolicy` filters these commands with the same session and
|
|
1711
|
+
class metadata as model resources. Discovery does not authorize execution or
|
|
1712
|
+
rows. Generated collection action writes still require the **item model's**
|
|
1713
|
+
collection permission (for example `items.submit`, even if the route is
|
|
1714
|
+
`/api/operations/submit`), and domain actions retain their tenant checks. See
|
|
1715
|
+
[collection action resources](../core/agents/generators.md#explicit-collection-action-resources).
|