UNPKG

@arcblock/vc

Version:

Javascript lib to work with ArcBlock Verifiable Credentials

84 lines (82 loc) 2.47 kB
// Generate by [js2dts@0.3.3](https://github.com/whxaxes/js2dts#readme) /** * Create a valid verifiable credential * * @param {object} params * @param {string} params.type - The type of credential * @param {object} params.subject - The content of credential * @param {object} params.issuer - The issuer name and wallet * @param {Date} params.issuanceDate * @param {Date} params.expirationDate * @param {String} params.endpoint - Status endpoint url * @param {String} params.endpointScope - Endpoint scope, either be public or private * @returns {object} */ declare function create(T100: _Lib.T101): any; /** * Verify that the verifiable credential is valid * - It is signed by a whitelist of issuers * - It is owned by the vc.subject.id * - It has valid signature by the issuer * - It is not expired * * @param {object} vc - the verifiable credential object * @param {string} ownerDid - vc holder/owner did * @param {Array} trustedIssuers - list of issuer did * @throws {Error} * @returns {boolean} */ declare function verify(T102: any): boolean; /** * Verify that the Presentation is valid * - It is signed by VC's owner * - It contain challenge * - It has valid signature by the issuer * - It is not expired * * @param {object} presentation - the presentation object * @param {Array} trustedIssuers - list of issuer did * @param {String} challenge - Random byte you want * @throws {Error} * @returns {boolean} */ declare function verifyPresentation(T103: any): boolean; declare function createCredentialList(T105: _Lib.T106): _Lib.T107[]; declare function verifyCredentialList(T108: _Lib.T109): any[]; declare const _Lib: _Lib.T110; declare namespace _Lib { export interface T101 { type: string; subject: any; issuer: any; issuanceDate: Date; expirationDate: Date; endpoint: string; endpointScope: string; } export interface T104 { [key: string]: any; } export interface T106 { claims: any; issuer: any; issuanceDate: any; } export interface T107 { claim: any; } export interface T109 { credentials: any; trustedIssuers: any; } export interface T110 { create: typeof create; verify: typeof verify; verifyPresentation: typeof verifyPresentation; stableStringify: any; proofTypes: _Lib.T104; createCredentialList: typeof createCredentialList; verifyCredentialList: typeof verifyCredentialList; } } export = _Lib;