Restrictions, predicates and contents
Introduction
A use case for an organization is to require specific limitations or customization on an already defined proof. This can be done passing the optional parameters to the start verify request that the organization call on the agent
Applying Restrictions
To apply a series of restriction, a restriction
body parameter must be passed.
The parameter must be a valid json objects, described as follow:
{
"attr_name":
{
“restriction_type”:
{
“field_ref”: ”value to restrict to”
},
},
...
}
Description
Multiple objects can be provided using attribute name as key (i.e. attr_name
=username, email etc..). These objects contains the actual restriction object.
-
restriction_type
: the restriction to apply. Onlyvalue
is currently supported -
field_ref
: the field to restrict. Only_self
is currently supported.
Example body
To restrict for example the email and the balance requested to a wallet:
{
"email":
{
“value”:
{
“_self”: ”private@restricted.com”
},
},
"balance":
{
“value”:
{
“_self”: ”2000”
},
},
}
With widget
Widget accepts the optional parameter data-request-restrictions
to customize restrictions on attributes. Pass the same json object described above to apply restriction from the widget.
Applying Predicates
To apply a series of predicates, a predicates
body parameter must be passed.
The parameter must be a valid json objects, described as follow:
{
"predicate_name": "predicate_value",
...
}
NOTE: Only predicates already described in the proof template can be modified using these objects
Description
-
restriction_type
: the restriction to apply. Onlyvalue
is currently supported -
field_ref
: the field to restrict. Only_self
is currently supported.
Example body
To apply a predicate for example to the balance requested to a wallet (note that the type of predicates, such as "greater than", "less then" etc. must be already described by the proof template):
{
"balance": "1000"
}
With widget
Widget accepts the optional parameter data-request-predicates
to customize predicates on attributes. Pass the same json object described above to apply predicates from the widget.
Applying Contents
To apply a series of contents to customize proof and the attributes requested, a contents
body parameter must be passed.
The parameter must be a valid json objects, described as follow:
{
"comment": [
"lang": "2-digit language code"
"message": "string"
]
"non_revoked": {
"from": <timestamp>,
"to": <timestamp>
},
"attr_name": {
“attr_detail_key”: <attr_detail_value>,
}
...
}
Description
-
comment
: Update proof template comment with provided localized object -
non_revoked
: Update proof template requiring non revocability between provided timestamp.-
from
timestamp is optional, no default will be provided. -
to
timestamp is optional, default to current timestamp
-
-
attr_name
: Multiple objects can be provided using attribute name as key (i.e.attr_name
=username, email etc..). These objects contain details to update proof template details for attributes with the same name which have details with the provided name. If detail is not already present in the proof template for a specific attribute, update will not take place and there won’t be any addiction.
Example body
To apply a predicate for example to the balance requested to a wallet (note that the type of predicates, such as "greater than", "less then" etc. must be already described by the proof template):
{
"comment": [
"lang": "en"
"message": "Example text"
]
"non_revoked": {
"from": 1690903192,
"to": 1692976792
},
"username": {
"choice_list": [
"option username 1",
"option username 2"
]
}
...
}
With widget
Widget accepts the optional parameter data-request-predicates
to customize predicates on attributes. Pass the same json object described above to apply predicates from the widget.