Path: blob/main/files/en-us/mozilla/add-ons/webextensions/api/pkcs11/getmoduleslots/index.md
6565 views
------{{AddonSidebar()}}
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.
Syntax
Parameters
name:
string. Name of the module. This must match thenameproperty in the PKCS #11 manifest for the module.
Return value
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, aTokenobject. If no token is present in the slot, this property isnull.
Token objects have the following properties:
name:
string. Name of the token.
manufacturer:
string. Name of the token's manufacturer.
HWVersion:
string. Hardware version, as a PKCS #11 version number (two 32-bit integers separated with a dot, like "1.0".
FWVersion:
string. Firmware version, as a PKCS #11 version number (two 32-bit integers separated with a dot, like "1.0".
serial:
string. Serial number, whose format is defined by the token specification.
isLoggedIn:
boolean:trueif the token is logged on already,falseotherwise.
If the module could not be found or some other error occurs, the promise will be rejected with an error message.
Browser compatibility
{{Compat}}
Examples
Installs a module, then lists its slots and list the tokens they contain:
{{WebExtExamples}}