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 • 1.9 kB
{"version":3,"file":"LdKeyPair.mjs","names":[],"sources":["../../../../../src/modules/vc/data-integrity/models/LdKeyPair.ts"],"sourcesContent":["import type { VerificationMethod } from '../../../dids'\n\nexport interface LdKeyPairOptions {\n id: string\n controller: string\n}\n\nexport abstract class LdKeyPair {\n public readonly id: string\n public readonly controller: string\n public abstract type: string\n\n public constructor(options: LdKeyPairOptions) {\n this.id = options.id\n this.controller = options.controller\n }\n\n public static async generate(): Promise<LdKeyPair> {\n throw new Error('Not implemented')\n }\n\n public static async from(_verificationMethod: VerificationMethod): Promise<LdKeyPair> {\n throw new Error('Abstract method from() must be implemented in subclass.')\n }\n\n public export(publicKey = false, privateKey = false) {\n if (!publicKey && !privateKey) {\n throw new Error('Export requires specifying either \"publicKey\" or \"privateKey\".')\n }\n const key = {\n id: this.id,\n type: this.type,\n controller: this.controller,\n }\n\n return key\n }\n\n public abstract fingerprint(): string\n\n public abstract verifyFingerprint(fingerprint: string): boolean\n\n public abstract signer(): {\n sign: (data: { data: Uint8Array | Uint8Array[] }) => Promise<Uint8Array | Array<Uint8Array>>\n }\n\n public abstract verifier(): {\n verify: (data: { data: Uint8Array | Uint8Array[]; signature: Uint8Array }) => Promise<boolean>\n }\n}\n"],"mappings":";;;AAOA,IAAsB,YAAtB,MAAgC;CAK9B,AAAO,YAAY,SAA2B;AAC5C,OAAK,KAAK,QAAQ;AAClB,OAAK,aAAa,QAAQ;;CAG5B,aAAoB,WAA+B;AACjD,QAAM,IAAI,MAAM,kBAAkB;;CAGpC,aAAoB,KAAK,qBAA6D;AACpF,QAAM,IAAI,MAAM,0DAA0D;;CAG5E,AAAO,OAAO,YAAY,OAAO,aAAa,OAAO;AACnD,MAAI,CAAC,aAAa,CAAC,WACjB,OAAM,IAAI,MAAM,qEAAiE;AAQnF,SANY;GACV,IAAI,KAAK;GACT,MAAM,KAAK;GACX,YAAY,KAAK;GAClB"}