cryptoserve 0.1.0 → 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.
@@ -473,12 +473,15 @@ function generateMigrationPlan(libraries, classifications, sndl) {
473
473
 
474
474
  function calculateQuantumScore(libraries, classifications) {
475
475
  if (libraries.length === 0) return 100.0;
476
+ if (classifications.length === 0) return 100.0;
476
477
 
477
- const safe = libraries.filter(
478
- lib => ['none', 'low'].includes((lib.quantumRisk || '').toLowerCase())
478
+ // Score by individual algorithm classifications, not library count.
479
+ // A project with 5 symmetric + 1 asymmetric algorithm is mostly ready, not 0%.
480
+ const safe = classifications.filter(
481
+ c => c.category !== 'asymmetric' || c.category === 'pqc'
479
482
  ).length;
480
- const vulnerable = libraries.filter(
481
- lib => ['high', 'critical'].includes((lib.quantumRisk || '').toLowerCase())
483
+ const vulnerable = classifications.filter(
484
+ c => c.category === 'asymmetric'
482
485
  ).length;
483
486
  const total = safe + vulnerable;
484
487
 
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) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cryptoserve",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "CryptoServe CLI - Cryptographic scanning, PQC analysis, encryption, and local key management",
5
5
  "type": "module",
6
6
  "bin": {