API
Links: API, Interfaces, Classes, Functions, Types, Enums, Variables
Interfaces
DisplayableIdentity |
IdentityClientOptions |
Links: API, Interfaces, Classes, Functions, Types, Enums, Variables
Interface: DisplayableIdentity
export interface DisplayableIdentity {
name: string;
avatarURL: string;
abbreviatedKey: string;
identityKey: string;
badgeIconURL: string;
badgeLabel: string;
badgeClickURL: string;
}
Links: API, Interfaces, Classes, Functions, Types, Enums, Variables
Interface: IdentityClientOptions
export interface IdentityClientOptions {
protocolID: WalletProtocol;
keyID: string;
tokenAmount: number;
outputIndex: number;
}
See also: WalletProtocol
Links: API, Interfaces, Classes, Functions, Types, Enums, Variables
Classes
ContactsManager |
IdentityClient |
Links: API, Interfaces, Classes, Functions, Types, Enums, Variables
Class: ContactsManager
export class ContactsManager {
constructor(wallet?: WalletInterface)
async getContacts(identityKey?: PubKeyHex, forceRefresh = false, limit = 1000): Promise<Contact[]>
async saveContact(contact: DisplayableIdentity, metadata?: Record<string, any>): Promise<void>
async removeContact(identityKey: string): Promise<void>
}
See also: Contact, DisplayableIdentity, PubKeyHex, WalletInterface
Method getContacts
Load all records from the contacts basket
See also: Contact, PubKeyHexReturns
A promise that resolves with an array of contacts
Argument Details
- identityKey
- Optional specific identity key to fetch
- forceRefresh
- Whether to force a check for new contact data
- limit
- Maximum number of contacts to return
Method removeContact
Remove a contact from the contacts basket
Argument Details
- identityKey
- The identity key of the contact to remove
Method saveContact
Save or update a Metanet contact
See also: DisplayableIdentityArgument Details
- contact
- The displayable identity information for the contact
- metadata
- Optional metadata to store with the contact (ex. notes, aliases, etc)
Links: API, Interfaces, Classes, Functions, Types, Enums, Variables
Class: IdentityClient
IdentityClient lets you discover who others are, and let the world know who you are.
export class IdentityClient {
constructor(wallet?: WalletInterface, private readonly options = DEFAULT_IDENTITY_CLIENT_OPTIONS, private readonly originator?: OriginatorDomainNameStringUnder250Bytes)
async publiclyRevealAttributes(certificate: WalletCertificate, fieldsToReveal: CertificateFieldNameUnder50Bytes[]): Promise<BroadcastResponse | BroadcastFailure>
async resolveByIdentityKey(args: DiscoverByIdentityKeyArgs, overrideWithContacts = true): Promise<DisplayableIdentity[]>
async resolveByAttributes(args: DiscoverByAttributesArgs, overrideWithContacts = true): Promise<DisplayableIdentity[]>
public async getContacts(identityKey?: PubKeyHex, forceRefresh = false, limit = 1000): Promise<Contact[]>
public async saveContact(contact: DisplayableIdentity, metadata?: Record<string, any>): Promise<void>
public async removeContact(identityKey: PubKeyHex): Promise<void>
static parseIdentity(identityToParse: IdentityCertificate): DisplayableIdentity
}
See also: BroadcastFailure, BroadcastResponse, CertificateFieldNameUnder50Bytes, Contact, DEFAULT_IDENTITY_CLIENT_OPTIONS, DiscoverByAttributesArgs, DiscoverByIdentityKeyArgs, DisplayableIdentity, IdentityCertificate, OriginatorDomainNameStringUnder250Bytes, PubKeyHex, WalletCertificate, WalletInterface
Method getContacts
TODO: Implement once revocation overlay is created Remove public certificate revelation from overlay services by spending the identity token
Load all records from the contacts basket
public async getContacts(identityKey?: PubKeyHex, forceRefresh = false, limit = 1000): Promise<Contact[]>
Returns
A promise that resolves with an array of contacts
Argument Details
- serialNumber
- Unique serial number of the certificate to revoke revelation
- identityKey
- Optional specific identity key to fetch
- forceRefresh
- Whether to force a check for new contact data
- limit
- Optional limit on number of contacts to fetch
Method parseIdentity
Parse out identity and certifier attributes to display from an IdentityCertificate
See also: DisplayableIdentity, IdentityCertificateReturns
- IdentityToDisplay
Argument Details
- identityToParse
- The Identity Certificate to parse
Method publiclyRevealAttributes
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.
async publiclyRevealAttributes(certificate: WalletCertificate, fieldsToReveal: CertificateFieldNameUnder50Bytes[]): Promise<BroadcastResponse | BroadcastFailure>
Returns
A promise that resolves with the broadcast result from the overlay network.
Argument Details
- certificate
- The master certificate to selectively reveal.
- fieldsToReveal
- An array of certificate field names to reveal. Only these fields will be included in the public certificate.
Throws
Throws an error if the certificate is invalid, the fields cannot be revealed, or if the broadcast fails.
Method removeContact
Remove a contact from the contacts basket
See also: PubKeyHexArgument Details
- identityKey
- The identity key of the contact to remove
Method resolveByAttributes
Resolves displayable identity certificates by specific identity attributes, issued by a trusted entity.
async resolveByAttributes(args: DiscoverByAttributesArgs, overrideWithContacts = true): Promise<DisplayableIdentity[]>
Returns
The promise resolves to displayable identities.
Argument Details
- args
- Attributes and optional parameters used to discover certificates.
- overrideWithContacts
- Whether to override the results with personal contacts if available.
Method resolveByIdentityKey
Resolves displayable identity certificates, issued to a given identity key by a trusted certifier.
async resolveByIdentityKey(args: DiscoverByIdentityKeyArgs, overrideWithContacts = true): Promise<DisplayableIdentity[]>
Returns
The promise resolves to displayable identities.
Argument Details
- args
- Arguments for requesting the discovery based on the identity key.
- overrideWithContacts
- Whether to override the results with personal contacts if available.
Method saveContact
Save or update a Metanet contact
public async saveContact(contact: DisplayableIdentity, metadata?: Record<string, any>): Promise<void>
Argument Details
- contact
- The displayable identity information for the contact
- metadata
- Optional metadata to store with the contact (ex. notes, aliases, etc)
Links: API, Interfaces, Classes, Functions, Types, Enums, Variables
Functions
Types
Type: Contact
See also: DisplayableIdentity
Links: API, Interfaces, Classes, Functions, Types, Enums, Variables
Enums
Variables
DEFAULT_IDENTITY_CLIENT_OPTIONS |
KNOWN_IDENTITY_TYPES |
defaultIdentity |
Links: API, Interfaces, Classes, Functions, Types, Enums, Variables
Variable: DEFAULT_IDENTITY_CLIENT_OPTIONS
DEFAULT_IDENTITY_CLIENT_OPTIONS: IdentityClientOptions = {
protocolID: [1, "identity"],
keyID: "1",
tokenAmount: 1,
outputIndex: 0
}
See also: IdentityClientOptions
Links: API, Interfaces, Classes, Functions, Types, Enums, Variables
Variable: KNOWN_IDENTITY_TYPES
KNOWN_IDENTITY_TYPES = {
identiCert: "z40BOInXkI8m7f/wBrv4MJ09bZfzZbTj2fJqCtONqCY=",
discordCert: "2TgqRC35B1zehGmB21xveZNc7i5iqHc0uxMb+1NMPW4=",
phoneCert: "mffUklUzxbHr65xLohn0hRL0Tq2GjW1GYF/OPfzqJ6A=",
xCert: "vdDWvftf1H+5+ZprUw123kjHlywH+v20aPQTuXgMpNc=",
registrant: "YoPsbfR6YQczjzPdHCoGC7nJsOdPQR50+SYqcWpJ0y0=",
emailCert: "exOl3KM0dIJ04EW5pZgbZmPag6MdJXd3/a1enmUU/BA=",
anyone: "mfkOMfLDQmrr3SBxBQ5WeE+6Hy3VJRFq6w4A5Ljtlis=",
self: "Hkge6X5JRxt1cWXtHLCrSTg6dCVTxjQJJ48iOYd7n3g=",
coolCert: "AGfk/WrT1eBDXpz3mcw386Zww2HmqcIn3uY6x4Af1eo="
}
Links: API, Interfaces, Classes, Functions, Types, Enums, Variables
Variable: defaultIdentity
defaultIdentity: DisplayableIdentity = {
name: "Unknown Identity",
avatarURL: "XUUB8bbn9fEthk15Ge3zTQXypUShfC94vFjp65v7u5CQ8qkpxzst",
identityKey: "",
abbreviatedKey: "",
badgeIconURL: "XUUV39HVPkpmMzYNTx7rpKzJvXfeiVyQWg2vfSpjBAuhunTCA9uG",
badgeLabel: "Not verified by anyone you trust.",
badgeClickURL: "https://projectbabbage.com/docs/unknown-identity"
}
See also: DisplayableIdentity
Links: API, Interfaces, Classes, Functions, Types, Enums, Variables