@nxgt/janus-drizzle 0.2.0 → 0.2.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 +3 -3
- package/docs/guide/migrations.md +7 -5
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -113,9 +113,9 @@ table plays that role, written in the same transaction as the user.
|
|
|
113
113
|
|
|
114
114
|
Every key column is `text collate "C"`, compared byte for byte as the port
|
|
115
115
|
requires. No secret is stored: sessions and tokens hold `sha256` of the secret,
|
|
116
|
-
passwords a self-describing hash, and `second_factor_secret` a TOTP secret
|
|
117
|
-
|
|
118
|
-
|
|
116
|
+
passwords a self-describing hash, and `second_factor_secret` a TOTP secret
|
|
117
|
+
`@nxgt/janus` has already sealed with your application's key —
|
|
118
|
+
`v1.<key id>.…` — which the store keeps byte for byte.
|
|
119
119
|
|
|
120
120
|
## Traps
|
|
121
121
|
|
package/docs/guide/migrations.md
CHANGED
|
@@ -134,9 +134,11 @@ migration creates is what the conformance suites ran on.
|
|
|
134
134
|
- **A second factor in four columns, checked whole.** A method and a secret,
|
|
135
135
|
or neither; a confirmation date and a last step only beside them; `totp`
|
|
136
136
|
the only method, and a last step never negative. The
|
|
137
|
-
secret is opaque to the store and kept byte for byte:
|
|
138
|
-
|
|
139
|
-
|
|
137
|
+
secret is opaque to the store and kept byte for byte: `@nxgt/janus` seals
|
|
138
|
+
it before the store sees it, so a dump of `users` cannot produce a code.
|
|
139
|
+
Its key id is the second part of the value, so
|
|
140
|
+
`where second_factor_secret like 'v1.<id>.%'` finds the secrets still sealed
|
|
141
|
+
with a key being [rotated out](https://github.com/softistx/nxgt-janus/blob/develop/packages/janus/docs/guide/second-factor.md#rotating-the-keys).
|
|
140
142
|
- **`attempts` is `not null default 0`**, checked `>= 0`, so the rows an upgrade finds read
|
|
141
143
|
as tokens with no attempt counted yet.
|
|
142
144
|
- **No foreign key from sessions and tokens to users.** Deleting a user
|
|
@@ -214,6 +216,6 @@ const patients = row?.patients ?? 0;
|
|
|
214
216
|
```
|
|
215
217
|
|
|
216
218
|
**Read, never write.** A row written behind the store's back skips its
|
|
217
|
-
invariants: the logins' uniqueness, `version`, the password check, and
|
|
218
|
-
|
|
219
|
+
invariants: the logins' uniqueness, `version`, the password check, and the
|
|
220
|
+
sealing of a second factor's secret. Write through
|
|
219
221
|
`auth` and `access`.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nxgt/janus-drizzle",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "The PostgreSQL adapter for @nxgt/janus on Drizzle and @nxgt/drizzle: users, sessions, one-time tokens and permission tuples",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"@electric-sql/pglite": "0.5.8",
|
|
53
53
|
"@nxgt/drizzle": "0.6.1",
|
|
54
|
-
"@nxgt/janus": "^0.
|
|
54
|
+
"@nxgt/janus": "^0.5.0",
|
|
55
55
|
"@types/bun": "^1.4.2",
|
|
56
56
|
"@types/pg": "^8.23.1",
|
|
57
57
|
"drizzle-kit": "1.0.0-rc.4",
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
},
|
|
63
63
|
"peerDependencies": {
|
|
64
64
|
"@nxgt/drizzle": ">=0.6.1 <1",
|
|
65
|
-
"@nxgt/janus": "^0.
|
|
65
|
+
"@nxgt/janus": "^0.5.0",
|
|
66
66
|
"drizzle-orm": ">=1.0.0-rc.4 <2",
|
|
67
67
|
"typescript": "^6.0.3"
|
|
68
68
|
}
|