UNPKG

@credo-ts/core

Version:

<p align="center"> <br /> <img alt="Credo Logo" src="https://github.com/openwallet-foundation/credo-ts/blob/c7886cb8377ceb8ee4efe8d264211e561a75072d/images/credo-logo.png" height="250px" /> </p> <h1 align="center"><b>Credo - Core</b></h1

1 lines • 3.88 kB
{"version":3,"file":"W3cCredentialsApi.mjs","names":[],"sources":["../../../src/modules/vc/W3cCredentialsApi.ts"],"sourcesContent":["import { AgentContext } from '../../agent'\nimport { injectable } from '../../plugins'\nimport type { Query, QueryOptions } from '../../storage/StorageService'\nimport type { ClaimFormat, W3cVerifiableCredential } from './models'\nimport type { W3cCredentialRecord } from './repository'\nimport { W3cCredentialService } from './W3cCredentialService'\nimport type {\n W3cCreatePresentationOptions,\n W3cSignCredentialOptions,\n W3cSignPresentationOptions,\n W3cStoreCredentialOptions,\n W3cVerifyCredentialOptions,\n W3cVerifyPresentationOptions,\n} from './W3cCredentialServiceOptions'\n\n/**\n * @public\n */\n@injectable()\nexport class W3cCredentialsApi {\n private agentContext: AgentContext\n private w3cCredentialService: W3cCredentialService\n\n public constructor(agentContext: AgentContext, w3cCredentialService: W3cCredentialService) {\n this.agentContext = agentContext\n this.w3cCredentialService = w3cCredentialService\n }\n\n public async store(options: W3cStoreCredentialOptions): Promise<W3cCredentialRecord> {\n return this.w3cCredentialService.storeCredential(this.agentContext, options)\n }\n\n public async deleteById(id: string) {\n return this.w3cCredentialService.removeCredentialRecord(this.agentContext, id)\n }\n\n public async getAll(): Promise<W3cCredentialRecord[]> {\n return this.w3cCredentialService.getAllCredentialRecords(this.agentContext)\n }\n\n public async getById(id: string): Promise<W3cCredentialRecord> {\n return this.w3cCredentialService.getCredentialRecordById(this.agentContext, id)\n }\n\n public async findAllByQuery(\n query: Query<W3cCredentialRecord>,\n queryOptions?: QueryOptions\n ): Promise<W3cVerifiableCredential[]> {\n return this.w3cCredentialService.findCredentialsByQuery(this.agentContext, query, queryOptions)\n }\n\n public async signCredential<Format extends ClaimFormat.JwtVc | ClaimFormat.LdpVc>(\n options: W3cSignCredentialOptions<Format>\n ) {\n return this.w3cCredentialService.signCredential<Format>(this.agentContext, options)\n }\n\n public async verifyCredential(options: W3cVerifyCredentialOptions) {\n return this.w3cCredentialService.verifyCredential(this.agentContext, options)\n }\n\n public async createPresentation(options: W3cCreatePresentationOptions) {\n return this.w3cCredentialService.createPresentation(options)\n }\n\n public async signPresentation<Format extends ClaimFormat.JwtVp | ClaimFormat.LdpVp>(\n options: W3cSignPresentationOptions<Format>\n ) {\n return this.w3cCredentialService.signPresentation<Format>(this.agentContext, options)\n }\n\n public async verifyPresentation(options: W3cVerifyPresentationOptions) {\n return this.w3cCredentialService.verifyPresentation(this.agentContext, options)\n }\n}\n"],"mappings":";;;;;;;AAmBO,IAAM,oBAAN,MAAM,kBAAkB;CAI7B,YAAmB,cAA4B,sBAA4C;EACzF,KAAK,eAAe;EACpB,KAAK,uBAAuB;CAC9B;CAEA,MAAa,MAAM,SAAkE;EACnF,OAAO,KAAK,qBAAqB,gBAAgB,KAAK,cAAc,OAAO;CAC7E;CAEA,MAAa,WAAW,IAAY;EAClC,OAAO,KAAK,qBAAqB,uBAAuB,KAAK,cAAc,EAAE;CAC/E;CAEA,MAAa,SAAyC;EACpD,OAAO,KAAK,qBAAqB,wBAAwB,KAAK,YAAY;CAC5E;CAEA,MAAa,QAAQ,IAA0C;EAC7D,OAAO,KAAK,qBAAqB,wBAAwB,KAAK,cAAc,EAAE;CAChF;CAEA,MAAa,eACX,OACA,cACoC;EACpC,OAAO,KAAK,qBAAqB,uBAAuB,KAAK,cAAc,OAAO,YAAY;CAChG;CAEA,MAAa,eACX,SACA;EACA,OAAO,KAAK,qBAAqB,eAAuB,KAAK,cAAc,OAAO;CACpF;CAEA,MAAa,iBAAiB,SAAqC;EACjE,OAAO,KAAK,qBAAqB,iBAAiB,KAAK,cAAc,OAAO;CAC9E;CAEA,MAAa,mBAAmB,SAAuC;EACrE,OAAO,KAAK,qBAAqB,mBAAmB,OAAO;CAC7D;CAEA,MAAa,iBACX,SACA;EACA,OAAO,KAAK,qBAAqB,iBAAyB,KAAK,cAAc,OAAO;CACtF;CAEA,MAAa,mBAAmB,SAAuC;EACrE,OAAO,KAAK,qBAAqB,mBAAmB,KAAK,cAAc,OAAO;CAChF;AACF;AAxDC,oBAAA,WAAA,CAAA,WAAW,GAAA,mBAAA,qBAAA,CAAA,OAAA,iBAAA,cAAA,SAAA,cAAA,OAAA,yBAAA,cAAA,SAAA,oBAAA,CAAA,CAAA,GAAA,iBAAA"}