@molecule/api-resource-user 1.4.12 → 1.4.14
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 +1375 -478
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -20,6 +20,13 @@
|
|
|
20
20
|
* so a handler reads the current user with `getUserId(res)` and does NOT add per-route auth
|
|
21
21
|
* middleware (see the `auth` skill). Scope every custom user query by the authenticated id.
|
|
22
22
|
*
|
|
23
|
+
* **Issuing a session yourself:** the middleware accepts both `Authorization: Bearer <jwt>`
|
|
24
|
+
* and `Authorization: Token <jwt>` (RealWorld's scheme), but only for a token whose
|
|
25
|
+
* `deviceId` names an ACTIVE row in `devices`. A JWT you `sign()` with an invented `deviceId`
|
|
26
|
+
* is answered 401 on every route. Mint sessions the way the built-in login does — create the
|
|
27
|
+
* device with `get('device').createOrUpdate(userId, deviceName)` (it returns the device id; or call
|
|
28
|
+
* `authorization.set(…)`) and sign that id — instead of inventing one.
|
|
29
|
+
*
|
|
23
30
|
* **Revoking a session yourself:** the middleware caches "this device exists" for 10 s per
|
|
24
31
|
* process, so a hand-written logout that deletes the `devices` row keeps authorizing that
|
|
25
32
|
* token until the cache expires — a check right after logout still answers 200. Call
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkGG;AAEH,OAAO,KAAK,aAAa,MAAM,oBAAoB,CAAA;AACnD,OAAO,KAAK,WAAW,MAAM,wBAAwB,CAAA;AACrD,cAAc,oBAAoB,CAAA;AAClC,OAAO,KAAK,QAAQ,MAAM,qBAAqB,CAAA;AAC/C,cAAc,WAAW,CAAA;AACzB,cAAc,wBAAwB,CAAA;AACtC,cAAc,eAAe,CAAA;AAC7B,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,cAAc,CAAA;AAC5B,OAAO,KAAK,KAAK,MAAM,YAAY,CAAA;AACnC,OAAO,KAAK,SAAS,MAAM,sBAAsB,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -20,6 +20,13 @@
|
|
|
20
20
|
* so a handler reads the current user with `getUserId(res)` and does NOT add per-route auth
|
|
21
21
|
* middleware (see the `auth` skill). Scope every custom user query by the authenticated id.
|
|
22
22
|
*
|
|
23
|
+
* **Issuing a session yourself:** the middleware accepts both `Authorization: Bearer <jwt>`
|
|
24
|
+
* and `Authorization: Token <jwt>` (RealWorld's scheme), but only for a token whose
|
|
25
|
+
* `deviceId` names an ACTIVE row in `devices`. A JWT you `sign()` with an invented `deviceId`
|
|
26
|
+
* is answered 401 on every route. Mint sessions the way the built-in login does — create the
|
|
27
|
+
* device with `get('device').createOrUpdate(userId, deviceName)` (it returns the device id; or call
|
|
28
|
+
* `authorization.set(…)`) and sign that id — instead of inventing one.
|
|
29
|
+
*
|
|
23
30
|
* **Revoking a session yourself:** the middleware caches "this device exists" for 10 s per
|
|
24
31
|
* process, so a hand-written logout that deletes the `devices` row keeps authorizing that
|
|
25
32
|
* token until the cache expires — a check right after logout still answers 200. Call
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkGG;AAEH,OAAO,KAAK,aAAa,MAAM,oBAAoB,CAAA;AACnD,OAAO,KAAK,WAAW,MAAM,wBAAwB,CAAA;AACrD,cAAc,oBAAoB,CAAA;AAClC,OAAO,KAAK,QAAQ,MAAM,qBAAqB,CAAA;AAC/C,cAAc,WAAW,CAAA;AACzB,cAAc,wBAAwB,CAAA;AACtC,cAAc,eAAe,CAAA;AAC7B,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,cAAc,CAAA;AAC5B,OAAO,KAAK,KAAK,MAAM,YAAY,CAAA;AACnC,OAAO,KAAK,SAAS,MAAM,sBAAsB,CAAA"}
|