@verdaccio/signature 8.0.2 → 8.0.3
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 +14 -0
- package/build/token.js.map +1 -1
- package/build/types.d.ts +1 -0
- package/build/types.js.map +1 -1
- package/package.json +4 -4
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;
|
package/build/token.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"token.js","names":["parseBasicPayload","credentials","
|
|
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
package/build/types.js.map
CHANGED
|
@@ -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,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@verdaccio/signature",
|
|
3
|
-
"version": "8.0.
|
|
3
|
+
"version": "8.0.3",
|
|
4
4
|
"description": "Verdaccio Signature Utilities",
|
|
5
5
|
"main": "./build/index.js",
|
|
6
6
|
"types": "build/index.d.ts",
|
|
@@ -33,13 +33,13 @@
|
|
|
33
33
|
"node": ">=18"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@verdaccio/config": "8.1.
|
|
37
|
-
"@verdaccio/core": "8.1.
|
|
36
|
+
"@verdaccio/config": "8.1.2",
|
|
37
|
+
"@verdaccio/core": "8.1.2",
|
|
38
38
|
"jsonwebtoken": "9.0.3",
|
|
39
39
|
"debug": "4.4.3"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@verdaccio/types": "13.0.
|
|
42
|
+
"@verdaccio/types": "13.0.2",
|
|
43
43
|
"vitest": "4.1.2"
|
|
44
44
|
},
|
|
45
45
|
"funding": {
|