@microsoft/useragent-sdk
Version:
SDK for building decentralized identity wallets and enterprise agents.
83 lines (82 loc) • 3.01 kB
TypeScript
import Identifier from '../Identifier';
import ClaimObject from '../credentials/ClaimObject';
import OidcRequest from './OidcRequest';
import CryptoFactory from '../crypto/plugin/CryptoFactory';
/**
* Optional Parameters to add to OIDCRequests.
*/
export declare type OptionalOIDCResponseParams = {
/**
* Opaque value to represent state on serverside.
*/
state?: string;
/**
* ClaimObject if OIDC Request involves issuance of credential.
*/
presentedClaimObjects?: ClaimObject[];
};
export default class OidcResponse {
/**
* Redirect URL for SIOP.
*/
redirectUrl: string;
/**
* Nonce for SIOP.
*/
nonce: string;
/**
* Sender Identifier of the request.
*/
sender: Identifier;
/**
* Optional State
*/
state?: string;
/**
* claimObjects that were requested in the OIDC Request.
*/
presentedClaimObjects?: ClaimObject[];
/**
* Private Constructor for creating OidcResponse Object.
* @param {Identifier} sender Identifier who is sending response.
* @param {string} nonce Nonce from request.
* @param {string} redirectUrl RedirectURL from request.
* @param {OptionalOIDCResponseParams} options optional parameters for specific responses.
*/
private constructor();
/**
* Create an OIDC Response from an OIDC Request Object.
* @param {OidcRequest} oidcRequest OIDC Request that response is responding to.
* @param {Identifier} sender The Sender Identifier of the OIDC Response.
* @returns {OidcResponse}
*/
static create(oidcRequest: OidcRequest, sender: Identifier): Promise<OidcResponse>;
/**
* sign oidcRequest and send compact JWT to redirectUrl.
* @param {string} keyReference reference to signing key.
* @param {ClaimObject[]} claimObjects any claims that were asked for.
* @returns the body of the httpResponse if status is 200.
*/
signAndSend(keyReference: string, claimObjects?: ClaimObject[]): Promise<any>;
/**
* Parses and Verifies signed JWT.
* @param {string} signedResponse signed JWT containing OIDC response.
* @returns {OidcResponse} Object if verified.
*/
static verifyAndParse(signedResponse: string, optionalCryptoFactory?: CryptoFactory): Promise<OidcResponse>;
/**
* Helper method to parse for ClaimObjects in OIDC Response.
* @param sourceArray source array that contain claims
* @param {Identifier} sender Identifer that represents entity that sent request.
* @param {CryptoFactory} cryptoFactory cryptoFactory used for crypto operations.
*/
private static getClaimObjects;
/**
* Send response to redirect url and
*
* @param {string} response OIDC Response
* @param {string} url url to send the response to.
* @param {string} state optional state parameter
*/
private sendResponse;
}