Use a master password:
Firefox: "Tools -> Options -> Security / Passwords -> Use a master password"
It is editable via the following process:
Firefox: "Tools -> Options -> Security / Passwords -> Change Master Password"
Otherwise, if it's a SmartCard device, the window.crypto API may be what you're looking for:
Warning: The features mentioned in this article are proprietary Mozilla extensions, and are not supported in any other browser.
Beyond that, NSS Tools may be what you're looking for:
Software developed by the Mozilla.org projects traditionally used its own implementation of security protocols and cryptographic algorithms, originally called Netscape Security Services, nowadays called Network Security Services (NSS). NSS is a library written in the C programming language. It's free and open source software, and many other software projects have decided to use it. In order to support multiple operating systems (OS), it is based on a cross platform portability layer, called the Netscape Portable Runtime (NSPR), which provides cross platform application programming interfaces (APIs) for OS specific APIs like file system access, memory management, network communication, and multithreaded programming.