From 4ffd0b56d21d42a6707487b0515defa6c66fb5e6 Mon Sep 17 00:00:00 2001 From: Sudipto Chandra Date: Tue, 7 Jul 2026 02:05:29 +0400 Subject: [PATCH] Update regex for hash validation in crypt_data.dart --- lib/src/codecs/crypt/crypt_data.dart | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/src/codecs/crypt/crypt_data.dart b/lib/src/codecs/crypt/crypt_data.dart index 1f38fa2..7f37970 100644 --- a/lib/src/codecs/crypt/crypt_data.dart +++ b/lib/src/codecs/crypt/crypt_data.dart @@ -89,7 +89,6 @@ class CryptData { final versionRe = RegExp(r'^(0|[1-9][0-9]*)$'); final alnumRe = RegExp(r'^[a-z0-9-]{1,32}$'); final valueRe = RegExp(r'^[a-zA-Z0-9/+.-]+$'); - final b64Re = RegExp(r'^[a-zA-Z0-9/+]+$'); // id if (!alnumRe.hasMatch(id)) { @@ -132,9 +131,9 @@ class CryptData { } // hash (optional) - if (hash != null && !b64Re.hasMatch(hash!)) { + if (hash != null && !valueRe.hasMatch(hash!)) { throw ArgumentError.value( - hash, 'hash', 'expected B64 string without padding'); + hash, 'hash', 'must be characters in [a-zA-Z0-9/+.-]'); } } }