Class: Credential
identity_wasm.Credential
Table of contents
Constructors
Methods
- toJSON
- toString
- BaseContext
- BaseType
- createDomainLinkageCredential
- context
- id
- type
- credentialSubject
- issuer
- issuanceDate
- expirationDate
- credentialStatus
- credentialSchema
- refreshService
- termsOfUse
- evidence
- nonTransferable
- proof
- properties
- setProof
- toJwtClaims
- fromJSON
- clone
Constructors
constructor
• new Credential(values
)
Constructs a new Credential.
Parameters
Name | Type |
---|---|
values | ICredential |
Methods
toJSON
▸ toJSON(): Object
- Return copy of self without private attributes.
Returns
Object
▸ toJSON(): any
Serializes this to a JSON object.
Returns
any
toString
▸ toString(): string
Return stringified version of self.
Returns
string
BaseContext
▸ Static
BaseContext(): string
Returns the base JSON-LD context.
Returns
string
BaseType
▸ Static
BaseType(): string
Returns the base type.
Returns
string
createDomainLinkageCredential
▸ Static
createDomainLinkageCredential(values
): Credential
Parameters
Name | Type |
---|---|
values | IDomainLinkageCredential |
Returns
context
▸ context(): (string
| Record
\<string
, any
>)[]
Returns a copy of the JSON-LD context(s) applicable to the Credential.
Returns
(string
| Record
\<string
, any
>)[]
id
▸ id(): undefined
| string
Returns a copy of the unique URI
identifying the Credential .
Returns
undefined
| string
type
▸ type(): string
[]
Returns a copy of the URIs defining the type of the Credential.
Returns
string
[]
credentialSubject
▸ credentialSubject(): Subject
[]
Returns a copy of the Credential subject(s).
Returns
Subject
[]
issuer
▸ issuer(): string
| Issuer
Returns a copy of the issuer of the Credential.
Returns
string
| Issuer
issuanceDate
▸ issuanceDate(): Timestamp
Returns a copy of the timestamp of when the Credential becomes valid.
Returns
expirationDate
▸ expirationDate(): undefined
| Timestamp
Returns a copy of the timestamp of when the Credential should no longer be considered valid.
Returns
undefined
| Timestamp
credentialStatus
▸ credentialStatus(): Status
[]
Returns a copy of the information used to determine the current status of the Credential.
Returns
Status
[]
credentialSchema
▸ credentialSchema(): Schema
[]
Returns a copy of the information used to assist in the enforcement of a specific Credential structure.
Returns
Schema
[]
refreshService
▸ refreshService(): RefreshService
[]
Returns a copy of the service(s) used to refresh an expired Credential.
Returns
termsOfUse
▸ termsOfUse(): Policy
[]
Returns a copy of the terms-of-use specified by the Credential issuer.
Returns
Policy
[]
evidence
▸ evidence(): Evidence
[]
Returns a copy of the human-readable evidence used to support the claims within the Credential.
Returns
Evidence
[]
nonTransferable
▸ nonTransferable(): undefined
| boolean
Returns whether or not the Credential must only be contained within a Presentation with a proof issued from the Credential subject.
Returns
undefined
| boolean
proof
▸ proof(): undefined
| Proof
Optional cryptographic proof, unrelated to JWT.
Returns
undefined
| Proof
properties
▸ properties(): Map
\<string
, any
>
Returns a copy of the miscellaneous properties on the Credential.
Returns
Map
\<string
, any
>
setProof
▸ setProof(proof?
): void
Sets the proof
property of the Credential.
Note that this proof is not related to JWT.
Parameters
Name | Type |
---|---|
proof? | Proof |
Returns
void
toJwtClaims
▸ toJwtClaims(custom_claims?
): Record
\<string
, any
>
Serializes the Credential
as a JWT claims set
in accordance with VC Data Model v1.1.
The resulting object can be used as the payload of a JWS when issuing the credential.
Parameters
Name | Type |
---|---|
custom_claims? | Record \<string , any > |
Returns
Record
\<string
, any
>
fromJSON
▸ Static
fromJSON(json
): Credential
Deserializes an instance from a JSON object.
Parameters
Name | Type |
---|---|
json | any |
Returns
clone
▸ clone(): Credential
Deep clones the object.