diff --git a/nacl-util.js b/nacl-util.js index 1ada111..59a1dc6 100644 --- a/nacl-util.js +++ b/nacl-util.js @@ -14,7 +14,7 @@ var util = {}; function validateBase64(s) { - if (!(/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(s))) { + if (!(/^(?:[A-Za-z0-9+\/]{2}[A-Za-z0-9+\/]{2})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/.test(s))) { throw new TypeError('invalid encoding'); } }