Skip to main content

Credential

@iota/identity-wasm API documentation


Class: Credential

Represents a set of claims describing an entity.

Constructors​

new Credential()​

new Credential(values): Credential

Constructs a new Credential.

Parameters​

values​

ICredential

Returns​

Credential

Methods​

toJSON()​

Call Signature​

toJSON(): Object

  • Return copy of self without private attributes.
Returns​

Object

Call Signature​

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


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​

Timestamp


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​

RefreshService[]


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​

proof?​

null | 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​

custom_claims?​

null | Record<string, any>

Returns​

Record<string, any>


fromJSON()​

static fromJSON(json): Credential

Deserializes an instance from a JSON object.

Parameters​

json​

any

Returns​

Credential


clone()​

clone(): Credential

Deep clones the object.

Returns​

Credential