post https://api.trinsic.id/credentials/v1/verifications/policy
Create verification from parameters.
Connectionless transport uses URLs that can be shared with the user over any existing transport (email, SMS, web).
Service Clients (SDKs)
This endpoint can be accessed using one of our service clients as follows.
For more information on how to use our service clients, see our Service Clients (SDKs) guide.
// Optional list of attribute policies
IList<VerificationPolicyAttributeContract> attributePolicies = new List<VerificationPolicyAttributeContract>() {
new VerificationPolicyAttributeContract() {
PolicyName = "Attribute A Attribute Policy", // Name for policy
AttributeNames = new List<String>() {"Attribute A"}, // List of names of attributes to request
Restrictions = new List<VerificationPolicyRestriction>() {
new VerificationPolicyRestriction {
SchemaId = "schemaId", // Optionally restrict by schema identifier
SchemaIssuerDid = "schemaIssuerDid", // Optionally restrict by schema issuer identifier
SchemaName = "schemaName", // Optionally restrict by schema name
SchemaVersion = "schemaVersion", // Optionally restrict by schema version
IssuerDid = "issuerDid", // Optionally restrict by issuer identifier
CredentialDefinitionId = "credentialDefinitionId", // Optionally restrict by credential definition identifier
Value = new VerificationPolicyRestrictionAttribute {
AttributeName = "attributeName", // Name of attribute to restrict
AttributeValue = "attributeValue", // Value of attribute to restrict
}
}
}
}
};
// Optional list of predicate policies
IList<VerificationPolicyPredicateContract> predicatePolicies = new List<VerificationPolicyPredicateContract>() {
new VerificationPolicyPredicateContract() {
PolicyName = "Attribute B Predicate Policy", // Name for policy
AttributeName = "attributeName", // Name of attribute to check
PredicateType = "predicateType", // Operation to be performed (">=" | "<=" | "<" | ">")
PredicateValue = 0, // Value to which AttributeName is compared using PredicateType
Restrictions = new List<VerificationPolicyRestriction>() {
new VerificationPolicyRestriction {
SchemaId = "schemaId", // Optionally restrict by schema identifier
SchemaIssuerDid = "schemaIssuerDid", // Optionally restrict by schema issuer identifier
SchemaName = "schemaName", // Optionally restrict by schema name
SchemaVersion = "schemaVersion", // Optionally restrict by schema version
IssuerDid = "issuerDid", // Optionally restrict by issuer identifier
CredentialDefinitionId = "credentialDefinitionId", // Optionally restrict by credential definition identifier
Value = new VerificationPolicyRestrictionAttribute {
AttributeName = "attributeName", // Name of attribute to restrict
AttributeValue = "attributeValue", // Value of attribute to restrict
}
}
}
}
};
// Optionally check if a revocable credential is valid at a given time
VerificationPolicyRevocationRequirement revocationRequirement = new VerificationPolicyRevocationRequirement() {
ValidAt = new DateTime() // Check if the credential is valid at the time of verification creation
};
// Create the verification
VerificationContract verification = await _credentialsClient.CreateVerificationFromParametersAsync(new VerificationPolicyParameters {
Name = "Verification Name",
Version = "1.0", // Must follow Semantic Versioning scheme (https://semver.org),
Attributes = attributePolicies,
Predicates = predicatePolicies,
RevocationRequirement = revocationRequirement
});
// Optional list of attribute policies
let attributePolicies = [
{
policyName: "Attribute A Attribute Policy", // Name for policy
attributeNames: ["Attribute A"], // List of names of attributes to request
restrictions: [
{
schemaId: "schemaId", // Optionally restrict by schema identifier
schemaIssuerDid: "schemaIssuerDid", // Optionally restrict by schema issuer identifier
schemaName: "schemaName", // Optionally restrict by schema name,
schemaVersion: "schemaVersion", // Optionally restrict by schema version
issuerDid: "issuerDid", // Optionally restrict by issuer identifier
credentialDefinitionId: "credentialDefinitionId", // Optionally restrict by credential definition identifier
value: {
attributeName: "attributeName", // Name of attribute to restrict
attributeValue: "attributeValue", // Value of attribute to restrict
}
}
]
}
];
// Optional list of predicate policies
let predicatePolicies = [
{
policyName: "Attribute B Predicate Policy", // Name for policy
attributeName: "attributeName", // Name of attribute to check
predicateType: "<", // Operation to be performed (">=" | "<=" | "<" | ">")
predicateValue: 0, // Value to which AttributeName is compared using PredicateType
restrictions: [
{
schemaId: "schemaId", // Optionally restrict by schema identifier
schemaIssuerDid: "schemaIssuerDid", // Optionally restrict by schema issuer identifier
schemaName: "schemaName", // Optionally restrict by schema name
schemaVersion: "schemaVersion", // Optionally restrict by schema version
issuerDid: "issuerDid", // Optionally restrict by issuer identifier
credentialDefinitionId: "credentialDefinitionId", // Optionally restrict by credential definition identifier
value: {
attributeName: "attributeName", // Name of attribute to restrict
attributeValue: "attributeValue", // Value of attribute to restrict
}
}
]
}
];
// Optionally check if a revocable credential is valid at a given time
let revocationRequirement = {
validAt: new Date() // Check if the credential is valid at the time of verification creation
};
// Create the verification
let verification = await credentialsClient.createVerificationFromParameters({
name: "Verification Name",
version: "1.0", // Must follow Semantic Versioning scheme (https://semver.org),
attributes: attributePolicies,
predicates: predicatePolicies,
revocationRequirement: revocationRequirement
});
import datetime
# Optional list of attribute policies
attribute_policies = [
{
"policyName": "Attribute A Attribute Policy", # Name for policy
"attributeNames": ["Attribute A"], # List of names of attributes to request
"restrictions": [
{
"schemaId": "schemaId", # Optionally restrict by schema identifier
"schemaIssuerDid": "schemaIssuerDid", # Optionally restrict by schema issuer identifier
"schemaName": "schemaName", # Optionally restrict by schema name,
"schemaVersion": "schemaVersion", # Optionally restrict by schema version
"issuerDid": "issuerDid", # Optionally restrict by issuer identifier
"credentialDefinitionId": "credentialDefinitionId", # Optionally restrict by credential definition identifier
"value": {
"attributeName": "attributeName", # Name of attribute to restrict
"attributeValue": "attributeValue", # Value of attribute to restrict
}
}
]
}
]
# Optional list of predicate policies
predicate_policies = [
{
"policyName": "Attribute B Predicate Policy", # Name for policy
"attributeName": "attributeName", # Name of attribute to check
"predicateType": "<", # Operation to be performed (">=" | "<=" | "<" | ">")
"predicateValue": 0, # Value to which AttributeName is compared using PredicateType
"restrictions": [
{
"schemaId": "schemaId", # Optionally restrict by schema identifier
"schemaIssuerDid": "schemaIssuerDid", # Optionally restrict by schema issuer identifier
"schemaName": "schemaName", # Optionally restrict by schema name
"schemaVersion": "schemaVersion", # Optionally restrict by schema version
"issuerDid": "issuerDid", # Optionally restrict by issuer identifier
"credentialDefinitionId": "credentialDefinitionId", # Optionally restrict by credential definition identifier
"value": {
"attributeName": "attributeName", # Name of attribute to restrict
"attributeValue": "attributeValue", # Value of attribute to restrict
}
}
]
}
]
# Optionally check if a revocable credential is valid at a given time
revocation_requirement = {
"validAt": str(datetime.datetime.now()).replace(' ', 'T') + 'Z' # Check if the credential is valid at the time of verification creation
}
# Create the verification
verification_policy = credentials_client.create_verification_from_parameters({
"name": "Verification Name",
"version": "1.0", # Must follow Semantic Versioning scheme (https://semver.org),
"attributes": attribute_policies,
"predicates": predicate_policies,
"revocationRequirement": revocation_requirement
})
# Optional list of attribute policies
attribute_policy = Credentials::Models::VerificationPolicyAttributeContract.new
attribute_policy.policy_name = 'Attribute A Attribute Policy' # Name for policy
attribute_policy.attribute_names = ['Attribute A'] # List of names of attributes to request
attribute_restriction = Credentials::Models::VerificationPolicyRestriction.new
attribute_restriction.schema_id = 'schemaId' # Optionally restrict by schema identifier
attribute_restriction.schema_issuer_did = 'schemaIssuerDid' # Optionally restrict by schema issuer identifier
attribute_restriction.schema_name = 'schemaName' # Optionally restrict by schema name
attribute_restriction.schema_version = 'schemaVersion' # Optionally restrict by schema version
attribute_restriction.issuer_did = 'issuerDid' # Optionally restrict by issuer identifier
attribute_restriction.credential_definition_id = 'credentialDefinitionId' # Optionally restrict by credential definition identifier
attribute_restriction.value = Credentials::Models::VerificationPolicyRestrictionAttribute.new
attribute_restriction.value.attribute_name = 'attributeName' # Name of attribute to restrict
attribute_restriction.value.attribute_value = 'attributeValue' # Value of attribute to restrict
attribute_policy.restrictions = [attribute_restriction]
attribute_policies = [attribute_policy]
# Optional list of predicate policies
predicate_policy = Credentials::Models::VerificationPolicyPredicateContract.new
predicate_policy.policy_name = 'Attribute A Attribute Policy' # Name for policy
predicate_policy.attribute_name = 'Attribute A' # Name of attribute to check
predicate_policy.predicate_type = '<' # Operation to be performed (">=" | "<=" | "<" | ">")
predicate_policy.predicate_value = 0 # Value to which AttributeName is compared using PredicateType
predicate_restriction = Credentials::Models::VerificationPolicyRestriction.new
predicate_restriction.schema_id = 'schemaId' # Optionally restrict by schema identifier
predicate_restriction.schema_issuer_did = 'schemaIssuerDid' # Optionally restrict by schema issuer identifier
predicate_restriction.schema_name = 'schemaName' # Optionally restrict by schema name
predicate_restriction.schema_version = 'schemaVersion' # Optionally restrict by schema version
predicate_restriction.issuer_did = 'issuerDid' # Optionally restrict by issuer identifier
predicate_restriction.credential_definition_id = 'credentialDefinitionId' # Optionally restrict by credential definition identifier
predicate_restriction.value = Credentials::Models::VerificationPolicyRestrictionAttribute.new
predicate_restriction.value.attribute_name = 'attributeName' # Name of attribute to restrict
predicate_restriction.value.attribute_value = 'attributeValue' # Value of attribute to restrict
predicate_policy.restrictions = [predicate_restriction]
predicate_policies = [predicate_policy]
# Optionally check if a revocable credential is valid at a given time
revocation_requirement = Credentials::Models::VerificationPolicyRevocationRequirement.new
revocation_requirement.valid_at = DateTime.now # Check if the credential is valid at the time of verification creation
# Create the verification policy
body = Credentials::Models::VerificationPolicyParameters.new
body.name = 'Verification Name'
body.version = '1.0' # Must follow Semantic Versioning scheme (https://semver.org)
body.attributes = attribute_policies
body.predicates = predicate_policies
body.revocation_requirement = revocation_requirement
verification_policy = credentials_client.create_verification_from_parameters(body)