@ctx-core/jwt 10.0.27 → 10.0.32

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/.swcrc CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "jsc": {
3
- "target": "es2019",
3
+ "target": "es2020",
4
4
  "parser": {
5
5
  "syntax": "typescript",
6
6
  "tsx": true,
package/CHANGELOG.md CHANGED
@@ -1,5 +1,55 @@
1
1
  # @ctx-core/jwt
2
2
 
3
+ ## 10.0.32
4
+
5
+ ### Patch Changes
6
+
7
+ - @swc/cli: ^0.1.51 -> ^0.1.52
8
+ - @swc/core: ^1.2.111 -> ^1.2.113
9
+ - Updated dependencies
10
+ - Updated dependencies
11
+ - @ctx-core/atob@10.0.27
12
+ - @ctx-core/error@11.1.3
13
+ - @ctx-core/function@20.2.7
14
+
15
+ ## 10.0.31
16
+
17
+ ### Patch Changes
18
+
19
+ - @swc/core: ^1.2.110 -> ^1.2.111
20
+ - Updated dependencies
21
+ - @ctx-core/atob@10.0.26
22
+ - @ctx-core/error@11.1.2
23
+ - @ctx-core/function@20.2.6
24
+
25
+ ## 10.0.30
26
+
27
+ ### Patch Changes
28
+
29
+ - typescript: ^4.4.4 -> ^4.5.2
30
+ - @swc/core: ^1.2.108 -> ^1.2.110
31
+ - Updated dependencies
32
+ - Updated dependencies
33
+ - @ctx-core/atob@10.0.25
34
+ - @ctx-core/error@11.0.20
35
+ - @ctx-core/function@20.2.5
36
+
37
+ ## 10.0.29
38
+
39
+ ### Patch Changes
40
+
41
+ - @swc/core: ^1.2.107 -> ^1.2.108
42
+ - Updated dependencies
43
+ - @ctx-core/atob@10.0.24
44
+ - @ctx-core/error@11.0.19
45
+ - @ctx-core/function@20.2.4
46
+
47
+ ## 10.0.28
48
+
49
+ ### Patch Changes
50
+
51
+ - ?. instead of &&
52
+
3
53
  ## 10.0.27
4
54
 
5
55
  ### Patch Changes
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/JwtToken.ts"],"sourcesContent":["import type { maybe, nullish } from '@ctx-core/function'\nimport type { error_ctx_I } from '@ctx-core/error'\nexport interface Token {\n\taccess_token: string\n\ttoken_type: string\n\tid_token?:string\n\temail?:string\n\terror?:maybe<error_ctx_I, nullish>\n}\n"],"names":[],"mappings":"AAAA,MAAM"}
1
+ {"version":3,"sources":["../src/JwtToken.ts"],"sourcesContent":["import type { error_ctx_I } from '@ctx-core/error'\nimport type { maybe, nullish } from '@ctx-core/function'\nexport interface Token {\n\taccess_token: string\n\ttoken_type: string\n\tid_token?:string\n\temail?:string\n\terror?:maybe<error_ctx_I, nullish>\n}\n"],"names":[],"mappings":"AAAA,MAAM"}
@@ -1,5 +1,5 @@
1
1
  export function header_authorization_jwt_token_(authorization) {
2
- const authorization_a = authorization && authorization.split(/^Bearer */);
2
+ const authorization_a = authorization === null || authorization === void 0 ? void 0 : authorization.split(/^Bearer */);
3
3
  return authorization_a ? authorization_a[1] : undefined;
4
4
  }
5
5
  export { header_authorization_jwt_token_ as _header_authorization_jwt_token, header_authorization_jwt_token_ as _jwt_token__authorization__header, };
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/header_authorization_jwt_token_.ts"],"sourcesContent":["import type { nullish } from '@ctx-core/function'\nexport function header_authorization_jwt_token_(authorization:string|nullish):string|undefined {\n\tconst authorization_a = authorization && authorization.split(/^Bearer */)\n\treturn authorization_a ? authorization_a[1] : undefined\n}\nexport {\n\theader_authorization_jwt_token_ as _header_authorization_jwt_token,\n\theader_authorization_jwt_token_ as _jwt_token__authorization__header,\n}\n"],"names":["header_authorization_jwt_token_","authorization","authorization_a","split","undefined","_header_authorization_jwt_token","_jwt_token__authorization__header"],"mappings":"AACA,MAAM,UAAUA,+BAA+B,CAACC,aAA4B,EAAmB,CAAC;IAC/F,KAAK,CAACC,eAAe,GAAGD,aAAa,IAAIA,aAAa,CAACE,KAAK;IAC5D,MAAM,CAACD,eAAe,GAAGA,eAAe,CAAC,CAAC,IAAIE,SAAS;AACxD,CAAC;AACD,MAAM,GACLJ,+BAA+B,IAAIK,+BAA+B,EAClEL,+BAA+B,IAAIM,iCAAiC"}
1
+ {"version":3,"sources":["../src/header_authorization_jwt_token_.ts"],"sourcesContent":["import type { nullish } from '@ctx-core/function'\nexport function header_authorization_jwt_token_(authorization:string|nullish):string|undefined {\n\tconst authorization_a = authorization?.split(/^Bearer */)\n\treturn authorization_a ? authorization_a[1] : undefined\n}\nexport {\n\theader_authorization_jwt_token_ as _header_authorization_jwt_token,\n\theader_authorization_jwt_token_ as _jwt_token__authorization__header,\n}\n"],"names":["header_authorization_jwt_token_","authorization","authorization_a","split","undefined","_header_authorization_jwt_token","_jwt_token__authorization__header"],"mappings":"AACA,MAAM,UAAUA,+BAA+B,CAACC,aAA4B,EAAmB,CAAC;IAC/F,KAAK,CAACC,eAAe,GAAGD,aAAa,aAAbA,aAAa,KAAbA,IAAI,CAAJA,CAAoB,GAApBA,IAAI,CAAJA,CAAoB,GAApBA,aAAa,CAAEE,KAAK;IAC5C,MAAM,CAACD,eAAe,GAAGA,eAAe,CAAC,CAAC,IAAIE,SAAS;AACxD,CAAC;AACD,MAAM,GACLJ,+BAA+B,IAAIK,+BAA+B,EAClEL,+BAA+B,IAAIM,iCAAiC"}
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  export * from './header_authorization_jwt_token_.js';
2
- export * from './jwt_token_exp_.js';
3
2
  export * from './jwt_error_ctx_I.js';
3
+ export * from './jwt_token_exp_.js';
4
4
  export * from './JwtToken.js';
5
5
  export * from './validate_current_jwt.js';
6
6
 
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["export * from './header_authorization_jwt_token_.js'\nexport * from './jwt_token_exp_.js'\nexport * from './jwt_error_ctx_I.js'\nexport * from './JwtToken.js'\nexport * from './validate_current_jwt.js'\n"],"names":[],"mappings":"cAAc,CAAsC;cACtC,CAAqB;cACrB,CAAsB;cACtB,CAAe;cACf,CAA2B"}
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["export * from './header_authorization_jwt_token_.js'\nexport * from './jwt_error_ctx_I.js'\nexport * from './jwt_token_exp_.js'\nexport * from './JwtToken.js'\nexport * from './validate_current_jwt.js'\n"],"names":[],"mappings":"cAAc,CAAsC;cACtC,CAAsB;cACtB,CAAqB;cACrB,CAAe;cACf,CAA2B"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/jwt_token_exp_.ts"],"sourcesContent":["import type { nullish } from '@ctx-core/function'\nimport { atob_ } from '@ctx-core/atob'\nexport function jwt_token_exp_(jwt_token:string|nullish):number {\n\tconst atob = atob_()\n\tconst jwt_data = jwt_token && JSON.parse(atob(jwt_token.split('.')[1]))\n\treturn jwt_data?.exp\n}\nexport {\n\tjwt_token_exp_ as _jwt_token_exp,\n\tjwt_token_exp_ as _exp__jwt_token,\n}\n"],"names":["atob_","jwt_token_exp_","jwt_token","atob","jwt_data","JSON","parse","split","exp","_jwt_token_exp","_exp__jwt_token"],"mappings":"AACA,MAAM,GAAGA,KAAK,QAAQ,CAAgB;AACtC,MAAM,UAAUC,cAAc,CAACC,SAAwB,EAAS,CAAC;IAChE,KAAK,CAACC,IAAI,GAAGH,KAAK;IAClB,KAAK,CAACI,QAAQ,GAAGF,SAAS,IAAIG,IAAI,CAACC,KAAK,CAACH,IAAI,CAACD,SAAS,CAACK,KAAK,CAAC,CAAG,IAAE,CAAC;IACpE,MAAM,CAACH,QAAQ,aAARA,QAAQ,KAARA,IAAI,CAAJA,CAAa,GAAbA,IAAI,CAAJA,CAAa,GAAbA,QAAQ,CAAEI,GAAG;AACrB,CAAC;AACD,MAAM,GACLP,cAAc,IAAIQ,cAAc,EAChCR,cAAc,IAAIS,eAAe"}
1
+ {"version":3,"sources":["../src/jwt_token_exp_.ts"],"sourcesContent":["import { atob_ } from '@ctx-core/atob'\nimport type { nullish } from '@ctx-core/function'\nexport function jwt_token_exp_(jwt_token:string|nullish):number {\n\tconst atob = atob_()\n\tconst jwt_data = jwt_token && JSON.parse(atob(jwt_token.split('.')[1]))\n\treturn jwt_data?.exp\n}\nexport {\n\tjwt_token_exp_ as _jwt_token_exp,\n\tjwt_token_exp_ as _exp__jwt_token,\n}\n"],"names":["atob_","jwt_token_exp_","jwt_token","atob","jwt_data","JSON","parse","split","exp","_jwt_token_exp","_exp__jwt_token"],"mappings":"AAAA,MAAM,GAAGA,KAAK,QAAQ,CAAgB;AAEtC,MAAM,UAAUC,cAAc,CAACC,SAAwB,EAAS,CAAC;IAChE,KAAK,CAACC,IAAI,GAAGH,KAAK;IAClB,KAAK,CAACI,QAAQ,GAAGF,SAAS,IAAIG,IAAI,CAACC,KAAK,CAACH,IAAI,CAACD,SAAS,CAACK,KAAK,CAAC,CAAG,IAAE,CAAC;IACpE,MAAM,CAACH,QAAQ,aAARA,QAAQ,KAARA,IAAI,CAAJA,CAAa,GAAbA,IAAI,CAAJA,CAAa,GAAbA,QAAQ,CAAEI,GAAG;AACrB,CAAC;AACD,MAAM,GACLP,cAAc,IAAIQ,cAAc,EAChCR,cAAc,IAAIS,eAAe"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/validate_current_jwt.ts"],"sourcesContent":["import type { nullish } from '@ctx-core/function'\nimport { throw_bad_credentials } from '@ctx-core/error'\nimport type { jwt_error_ctx_I } from './jwt_error_ctx_I.js'\nimport { jwt_token_exp_ } from './jwt_token_exp_.js'\nexport function validate_current_jwt(jwt_token:string|nullish):void {\n\tconst jwt_token_exp = jwt_token_exp_(jwt_token)\n\tconst jwt_token_exp_millis = jwt_token_exp * 1000\n\tif (Date.now() > jwt_token_exp_millis) {\n\t\tthrow_bad_credentials({\n\t\t\tjwt_token,\n\t\t\terror_message: 'Session Expired'\n\t\t} as jwt_error_ctx_I)\n\t}\n}\nexport {\n\tvalidate_current_jwt as validate__current__jwt\n}\n"],"names":["throw_bad_credentials","jwt_token_exp_","validate_current_jwt","jwt_token","jwt_token_exp","jwt_token_exp_millis","Date","now","error_message","validate__current__jwt"],"mappings":"AACA,MAAM,GAAGA,qBAAqB,QAAQ,CAAiB;AAEvD,MAAM,GAAGC,cAAc,QAAQ,CAAqB;AACpD,MAAM,UAAUC,oBAAoB,CAACC,SAAwB,EAAO,CAAC;IACpE,KAAK,CAACC,aAAa,GAAGH,cAAc,CAACE,SAAS;IAC9C,KAAK,CAACE,oBAAoB,GAAGD,aAAa,GAAG,IAAI;IACjD,EAAE,EAAEE,IAAI,CAACC,GAAG,KAAKF,oBAAoB,EAAE,CAAC;QACvCL,qBAAqB,CAAC,CAAC;YACtBG,SAAS;YACTK,aAAa,EAAE,CAAiB;QACjC,CAAC;IACF,CAAC;AACF,CAAC;AACD,MAAM,GACLN,oBAAoB,IAAIO,sBAAsB"}
1
+ {"version":3,"sources":["../src/validate_current_jwt.ts"],"sourcesContent":["import { throw_bad_credentials } from '@ctx-core/error'\nimport type { nullish } from '@ctx-core/function'\nimport type { jwt_error_ctx_I } from './jwt_error_ctx_I.js'\nimport { jwt_token_exp_ } from './jwt_token_exp_.js'\nexport function validate_current_jwt(jwt_token:string|nullish):void {\n\tconst jwt_token_exp = jwt_token_exp_(jwt_token)\n\tconst jwt_token_exp_millis = jwt_token_exp * 1000\n\tif (Date.now() > jwt_token_exp_millis) {\n\t\tthrow_bad_credentials({\n\t\t\tjwt_token,\n\t\t\terror_message: 'Session Expired'\n\t\t} as jwt_error_ctx_I)\n\t}\n}\nexport {\n\tvalidate_current_jwt as validate__current__jwt\n}\n"],"names":["throw_bad_credentials","jwt_token_exp_","validate_current_jwt","jwt_token","jwt_token_exp","jwt_token_exp_millis","Date","now","error_message","validate__current__jwt"],"mappings":"AAAA,MAAM,GAAGA,qBAAqB,QAAQ,CAAiB;AAGvD,MAAM,GAAGC,cAAc,QAAQ,CAAqB;AACpD,MAAM,UAAUC,oBAAoB,CAACC,SAAwB,EAAO,CAAC;IACpE,KAAK,CAACC,aAAa,GAAGH,cAAc,CAACE,SAAS;IAC9C,KAAK,CAACE,oBAAoB,GAAGD,aAAa,GAAG,IAAI;IACjD,EAAE,EAAEE,IAAI,CAACC,GAAG,KAAKF,oBAAoB,EAAE,CAAC;QACvCL,qBAAqB,CAAC,CAAC;YACtBG,SAAS;YACTK,aAAa,EAAE,CAAiB;QACjC,CAAC;IACF,CAAC;AACF,CAAC;AACD,MAAM,GACLN,oBAAoB,IAAIO,sBAAsB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ctx-core/jwt",
3
- "version": "10.0.27",
3
+ "version": "10.0.32",
4
4
  "description": "ctx-core jwt",
5
5
  "keywords": [
6
6
  "ctx-core",
@@ -28,14 +28,14 @@
28
28
  "./package.json": "./package.json"
29
29
  },
30
30
  "dependencies": {
31
- "@ctx-core/atob": "^10.0.23",
32
- "@ctx-core/error": "^11.0.18",
33
- "@ctx-core/function": "^20.2.3",
34
- "@swc/cli": "^0.1.51",
35
- "@swc/core": "^1.2.107"
31
+ "@ctx-core/atob": "^10.0.27",
32
+ "@ctx-core/error": "^11.1.3",
33
+ "@ctx-core/function": "^20.2.7",
34
+ "@swc/cli": "^0.1.52",
35
+ "@swc/core": "^1.2.113"
36
36
  },
37
37
  "devDependencies": {
38
- "typescript": "^4.4.4"
38
+ "typescript": "next"
39
39
  },
40
40
  "publishConfig": {
41
41
  "access": "public",
package/src/JwtToken.ts CHANGED
@@ -1,5 +1,5 @@
1
- import type { maybe, nullish } from '@ctx-core/function'
2
1
  import type { error_ctx_I } from '@ctx-core/error'
2
+ import type { maybe, nullish } from '@ctx-core/function'
3
3
  export interface Token {
4
4
  access_token: string
5
5
  token_type: string
@@ -1,6 +1,6 @@
1
1
  import type { nullish } from '@ctx-core/function'
2
2
  export function header_authorization_jwt_token_(authorization:string|nullish):string|undefined {
3
- const authorization_a = authorization && authorization.split(/^Bearer */)
3
+ const authorization_a = authorization?.split(/^Bearer */)
4
4
  return authorization_a ? authorization_a[1] : undefined
5
5
  }
6
6
  export {
package/src/index.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export * from './header_authorization_jwt_token_.js'
2
- export * from './jwt_token_exp_.js'
3
2
  export * from './jwt_error_ctx_I.js'
3
+ export * from './jwt_token_exp_.js'
4
4
  export * from './JwtToken.js'
5
5
  export * from './validate_current_jwt.js'
@@ -1,5 +1,5 @@
1
- import type { nullish } from '@ctx-core/function'
2
1
  import { atob_ } from '@ctx-core/atob'
2
+ import type { nullish } from '@ctx-core/function'
3
3
  export function jwt_token_exp_(jwt_token:string|nullish):number {
4
4
  const atob = atob_()
5
5
  const jwt_data = jwt_token && JSON.parse(atob(jwt_token.split('.')[1]))
@@ -1,5 +1,5 @@
1
- import type { nullish } from '@ctx-core/function'
2
1
  import { throw_bad_credentials } from '@ctx-core/error'
2
+ import type { nullish } from '@ctx-core/function'
3
3
  import type { jwt_error_ctx_I } from './jwt_error_ctx_I.js'
4
4
  import { jwt_token_exp_ } from './jwt_token_exp_.js'
5
5
  export function validate_current_jwt(jwt_token:string|nullish):void {