ssi.bitcoin.generate()
Generates Bitcoin key in the specified order. 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 stringValue = await browser.ssi.bitcoin.generate(
	tabId, // integer
	options, // object
	dialogOption, // optional object
)
Parameters
tabId
integer. This is tabs.Tab.id. See also MDN Reference.
options
object. Direction about the key you want the user to generate.
type
string. The type that specifies the secret you want the user to generate: e.g."mnemonic","derivation".strength (optional)
integer. The strength when generating a mnemonic (and a master key). This is required whentypeis"mnemonic".passphrase (optional)
string. The passphrase when generating a mnemonic (and a master key). This is optional whentypeis"mnemonic".path (optional)
string. The Hierarchical Deterministic (HD) path: e.g."m/0'/1/2'". If null (or"m") a master key will be generated. The seed specified by the user as the primary will be used. This is required whentypeis"derivation".
dialogOption (optional)
ssi.DialogInfo. Parameters to build Auth dialog.
Return value
A Promise that will be fulfilled with a string of xpub. Returns Promise<undefined> if error.
Examples
Generating mnemonic and master key in BIP-39
const pubkey = await browser.ssi.bitcoin.generate(
  tabId,
  { type: "mnemonic", strength: 256 },
  { caption: "Generated in 24 words" }
)
if (!pubkey) {
  throw new Error("Failed to generate mnemonic")
}
console.log(pubkey)
// "xpub661MyMwAqRbcEhXhghozukZbTsvY5HgocKwMHK2paDXsyVRKRysKfbR1Uvb618DFYUA1ZdrKeQWZ9cjkoPG7xzzs25PRs88EBXHHGiUeLF7"
This documentation is derived from ssi.bitcoin.json in gecko-dev-for-ssi.