ssi.searchCredentials()
Return the requested credentials without secrets such like secret key and private setting. During the execution process, an internal authorization check is performed similar to browser.ssi.askConsent
.
This is an asynchronous function that returns a Promise.
Syntax
const arrayValue = await browser.ssi.searchCredentials(
tabId, // integer
criteria, // object
dialogOption, // optional object
)
Parameters
tabId
integer
. This is tabs.Tab.id
. See also MDN Reference.
criteria
SearchCriteria
. Criteria to search credentials.
dialogOption
(optional)
DialogInfo
. Parameters to build Auth dialog.
Return value
A Promise that will be fulfilled with an array
of ssi.Credential
object. Returns Promise<[]>
if error.
Examples
Serach store
Example of a full search for SSI store service. The return values are array of ssi.Credential.
const credentials = await browser.ssi.searchCredentials(
tabId,
{
primary: false // explicitly set primary to false.
}
)
store.set(credentials.map(credential => doSomething(credential)))
In fact, the results returned are filtered by the user’s preferences, privacy and security reasons.
To get the current public key of the user:
const credentials = await browser.ssi.searchCredentials(
tabId,
{
protocolName: "nostr",
credentialName: "nsec",
primary: true,
}
)
const publicKey = credentials[0].identifier // format is "npub1..."
This documentation is derived from ssi.json in gecko-dev-for-ssi.