cryptoserve 0.1.1 → 0.1.2
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/lib/scanner.mjs +17 -1
- package/package.json +1 -1
package/lib/scanner.mjs
CHANGED
|
@@ -51,9 +51,15 @@ const IMPORT_PATTERNS = [
|
|
|
51
51
|
{ pattern: /createDecipheriv\s*\(/g, lib: 'node:crypto', detail: 'cipher' },
|
|
52
52
|
{ pattern: /createSign\s*\(/g, lib: 'node:crypto', detail: 'signature' },
|
|
53
53
|
{ pattern: /createVerify\s*\(/g, lib: 'node:crypto', detail: 'signature' },
|
|
54
|
+
{ pattern: /createHash\s*\(/g, lib: 'node:crypto', detail: 'hash' },
|
|
55
|
+
{ pattern: /createHmac\s*\(/g, lib: 'node:crypto', detail: 'hmac' },
|
|
54
56
|
{ pattern: /generateKeyPair(?:Sync)?\s*\(/g, lib: 'node:crypto', detail: 'keygen' },
|
|
57
|
+
{ pattern: /createDiffieHellman(?:Group)?\s*\(/g, lib: 'node:crypto', detail: 'keyagreement' },
|
|
58
|
+
{ pattern: /createECDH\s*\(/g, lib: 'node:crypto', detail: 'keyagreement' },
|
|
55
59
|
{ pattern: /scrypt(?:Sync)?\s*\(/g, lib: 'node:crypto', detail: 'kdf' },
|
|
56
60
|
{ pattern: /pbkdf2(?:Sync)?\s*\(/g, lib: 'node:crypto', detail: 'kdf' },
|
|
61
|
+
{ pattern: /randomBytes\s*\(/g, lib: 'node:crypto', detail: 'random' },
|
|
62
|
+
{ pattern: /randomUUID\s*\(/g, lib: 'node:crypto', detail: 'random' },
|
|
57
63
|
{ pattern: /createCipher\s*\(/g, lib: 'node:crypto', detail: 'DEPRECATED-no-iv' },
|
|
58
64
|
{ pattern: /CryptoJS\./g, lib: 'crypto-js' },
|
|
59
65
|
{ pattern: /forge\.\w+/g, lib: 'node-forge' },
|
|
@@ -69,6 +75,10 @@ const ALGO_LITERALS = [
|
|
|
69
75
|
{ pattern: /['"`]sha(?:256|384|512|1)['"`]/gi, algo: 'SHA-256' },
|
|
70
76
|
{ pattern: /['"`](?:HS|RS|ES|PS)(?:256|384|512)['"`]/gi, algo: 'RS256' },
|
|
71
77
|
{ pattern: /['"`]ed25519['"`]/gi, algo: 'Ed25519' },
|
|
78
|
+
{ pattern: /['"`]x25519['"`]/gi, algo: 'X25519' },
|
|
79
|
+
{ pattern: /['"`](?:ecdsa|ecdh|ec|secp256k1|secp384r1|prime256v1)['"`]/gi, algo: 'ECDSA' },
|
|
80
|
+
{ pattern: /['"`](?:rsa|rsa-pss)['"`]/gi, algo: 'RSA' },
|
|
81
|
+
{ pattern: /['"`](?:dsa)['"`]/gi, algo: 'DSA' },
|
|
72
82
|
{ pattern: /minVersion:\s*['"`]TLSv1\.[0-3]['"`]/g, algo: 'TLS' },
|
|
73
83
|
{ pattern: /['"`](?:md5|MD5)['"`]/g, algo: 'MD5' },
|
|
74
84
|
{ pattern: /['"`](?:des|DES|3des|3DES|des-ede3)['"`]/gi, algo: 'DES' },
|
|
@@ -281,11 +291,17 @@ export function scanProject(projectDir) {
|
|
|
281
291
|
if (seenImports.has('node:crypto:') || seenImports.has('node:crypto:cipher')) {
|
|
282
292
|
if (!nodeCryptoAlgos.includes('AES')) nodeCryptoAlgos.push('AES');
|
|
283
293
|
}
|
|
294
|
+
if (seenImports.has('node:crypto:') || seenImports.has('node:crypto:hash') || seenImports.has('node:crypto:hmac')) {
|
|
295
|
+
if (!nodeCryptoAlgos.includes('SHA-256')) nodeCryptoAlgos.push('SHA-256');
|
|
296
|
+
}
|
|
284
297
|
if (seenImports.has('node:crypto:signature')) {
|
|
285
298
|
if (!nodeCryptoAlgos.includes('RSA')) nodeCryptoAlgos.push('RSA');
|
|
286
299
|
}
|
|
300
|
+
if (seenImports.has('node:crypto:keygen') || seenImports.has('node:crypto:keyagreement')) {
|
|
301
|
+
if (!nodeCryptoAlgos.includes('ECDSA')) nodeCryptoAlgos.push('ECDSA');
|
|
302
|
+
}
|
|
287
303
|
if (seenImports.has('node:crypto:kdf')) {
|
|
288
|
-
nodeCryptoAlgos.push('scrypt');
|
|
304
|
+
if (!nodeCryptoAlgos.includes('scrypt')) nodeCryptoAlgos.push('scrypt');
|
|
289
305
|
}
|
|
290
306
|
|
|
291
307
|
if (nodeCryptoAlgos.length > 0) {
|