UNPKG

@tangle-js/ld-proofs

Version:

Linked Data Proofs on the Tangle. Powered by IOTA Identity & IOTA Streams

35 lines (34 loc) 1.51 kB
import { type Document as DidDocument, VerificationMethod } from "@iota/identity-wasm/node/identity_wasm.js"; export default class DidService { /** * Resolves the DID. * @param node Node against the DID is resolved. * @param did DID to be resolved. * @returns The DID Document resolved from Tangle. */ static resolve(node: string, did: string): Promise<DidDocument>; /** * Resolves the DID verification method. * @param node Node against the DID is resolved. * @param didMethod DID method to be resolved. It must include a hash fragment. * @returns The DID Document resolved from Tangle. */ static resolveMethod(node: string, didMethod: string): Promise<VerificationMethod>; /** * Verifies that the secret really corresponds to the verification method. * * @param didDocument DID document. * @param method The method (expressed as a fragment identifier). * @param secret The private key. * @returns True if verified false if not. */ static verifyOwnership(didDocument: DidDocument, method: string, secret: Uint8Array): Promise<boolean>; /** * Extracts the public key from the verification method. * Only tolerates Base58 public keys. * @param verificationMethod The Verification Method. * @returns The public key in Base 58. * @throws LdProofError if Verification Method does not comply. */ static extractPublicKey(verificationMethod: VerificationMethod): string; }