@bsv/sdk
Version:
BSV Blockchain Software Development Kit
73 lines • 4.52 kB
TypeScript
import { DisplayableIdentity } from './types/index.js';
import { CertificateFieldNameUnder50Bytes, DiscoverByAttributesArgs, DiscoverByIdentityKeyArgs, IdentityCertificate, OriginatorDomainNameStringUnder250Bytes, PubKeyHex, WalletCertificate, WalletInterface } from '../wallet/index.js';
import { BroadcastFailure, BroadcastResponse } from '../transaction/index.js';
import { Contact } from './ContactsManager.js';
/**
* IdentityClient lets you discover who others are, and let the world know who you are.
*/
export declare class IdentityClient {
private readonly options;
private readonly originator?;
private readonly authClient;
private readonly wallet;
private readonly contactsManager;
constructor(wallet?: WalletInterface, options?: import("./types/index.js").IdentityClientOptions, originator?: OriginatorDomainNameStringUnder250Bytes);
/**
* Publicly reveals selected fields from a given certificate by creating a publicly verifiable certificate.
* The publicly revealed certificate is included in a blockchain transaction and broadcast to a federated overlay node.
*
* @param {Certificate} certificate - The master certificate to selectively reveal.
* @param {CertificateFieldNameUnder50Bytes[]} fieldsToReveal - An array of certificate field names to reveal. Only these fields will be included in the public certificate.
*
* @returns {Promise<object>} A promise that resolves with the broadcast result from the overlay network.
* @throws {Error} Throws an error if the certificate is invalid, the fields cannot be revealed, or if the broadcast fails.
*/
publiclyRevealAttributes(certificate: WalletCertificate, fieldsToReveal: CertificateFieldNameUnder50Bytes[]): Promise<BroadcastResponse | BroadcastFailure>;
/**
* Resolves displayable identity certificates, issued to a given identity key by a trusted certifier.
*
* @param {DiscoverByIdentityKeyArgs} args - Arguments for requesting the discovery based on the identity key.
* @param {boolean} [overrideWithContacts=true] - Whether to override the results with personal contacts if available.
* @returns {Promise<DisplayableIdentity[]>} The promise resolves to displayable identities.
*/
resolveByIdentityKey(args: DiscoverByIdentityKeyArgs, overrideWithContacts?: boolean): Promise<DisplayableIdentity[]>;
/**
* Resolves displayable identity certificates by specific identity attributes, issued by a trusted entity.
*
* @param {DiscoverByAttributesArgs} args - Attributes and optional parameters used to discover certificates.
* @param {boolean} [overrideWithContacts=true] - Whether to override the results with personal contacts if available.
* @returns {Promise<DisplayableIdentity[]>} The promise resolves to displayable identities.
*/
resolveByAttributes(args: DiscoverByAttributesArgs, overrideWithContacts?: boolean): Promise<DisplayableIdentity[]>;
/**
* TODO: Implement once revocation overlay is created
* Remove public certificate revelation from overlay services by spending the identity token
* @param serialNumber - Unique serial number of the certificate to revoke revelation
*/
/**
* Load all records from the contacts basket
* @param identityKey Optional specific identity key to fetch
* @param forceRefresh Whether to force a check for new contact data
* @param limit Optional limit on number of contacts to fetch
* @returns A promise that resolves with an array of contacts
*/
getContacts(identityKey?: PubKeyHex, forceRefresh?: boolean, limit?: number): Promise<Contact[]>;
/**
* Save or update a Metanet contact
* @param contact The displayable identity information for the contact
* @param metadata Optional metadata to store with the contact (ex. notes, aliases, etc)
*/
saveContact(contact: DisplayableIdentity, metadata?: Record<string, any>): Promise<void>;
/**
* Remove a contact from the contacts basket
* @param identityKey The identity key of the contact to remove
*/
removeContact(identityKey: PubKeyHex): Promise<void>;
/**
* Parse out identity and certifier attributes to display from an IdentityCertificate
* @param identityToParse - The Identity Certificate to parse
* @returns - IdentityToDisplay
*/
static parseIdentity(identityToParse: IdentityCertificate): DisplayableIdentity;
}
//# sourceMappingURL=IdentityClient.d.ts.map