@microsoft/useragent-sdk
Version:
SDK for building decentralized identity wallets and enterprise agents.
51 lines (50 loc) • 1.41 kB
TypeScript
import ICredential from './ICredential';
import Identifier from '../Identifier';
import { Claim } from '../types';
/**
* Implementation of an OpenID Connect
* self-issued id token.
* @implements ICredential
*/
export default class SelfIssuedCredential implements ICredential {
/**
* Array to hold claims to be included in the credential
*/
private claims;
/**
* The identifier the credential was
* issued to.
* @inheritdoc
*/
readonly issuedBy: Identifier;
/**
* The identifier of the issuer of
* the credential.
* @inheritdoc
*/
readonly issuedTo: Identifier;
/**
* The date the credential was issued.
* @inheritdoc
*/
readonly issuedAt: Date;
/**
* The date and time that the
* credential expires at.
* @inheritdoc
*/
readonly expiresAt?: Date;
/**
* Constructs a new instance of a self-issued
* credential for the specified identifier.
* @param issuer of the credential.
* @param recipient either a string or identifier identifying the
* intended recipient of the credential.
*/
constructor(issuer: Identifier, recipient: Identifier);
/**
* Adds the specified claim to the credential.
* @param claim claim to add to credential.
*/
addClaim(claim: Claim): void;
}