@verdaccio/signature 8.0.2 → 8.0.4

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/build/token.js CHANGED
@@ -10,6 +10,20 @@ exports.parseBasicPayload = parseBasicPayload;
10
10
  * @returns
11
11
  */
12
12
  function parseBasicPayload(credentials) {
13
+ if (credentials.startsWith('{')) {
14
+ try {
15
+ var parsed = JSON.parse(credentials);
16
+ if (typeof parsed.user === 'string' && typeof parsed.password === 'string') {
17
+ return {
18
+ user: parsed.user,
19
+ password: parsed.password,
20
+ tokenKey: typeof parsed.tokenKey === 'string' ? parsed.tokenKey : undefined
21
+ };
22
+ }
23
+ } catch (_unused) {
24
+ // not a JSON payload, fall through to the legacy "user:password" parsing
25
+ }
26
+ }
13
27
  var index = credentials.indexOf(':');
14
28
  if (index < 0) {
15
29
  return;
@@ -1 +1 @@
1
- {"version":3,"file":"token.js","names":["parseBasicPayload","credentials","index","indexOf","user","slice","password"],"sources":["../src/token.ts"],"sourcesContent":["import type { BasicPayload } from './types';\n\n/**\n *\n * @param credentials\n * @returns\n */\nexport function parseBasicPayload(credentials: string): BasicPayload {\n const index = credentials.indexOf(':');\n if (index < 0) {\n return;\n }\n\n const user: string = credentials.slice(0, index);\n const password: string = credentials.slice(index + 1);\n\n return { user, password };\n}\n"],"mappings":";;;;;;AAEA;AACA;AACA;AACA;AACA;AACO,SAASA,iBAAiBA,CAACC,WAAmB,EAAgB;EACnE,IAAMC,KAAK,GAAGD,WAAW,CAACE,OAAO,CAAC,GAAG,CAAC;EACtC,IAAID,KAAK,GAAG,CAAC,EAAE;IACb;EACF;EAEA,IAAME,IAAY,GAAGH,WAAW,CAACI,KAAK,CAAC,CAAC,EAAEH,KAAK,CAAC;EAChD,IAAMI,QAAgB,GAAGL,WAAW,CAACI,KAAK,CAACH,KAAK,GAAG,CAAC,CAAC;EAErD,OAAO;IAAEE,IAAI,EAAJA,IAAI;IAAEE,QAAQ,EAARA;EAAS,CAAC;AAC3B","ignoreList":[]}
1
+ {"version":3,"file":"token.js","names":["parseBasicPayload","credentials","startsWith","parsed","JSON","parse","user","password","tokenKey","undefined","_unused","index","indexOf","slice"],"sources":["../src/token.ts"],"sourcesContent":["import type { BasicPayload } from './types';\n\n/**\n *\n * @param credentials\n * @returns\n */\nexport function parseBasicPayload(credentials: string): BasicPayload {\n if (credentials.startsWith('{')) {\n try {\n const parsed = JSON.parse(credentials);\n\n if (typeof parsed.user === 'string' && typeof parsed.password === 'string') {\n return {\n user: parsed.user,\n password: parsed.password,\n tokenKey: typeof parsed.tokenKey === 'string' ? parsed.tokenKey : undefined,\n };\n }\n } catch {\n // not a JSON payload, fall through to the legacy \"user:password\" parsing\n }\n }\n\n const index = credentials.indexOf(':');\n if (index < 0) {\n return;\n }\n\n const user: string = credentials.slice(0, index);\n const password: string = credentials.slice(index + 1);\n\n return { user, password };\n}\n"],"mappings":";;;;;;AAEA;AACA;AACA;AACA;AACA;AACO,SAASA,iBAAiBA,CAACC,WAAmB,EAAgB;EACnE,IAAIA,WAAW,CAACC,UAAU,CAAC,GAAG,CAAC,EAAE;IAC/B,IAAI;MACF,IAAMC,MAAM,GAAGC,IAAI,CAACC,KAAK,CAACJ,WAAW,CAAC;MAEtC,IAAI,OAAOE,MAAM,CAACG,IAAI,KAAK,QAAQ,IAAI,OAAOH,MAAM,CAACI,QAAQ,KAAK,QAAQ,EAAE;QAC1E,OAAO;UACLD,IAAI,EAAEH,MAAM,CAACG,IAAI;UACjBC,QAAQ,EAAEJ,MAAM,CAACI,QAAQ;UACzBC,QAAQ,EAAE,OAAOL,MAAM,CAACK,QAAQ,KAAK,QAAQ,GAAGL,MAAM,CAACK,QAAQ,GAAGC;QACpE,CAAC;MACH;IACF,CAAC,CAAC,OAAAC,OAAA,EAAM;MACN;IAAA;EAEJ;EAEA,IAAMC,KAAK,GAAGV,WAAW,CAACW,OAAO,CAAC,GAAG,CAAC;EACtC,IAAID,KAAK,GAAG,CAAC,EAAE;IACb;EACF;EAEA,IAAML,IAAY,GAAGL,WAAW,CAACY,KAAK,CAAC,CAAC,EAAEF,KAAK,CAAC;EAChD,IAAMJ,QAAgB,GAAGN,WAAW,CAACY,KAAK,CAACF,KAAK,GAAG,CAAC,CAAC;EAErD,OAAO;IAAEL,IAAI,EAAJA,IAAI;IAAEC,QAAQ,EAARA;EAAS,CAAC;AAC3B","ignoreList":[]}
package/build/types.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  export interface AESPayload {
2
2
  user: string;
3
3
  password: string;
4
+ tokenKey?: string;
4
5
  }
5
6
  export type BasicPayload = AESPayload | void;
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","names":[],"sources":["../src/types.ts"],"sourcesContent":["export interface AESPayload {\n user: string;\n password: string;\n}\n\nexport type BasicPayload = AESPayload | void;\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"file":"types.js","names":[],"sources":["../src/types.ts"],"sourcesContent":["export interface AESPayload {\n user: string;\n password: string;\n tokenKey?: string;\n}\n\nexport type BasicPayload = AESPayload | void;\n"],"mappings":"","ignoreList":[]}
package/package.json CHANGED
@@ -1,9 +1,23 @@
1
1
  {
2
2
  "name": "@verdaccio/signature",
3
- "version": "8.0.2",
3
+ "version": "8.0.4",
4
4
  "description": "Verdaccio Signature Utilities",
5
- "main": "./build/index.js",
6
- "types": "build/index.d.ts",
5
+ "keywords": [
6
+ "enterprise",
7
+ "modules",
8
+ "package",
9
+ "private",
10
+ "proxy",
11
+ "registry",
12
+ "repository",
13
+ "server",
14
+ "verdaccio"
15
+ ],
16
+ "homepage": "https://verdaccio.org",
17
+ "bugs": {
18
+ "url": "https://github.com/verdaccio/verdaccio/issues"
19
+ },
20
+ "license": "MIT",
7
21
  "author": {
8
22
  "name": "Juan Picado",
9
23
  "email": "juanpicado19@gmail.com"
@@ -13,38 +27,24 @@
13
27
  "url": "https://github.com/verdaccio/verdaccio",
14
28
  "directory": "packages/signature"
15
29
  },
16
- "bugs": {
17
- "url": "https://github.com/verdaccio/verdaccio/issues"
18
- },
19
- "license": "MIT",
20
- "homepage": "https://verdaccio.org",
21
- "keywords": [
22
- "private",
23
- "package",
24
- "repository",
25
- "registry",
26
- "enterprise",
27
- "modules",
28
- "proxy",
29
- "server",
30
- "verdaccio"
31
- ],
32
- "engines": {
33
- "node": ">=18"
30
+ "funding": {
31
+ "type": "opencollective",
32
+ "url": "https://opencollective.com/verdaccio"
34
33
  },
34
+ "main": "./build/index.js",
35
+ "types": "build/index.d.ts",
35
36
  "dependencies": {
36
- "@verdaccio/config": "8.1.1",
37
- "@verdaccio/core": "8.1.1",
38
- "jsonwebtoken": "9.0.3",
39
- "debug": "4.4.3"
37
+ "@verdaccio/config": "8.1.3",
38
+ "@verdaccio/core": "8.1.3",
39
+ "debug": "4.4.3",
40
+ "jsonwebtoken": "9.0.3"
40
41
  },
41
42
  "devDependencies": {
42
- "@verdaccio/types": "13.0.1",
43
+ "@verdaccio/types": "13.0.4",
43
44
  "vitest": "4.1.2"
44
45
  },
45
- "funding": {
46
- "type": "opencollective",
47
- "url": "https://opencollective.com/verdaccio"
46
+ "engines": {
47
+ "node": ">=18"
48
48
  },
49
49
  "scripts": {
50
50
  "clean": "rimraf ./build",