MediumPro challengeJavaScriptTypeScript

Weak Encryption Key — Reject Defaults and Short Keys

TypeScriptSecurityCryptographic Issues

The key-validation function below accepts any non-empty string as an encryption key.

The bug: applications regularly ship with a default/placeholder key like "secret" or "changeme" in a config template — and if that default is never actually changed in production (a shockingly common real-world finding), every encrypted value is trivially decryptable by anyone who knows the well-documented default.

Your task: fix solve(key) so it returns true only when the key is at least 16 characters long and is not one of the well-known weak/default values: 'secret', 'password', '12345', 'changeme', or an empty string (case-insensitive match).

Sample tests

Test #1Long, non-default key accepted
Input: ["aaaaaaaaaaaaaaaa"]
Output: true
Test #2Too short, not a known default
Input: ["short"]
Output: false
Test #3Well-known weak default, also too short
Input: ["secret"]
Output: false