UNPKG

@civic/sol-did-client

Version:
71 lines (70 loc) 2.32 kB
import { PublicKey } from '@solana/web3.js'; import { DecentralizedIdentifierConstructor } from './lib/types'; import { VerificationMethod } from 'did-resolver'; import { ExtendedCluster } from './lib/connection'; /** * A class representing a SOL Did */ export declare class DidSolIdentifier { /** * The cluster the DID points to */ clusterType: ExtendedCluster | undefined; /** * The address of the DID */ authority: PublicKey; /** * The optional field following the DID address and `#` */ fragment?: string; /** * Creates a new `DecentralizedIdentifier` from its requisite parts. * * Use `DecentralizedIdentifier::parse` to obtain this from a direct did address. * * @param constructor The construction values */ constructor(constructor: DecentralizedIdentifierConstructor); /** * Get the key to the DID data */ dataAccount(): [PublicKey, number]; legacyDataAccount(): [PublicKey, number]; /** * Clones this */ clone(): DidSolIdentifier; /** * Returns a new `DecentralizedIdentifier` but with `urlField` swapped to the parameter * @param urlField The new url field */ withUrl(urlField: string): DidSolIdentifier; private get clusterString(); toString(includeURL?: boolean): string; static REGEX: RegExp; /** * Parses a given did string * @param did the did string */ static parse(did: string | VerificationMethod): DidSolIdentifier; parseFragmentFromId(id: string): string; /** * Returns true if the did is valid * @param did The did string to check */ static valid(did: string): boolean; /** * Parses an array of did strings * @param dids The did strings to parse */ static parseMaybeArray(dids?: (string | VerificationMethod)[]): DidSolIdentifier[]; /** * Creates a new did * @param authority The authority and key of the did * @param clusterType The cluster the did points to * @param urlField An optional extra field */ static create(authority: PublicKey, clusterType: ExtendedCluster | undefined, urlField?: string): DidSolIdentifier; } export declare const mapMethodExtension: (clusterString: string) => ExtendedCluster | undefined;