import { CheckParams } from './response'; import { JWTObject } from './jwt'; import { DidDocument } from './identity'; import { SIOPErrorResponse } from './error-response'; import { DidResolver } from './identity/resolvers/did-resolver-base'; import { SIOPTokensEcoded, SIOPTokenObjects } from './claims'; export declare const ERRORS: Readonly<{ NO_SIGNING_INFO: "At least one public key must be confirmed with related private key"; NO_PUBLIC_KEY: "No public key matches given private key"; }>; /** * @classdesc This class provides the Relying Party functionality of DID based Self Issued OpenID Connect * @property {RPInfo} - Used to hold Relying Party information needed in issuing requests (ex:- redirect_uri) * @property {Identity} identity - Used to store Decentralized Identity information of the Relying Party * @property {SigningInfo[]} signing_info_set - Used to store a list of cryptographic information used to sign DID SIOP requests */ export declare class RP { private info; private identity; private signing_info_set; private resolvers; /** * @private * @constructor * @param {string} redirect_uri - Redirect uri of the RP. Response from the Provider is sent to this uri * @param {string} did - Decentralized Identity of the Relying Party * @param {any} registration - Registration information of the Relying Party * https://openid.net/specs/openid-connect-core-1_0.html#RegistrationParameter * @param {DidDocument} did_doc - DID Document of the RP. Optional * @param {any} op_metadata - SIOP(OpenIdConnect Provider) metadata: refer core/globals/SIOP_METADATA_SUPPORTED * https://openid.net/specs/openid-connect-self-issued-v2-1_0.html#name-static-self-issued-openid-p * @remarks - This is a private constructor used inside static async method getRP */ private constructor(); /** * @param {string} redirect_uri - Redirect uri of the RP. Response from the Provider is sent to this uri * @param {string} did - Decentralized Identity of the Relying Party * @param {any} registration - Registration information of the Relying Party * https://openid.net/specs/openid-connect-core-1_0.html#RegistrationParameter * @param {DidDocument} [did_doc] - DID Document of the RP. Optional * @param {DidResolver[]} [resolvers] - Array of Resolvers (Derived from DidResolver) to be used for DID resolution * @param {any} op_metadata - SIOP(OpenIdConnect Provider) metadata: refer core/globals/SIOP_METADATA_SUPPORTED * https://openid.net/specs/openid-connect-self-issued-v2-1_0.html#name-static-self-issued-openid-p * @returns {Promise} - A Promise which resolves to an instance of RP class * @remarks Creating RP instances involves some async code and cannot be implemented as a constructor. * Hence this static method is used in place of the constructor. */ static getRP(redirect_uri: string, did: string, registration: any, did_doc?: DidDocument, resolvers?: DidResolver[], op_metadata?: any): Promise; /** * @param {string} key - Private part of any cryptographic key listed in the 'authentication' field of RP's DID Document * @returns {string} - kid of the added key * @remarks This method is used to add signing information to 'signing_info_set'. * Given key is iteratively tried with * every public key listed in the 'authentication' field of RP's DID Document and every key format * until a compatible combination of those information which can be used for the signing process is found. */ addSigningParams(key: string): string; /** * @param {string} kid - kid value of the SigningInfo which needs to be removed from the list * @remarks This method is used to remove a certain SigningInfo (key) which has the given kid value from the list. */ removeSigningParams(kid: string): void; /** * @returns {void} * @remarks Remove all resolvers in Identity (mostly used when UnitTesting) */ removeAllResolvers(): void; /** * @param {any} [options = {}] - Any optional field which should be included in the request JWT. Any field which is not supported * at Provider's end will be ignored * @returns {Promise} - A Promise which resolves to a DID SIOP request * @remarks This method is used to generate a request sent to a DID SIOP Provider. */ generateRequest(options?: any): Promise; /** * @param {string} request_uri - A uri from which a pre-configured and signed request JWT can be obtained * @param {any} [options = {}] - Any optional field which should be included in the request JWT. Any field which is not supported * at Provider's end will be ignored * @returns {Promise} - A Promise which resolves to a DID SIOP request * @remarks This method is used to generate a request which has 'request_uri' in place of the 'request' parameter. * https://identity.foundation/did-siop/#generate-siop-request */ generateUriRequest(request_uri: string, options?: any): Promise; /** * @param {string} response - A DID SIOP response * @param {CheckParams} [checkParams = {redirect_uri: this.info.redirect_uri}] - Parameters against which the response needs to be validated * @param {DidResolver[]} [resolvers] - Array of Resolvers (Derived from DidResolver) to be used for DID resolution * @returns {Promise | SIOPErrorResponse} - A Promise which resolves either to a decoded response or a SIOPErrorResponse * @remarks This method is used to validate responses coming from DID SIOP Providers. */ validateResponse(response: string, checkParams?: CheckParams, resolvers?: DidResolver[]): Promise; /** * @param {SIOPTokensEcoded} tokensEncoded - Object with encoded id_token and encoded vp_token * @param {CheckParams} [checkParams = {redirect_uri: this.info.redirect_uri}] - Parameters against which the response needs to be validated * @param {DidResolver[]} [resolvers] - Array of Resolvers (Derived from DidResolver) to be used for DID resolution * @returns {Promise} - A Promise which resolves either to SIOPTokenObjects or a SIOPErrorResponse * @remarks This method is used to validate responses coming from DID SIOP Providers. */ validateResponseWithVPData(tokensEncoded: SIOPTokensEcoded, checkParams?: CheckParams, resolvers?: DidResolver[]): Promise; }