.. _module-utility-credential-v0-credential-83975: Utility.Credential.V0.Credential ================================ Templates --------- .. _type-utility-credential-v0-credential-credential-66032: **template** `Credential `_ A credential contract issued by an *issuer* to a *holder* for a specific purpose\. It allows an issuer to attest a fact about a *subject*\. The subject is typically the same as the holder of the credential\. Credentials should be *immutable*, so that they can be fetched (i\.e\. verified) without contention\. Credentials can be configured to be *existential*\: by not providing an expiry date, they are valid as long as the contract exists on ledger\. Signatory\: issuer, holder .. list-table:: :widths: 15 10 30 :header-rows: 1 * - Field - Type - Description * - issuer - `Party `_ - Issuer of the credential\. * - holder - `Party `_ - Holder of the credential\. * - id - `Text `_ - Identifier of the credential\. * - description - `Text `_ - Description of the credential\. * - validFrom - `Optional `_ `Time `_ - Timestamp as of which the credential becomes valid\. If not provided, the credential becomes valid as soon as it is created\. * - validUntil - `Optional `_ `Time `_ - Timestamp as of which the credential ceases to be valid\. If not provided, the credential is valid indefinitely (or until it is revoked)\. Since credentials should be immutable, it is recommended to only provide this timestamp if it is guaranteed to stay constant\. For example, paid credentials should typically have None here, because the initial validity period could either be extended (if the user tops up their balance) or shortened (if the USD vs CC rate changes)\. * - claims - \[`Claim `_\] - A list of claims, which are statements about a subject\. The subject is typically the same as the holder of the credential\. * - observers - `Parties `_ - Observers of the credential\. + **Choice** Archive Controller\: issuer, holder Returns\: () (no fields) + .. _type-utility-credential-v0-credential-credentialget-51541: **Choice** `Credential_Get `_ Fetch the credential\. Controller\: actor Returns\: `Credential_Get_Result `_ .. list-table:: :widths: 15 10 30 :header-rows: 1 * - Field - Type - Description * - actor - `Party `_ - The actor party\. + .. _type-utility-credential-v0-credential-credentialrevoke-68252: **Choice** `Credential_Revoke `_ Revoke the credential\. Controller\: actor Returns\: `Credential_Revoke_Result `_ .. list-table:: :widths: 15 10 30 :header-rows: 1 * - Field - Type - Description * - actor - `Party `_ - Revoker of the credential\: This can either be the issuer or the holder\. Data Types ---------- .. _type-utility-credential-v0-credential-claim-45224: **data** `Claim `_ A claim is a statement about a subject\. Reference\: https\://www\.w3\.org/TR/vc\-data\-model\-2\.0/\#claims (terminology therein used below) For example\: \"Pat is an alumni of XYZ University\"\. .. _constr-utility-credential-v0-credential-claim-23145: `Claim `_ .. list-table:: :widths: 15 10 30 :header-rows: 1 * - Field - Type - Description * - subject - `Text `_ - A *subject* is a thing about which claims can be made (\"Pat\" in the example above)\. * - property - `Text `_ - Property of the claim (\"alumniOf\" in the example above)\. * - value - `Text `_ - Value of the claim property (\"XYZ University\" in the example above)\. .. _type-utility-credential-v0-credential-credentialgetresult-83002: **data** `Credential_Get_Result `_ Result of ``Credential_Get``\. .. _constr-utility-credential-v0-credential-credentialgetresult-24223: `Credential_Get_Result `_ .. list-table:: :widths: 15 10 30 :header-rows: 1 * - Field - Type - Description * - credential - `Credential `_ - The fetched credential\. .. _type-utility-credential-v0-credential-credentialrevokeresult-23597: **data** `Credential_Revoke_Result `_ Result of ``Credential_Revoke``\. .. _constr-utility-credential-v0-credential-credentialrevokeresult-79670: `Credential_Revoke_Result `_ (no fields) .. _type-utility-credential-v0-credential-parties-76634: **type** `Parties `_ \= `Set `_ `Party `_ Type synonym for a set of parties\. .. _type-utility-credential-v0-credential-partycredentialrequirement-96395: **data** `PartyCredentialRequirement `_ Defines a requirement for a credential held by a party\. The party is expected to be the holder of the credential, as well as the subject of claims corresponding to the (property, value) pairs\. .. _constr-utility-credential-v0-credential-partycredentialrequirement-69980: `PartyCredentialRequirement `_ .. list-table:: :widths: 15 10 30 :header-rows: 1 * - Field - Type - Description * - issuer - `Party `_ - Required issuer of the credential\. * - requiredClaims - \[(`Text `_, `Text `_)\] - Required (property, value) pairs that the holder has to have claims for as a subject\. Functions --------- .. _function-utility-credential-v0-credential-validatefulfillsrequirement-56506: `validateFulfillsRequirement `_ \: `Time `_ \-\> `Party `_ \-\> `PartyCredentialRequirement `_ \-\> `Credential `_ \-\> `Validation `_ `Text `_ `Credential `_ Validates that a credential conforms to expected values\. .. _function-utility-credential-v0-credential-assertfulfillsallrequirements-57104: `assertFulfillsAllRequirements `_ \: (`CanAssert `_ m, `HasTime `_ m) \=\> `Party `_ \-\> \[`PartyCredentialRequirement `_\] \-\> \[`Credential `_\] \-\> m () Assert that a party fulfills all credential requirements\. .. _function-utility-credential-v0-credential-validatecredentialhasissuer-90692: `validateCredentialHasIssuer `_ \: `Party `_ \-\> `Credential `_ \-\> `Validation `_ `Text `_ `Party `_ Validates that a credential has an expected issuer\. .. _function-utility-credential-v0-credential-validatecredentialhasholder-94083: `validateCredentialHasHolder `_ \: `Party `_ \-\> `Credential `_ \-\> `Validation `_ `Text `_ `Party `_ Validates that a credential has an expected holder\. .. _function-utility-credential-v0-credential-validatecredentialhasid-10306: `validateCredentialHasId `_ \: `Optional `_ `Text `_ \-\> `Credential `_ \-\> `Validation `_ `Text `_ `Text `_ Validates that a credential has an expected id\. .. _function-utility-credential-v0-credential-validatecredentialisvalidfrom-63261: `validateCredentialIsValidFrom `_ \: `Time `_ \-\> `Credential `_ \-\> `Validation `_ `Text `_ (`Optional `_ `Time `_) Validates that a credential has commenced\. .. _function-utility-credential-v0-credential-validatecredentialisvaliduntil-37640: `validateCredentialIsValidUntil `_ \: `Time `_ \-\> `Credential `_ \-\> `Validation `_ `Text `_ (`Optional `_ `Time `_) Validates that a credential has not expired\. .. _function-utility-credential-v0-credential-validatecredentialhasclaims-88070: `validateCredentialHasClaims `_ \: `Party `_ \-\> \[(`Text `_, `Text `_)\] \-\> `Credential `_ \-\> `Validation `_ `Text `_ \[`Claim `_\] Validates that a credential has required (property, value) pairs with the holder as the subject\.