ssi.searchCredentialsWithoutSecret()

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.searchCredentialsWithoutSecret(
	tabId, // integer
	criteria, // object
	dialogOption, // optional object
)

Parameters

tabId

integer. This is tabs.Tab.id. See also https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/tabs/Tab#id

criteria

SearchCriteria. Criteria to search credentials

dialogOption (optional)

DialogInfo. Parameters to build Auth dialog

Return value

A Promise that will be fulfilled with array of ssi.Credential.

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.searchCredentialsWithoutSecret(
  1,
  {
    primary: false // explicitly set primary to false.
  }
)
store.set(credentials.map(credential => doSomething(credential)))

Note

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.searchCredentialsWithoutSecret(
  1,
  {
    protocolName: "nostr",
    credentialName: "nsec",
    primary: true,
  }
)
const publicKey = credentials[0].identifier // format is "npub1..."

Note

This documentation is derived from ssi.json in gecko-dev-for-ssi.