You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
classAnoncredsCredDefId(Regexp):
"""Validate value against anoncreds credential definition identifier specification."""EXAMPLE="did:(method):3:CL:20:tag"PATTERN=r"^(.+$)"def__init__(self):
"""Initialize the instance."""super().__init__(
AnoncredsCredDefId.PATTERN,
error="Value {input} is not an anoncreds credential definition identifier",
)
classAnoncredsRevRegId(Regexp):
"""Validate value against anoncreds revocation registry identifier specification."""EXAMPLE="did:(method):4:did:<method>:3:CL:20:tag:CL_ACCUM:0"PATTERN=r"^(.+$)"def__init__(self):
"""Initialize the instance."""super().__init__(
AnoncredsRevRegId.PATTERN,
error="Value {input} is not an anoncreds revocation registry identifier",
)
classAnoncredsSchemaId(Regexp):
"""Validate value against indy schema identifier specification."""EXAMPLE="did:(method):2:schema_name:1.0"PATTERN=r"^(.+$)"def__init__(self):
"""Initialize the instance."""super().__init__(
AnoncredsSchemaId.PATTERN,
error="Value {input} is not an anoncreds schema identifier",
)
These patterns (^(.+$)) are just matching on non-empty strings.
There should be a to-do assigned to defining these validation patterns, with some tests asserting that they pass on expected values, and fail on bad ones.
Potentially what the patterns should be, as generated for me by GPT:
classAnoncredsCredDefId(Regexp):
"""Validate value against anoncreds credential definition identifier specification."""EXAMPLE="did:(method):3:CL:20:tag"PATTERN=r"^did:(?P<method>[a-zA-Z0-9]+):3:CL:(?P<schema_id>\d+):(?P<tag>[a-zA-Z0-9_-]+)$"classAnoncredsRevRegId(Regexp):
"""Validate value against anoncreds revocation registry identifier specification."""EXAMPLE="did:(method):4:did:<method>:3:CL:20:tag:CL_ACCUM:0"PATTERN=r"^did:(?P<method>[a-zA-Z0-9]+):4:did:(?P<method>[a-zA-Z0-9]+):3:CL:(?P<schema_id>\d+):(?P<tag>[a-zA-Z0-9_-]+):CL_ACCUM:(.+)$"classAnoncredsSchemaId(Regexp):
"""Validate value against indy schema identifier specification."""EXAMPLE="did:(method):2:schema_name:1.0"PATTERN=r"^did:(?P<method>[a-zA-Z0-9]+):2:(?P<schema_name>[a-zA-Z0-9_-]+):(?P<version>[0-9.]+)$"
I would just need assistance / input with regards to these pattern. If someone can provide a range of possible, valid values for these, then we can write some tests too
The text was updated successfully, but these errors were encountered:
ff137
added a commit
to didx-xyz/acapy
that referenced
this issue
Feb 13, 2025
I was trying to just allow anything here because I didn't know what type of pattern we could use. I don't think we can have the numbers :2,:3,:4 in the validators. Really any method can have their own patterns for the schema id's, cred_def_id's etc.
I think we could have a pattern did:<any-string only letters>:<any string> for any did method.
There are 3 AnonCreds model validators:
These patterns (
^(.+$)
) are just matching on non-empty strings.There should be a to-do assigned to defining these validation patterns, with some tests asserting that they pass on expected values, and fail on bad ones.
Potentially what the patterns should be, as generated for me by GPT:
I would just need assistance / input with regards to these pattern. If someone can provide a range of possible, valid values for these, then we can write some tests too
The text was updated successfully, but these errors were encountered: