ssi.nostr.generate()
Generates Nostr 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.nostr.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."single"
,"mnemonic"
.
dialogOption
(optional)
ssi.DialogInfo
. Parameters to build Auth dialog.
Return value
A Promise that will be fulfilled with a string
of hex-format public key. Returns Promise<undefined>
if error.
Examples
Generating a single key pair on secp256k1
const pubkey = await browser.ssi.nostr.generate(
1,
{
type: "single",
},
)
if (!pubkey) {
throw new Error("Failed to generate")
}
console.log(pubkey)
// "5793aa60c01dba51b3e8848fa0dfd39062fa8fda77702dc142f815c39bb4c10d"
This documentation is derived from ssi.nostr.json in gecko-dev-for-ssi.