@ctx-core/jwt 10.3.61 → 10.4.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
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ctx-core/jwt",
|
|
3
|
-
"version": "10.
|
|
3
|
+
"version": "10.4.0",
|
|
4
4
|
"description": "ctx-core jwt",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ctx-core",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"./package.json": "./package.json"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@ctx-core/atob": "^10.1.
|
|
27
|
+
"@ctx-core/atob": "^10.1.53",
|
|
28
28
|
"@ctx-core/error": "^11.6.20",
|
|
29
29
|
"@ctx-core/function": "^21.12.1"
|
|
30
30
|
},
|
package/src/index.d.ts
CHANGED
package/src/index.js
CHANGED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { bad_credentials_error_ } from '@ctx-core/error'
|
|
2
|
+
import { jwt__expiration__is_valid_ } from '../jwt__expiration__is_valid_/index.js'
|
|
3
|
+
/**
|
|
4
|
+
* @param {string}jwt_token
|
|
5
|
+
* @returns {import('@ctx-core/error').BadCredentialsError}
|
|
6
|
+
*/
|
|
7
|
+
export function jwt__expiration__error_(jwt_token) {
|
|
8
|
+
return (
|
|
9
|
+
jwt__expiration__is_valid_(jwt_token)
|
|
10
|
+
? null
|
|
11
|
+
: bad_credentials_error_({
|
|
12
|
+
data: { jwt_token },
|
|
13
|
+
error_message: 'Session Expired'
|
|
14
|
+
})
|
|
15
|
+
)
|
|
16
|
+
}
|
|
@@ -1,15 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { jwt__expiration__is_valid_ } from '../jwt__expiration__is_valid_/index.js'
|
|
1
|
+
import { jwt__expiration__error_ } from '../jwt__expiration__error_/index.js'
|
|
3
2
|
/**
|
|
4
3
|
* @param {string}jwt_token
|
|
5
4
|
*/
|
|
6
5
|
export function jwt__expiration__validate(jwt_token) {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
data: { jwt_token },
|
|
10
|
-
error_message: 'Session Expired'
|
|
11
|
-
})
|
|
12
|
-
}
|
|
6
|
+
const jwt__expiration__error = jwt__expiration__error_(jwt_token)
|
|
7
|
+
if (jwt__expiration__error) throw jwt__expiration__error
|
|
13
8
|
}
|
|
14
9
|
export {
|
|
15
10
|
jwt__expiration__validate as validate_current_jwt,
|