Skip to content

Commit 22b90ea

Browse files
committed
✨ 0.9.0: did validation supports any method with new regex pattern
1 parent 2c4191c commit 22b90ea

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

aries_cloudcontroller/model/connection_invitation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def did_pattern(cls, value):
4141
if value is None:
4242
return
4343

44-
pattern = r"^(did:sov:)?[123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{21,22}$"
44+
pattern = r"^(did:sov:)?[123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{21,22}$|^did:([a-zA-Z0-9_]+):([a-zA-Z0-9_.%-]+(:[a-zA-Z0-9_.%-]+)*)((;[a-zA-Z0-9_.:%-]+=[a-zA-Z0-9_.:%-]*)*)(\\/[^#?]*)?([?][^#]*)?(\#.*)?$$"
4545
if not re.match(pattern, value):
4646
raise ValueError(f"Value of did does not match regex pattern ('{pattern}')")
4747
return value

aries_cloudcontroller/model/receive_invitation_request.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def did_pattern(cls, value):
4141
if value is None:
4242
return
4343

44-
pattern = r"^(did:sov:)?[123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{21,22}$"
44+
pattern = r"^(did:sov:)?[123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{21,22}$|^did:([a-zA-Z0-9_]+):([a-zA-Z0-9_.%-]+(:[a-zA-Z0-9_.%-]+)*)((;[a-zA-Z0-9_.:%-]+=[a-zA-Z0-9_.:%-]*)*)(\\/[^#?]*)?([?][^#]*)?(\#.*)?$$"
4545
if not re.match(pattern, value):
4646
raise ValueError(f"Value of did does not match regex pattern ('{pattern}')")
4747
return value

0 commit comments

Comments
 (0)