diff --git a/pass/app/Key.js b/pass/app/Key.js index 3e1f2b843baa9c6b93ba4c65165b913bb2ad4589..1f513c60217d4776cf652b6238d72b77499c0d38 100644 --- a/pass/app/Key.js +++ b/pass/app/Key.js @@ -304,6 +304,10 @@ class Key { static async GET_KEY(key, writable = false) { // Check if supplied key is UUID v4 if (!Key.IS_VALID_UUID(key)) { + if (typeof key != "string") { + key = ""; + } + const { createHash } = await import("node:crypto"); let hash = createHash("md5"); hash.update(key); @@ -391,8 +395,8 @@ class Key { }); } - static IS_VALID_UUID(input_key){ - if(!input_key || typeof input_key != "string") return false; + static IS_VALID_UUID(input_key) { + if (!input_key || typeof input_key != "string") return false; return input_key.match( /^[0-9A-F]{8}-[0-9A-F]{4}-[4][0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i );