Enumerate a module's slots. This function returns an array containing one entry for each slot. Each entry contains the slot's name and, if the slot contains a token, information about the token.
You can only call this for a module that is installed in Firefox.
This is an asynchronous function that returns a Promise.
var getting = browser.pkcs11.getModuleSlots( name // string )
namestring. Name of the module. This must match the name property in the PKCS #11 manifest for the module.A Promise that will be fulfilled with an array of objects, one for each slot that the module provides access to. Each object has two properties:
name: the name of the slottoken: if a token is present in this slot, a Token object. If no token is present in the slot, this property is null.Token objects have the following properties:
namestring. Name of the token.manufacturerstring. Name of the token's manufacturer.HWVersionstring. Hardware version, as a PKCS #11 version number (two 32-bit integers separated with a dot, like "1.0".FWVersionstring. Firmware version, as a PKCS #11 version number (two 32-bit integers separated with a dot, like "1.0".serialstring. Serial number, whose format is defined by the token specification.isLoggedInboolean: true if the token is logged on already, false otherwise.If the module could not be found or some other error occurs, the promise will be rejected with an error message.
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | |
getModuleSlots |
No |
No |
58 |
? |
No |
No |
? |
? |
No |
? |
? |
? |
Installs a module, then lists its slots and list the tokens they contain:
function onInstalled() { return browser.pkcs11.getModuleSlots("my_module"); } function onGotSlots(slots) { for (slot of slots) { console.log(`Slot: ${slot.name}`); if (slot.token) { console.log(`Contains token: ${slot.token.name}`); } else { console.log('Is empty'); } } } browser.pkcs11.installModule("my_module") .then(onInstalled) .then(onGotSlots);
© 2005–2021 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/pkcs11/getModuleSlots