IDX library
Installation
IDX class
constructor
Arguments
.authenticate
Arguments
Returns Promise<void>
.authenticated
Returns boolean
.ceramic
Returns CeramicApi
.resolver
Returns Resolver
.did
Accessing this property will throw an error if the instance is not authenticated
Returns DID
.id
Accessing this property will throw an error if the instance is not authenticated
Returns string
.isSupported
Checks if the provided did supports IDX. Calling methods such as get using a DID without IDX support will result in these methods returning null or other fallbacks.
If the did argument is not provided, the check will be performed on the DID authenticated with the IDX instance. Calling mutation methods such as set using a DID without IDX support will throw errors.
Arguments
did?: string
Returns Promise<boolean>
.has
Returns whether an entry with the name alias, IndexKey or definition DocID string exists in the Identity Index of the specified did
Arguments
name: stringdid?: string = this.id
Returns Promise<boolean>
.get
Returns the referenced content for the given name alias, IndexKey or definition DocID string of the specified did
Arguments
name: stringdid?: string = this.id
Returns Promise<unknown>
.set
Sets the content for the given name alias, IndexKey or definition DocID string in the Identity Index of the authenticated DID
The provided options are only applied if the document is being created, if it already exists they are ignored
Arguments
name: stringcontent: unknownoptions?: CreateOptions
Returns Promise<DocID> the DocID of the created content document
.merge
Performs a shallow (only one level) merge the contents for the given name alias, IndexKey or definition DocID string in the Identity Index of the authenticated DID
The provided options are only applied if the document is being created, if it already exists they are ignored
Arguments
name: stringcontent: unknownoptions?: CreateOptions
Returns Promise<DocID> the DocID of the created content document
.setAll
Similar to the set method but for setting multiple keys at once in a more efficient way.
The Identity Index document will only get updated if all the contents are successfully set.
Arguments
contents: Record<string, unknown>options?: CreateOptions
.setDefaults
Similar to the setAll method but only sets contents for keys that are not already present in the Identity Index document.
Arguments
contents: Record<string, unknown>options?: CreateOptions
.remove
Removes the definition for the name alias, IndexKey or definition DocID string in the Identity Index of the authenticated DID
Arguments
name: string
Returns Promise<void>
.getIDXDocID
Returns the DocID of the Identity Index associated to the given did
Arguments
did: string
Returns Promise<DocID | null>
.getIDXContent
Returns the contents of the Identity Index associated to the given did
Arguments
did?: string = this.id
Returns Promise<IdentityIndexContent | null>
.contentIterator
Returns an async iterator of ContentEntry for the given did
Arguments
did?: string = this.id
Returns AsyncIterableIterator<ContentEntry>
.getDefinition
Loads an existing Definition by its DocID string or IndexKey
Arguments
id: string
Returns Promise<Definition>