/* This Source Code Form is subject to the terms of the Mozilla Public *License,v.2.0.IfacopyoftheMPLwasnotdistributedwiththis
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include"nsISupports.idl"
/** *ScriptablewrapperovertheLockstorekeystore.Asingleinstanceper *processisopenedagainstthecurrentprofile'skeystorefile *(lockstore.keys.sqlite). * *KEKreferencesareopaquestringsoftheform *`lockstore::kek::<type>:<base64url(random_id)>`,mintedby *`createKek`.Acollectionisanarbitrarynamespaceunderwhicha *singleDEK(dataencryptionkey)iswrappedbyoneormoreKEKs; *see`createDek`. * *MethodsthattouchSQLiteorrunPBKDF2returna`Promise`and *executeonaprivatebackgroundqueuesotheydonotblockthemain *thread.Thecheapin-memorystatecheck(`isKekUnlocked`)remains *synchronous;`lockKek`and`lock`arealsocheapbutreturnaPromise *sotheAPIshapeisuniform.
*/
[scriptable, uuid(a83f5d62-7b1c-4d2e-9f0a-3c5e8b6a1d4e)]
interface nsILockstore : nsISupports
{ /* --- Unified KEK lock / unlock --------------------------------------- */ // // These work for any KEK type that might require user interaction: // // Password → `secret` is the user's password, fed into PBKDF2 // to derive the wrapping key that AES-GCM-unwraps the // stored KEK; the unwrapped KEK is cached in memory // for `timeoutMs`. Required — must not be empty. // Pkcs11Token → `secret` is the PIN. When supplied, Lockstore // authenticates the slot via // `PK11_CheckUserPassword` (direct `C_Login`), // bypassing the NSS password callback. When empty, // Lockstore falls back to `slot.authenticate()`, // which delegates to whatever password callback // the embedding application registered (e.g. PSM // in Firefox). // LocalKey → no-op; `isKekUnlocked` always returns true, // `lockKek`/`unlockKek` succeed without side effects. // // The copy of `secret` handed to the FFI is zeroised once the FFI has // consumed it; callers should still follow their own hygiene rules for // the string they passed in.
/// Drop any cached authentication for `kekRef`. Subsequent DEK accesses /// will throw NS_ERROR_NOT_AVAILABLE until the caller re-unlocks. For /// PKCS#11 this also calls `PK11_Logout` so NSS's own /// authenticated-slot state is cleared alongside the Lockstore cache. /// The operation is cheap (in-memory cache eviction + best-effort /// `PK11_Logout`), but the Promise shape matches the rest of the API /// so JS callers don't have to special-case it.
[implicit_jscontext]
Promise lockKek(in AUTF8String kekRef);
/// True iff `kekRef` is currently unlocked. A valid-but-unrecognised /// `kekRef` (one that doesn't correspond to any KEK type Lockstore /// knows about) returns `false` rather than throwing. An empty /// `kekRef` throws `NS_ERROR_INVALID_ARG`.
boolean isKekUnlocked(in AUTF8String kekRef);
/// Lock every KEK that holds cached authentication: zeroises every /// cached Password KEK in memory, clears every PKCS#11 unlock entry, /// and calls `PK11_Logout` on each previously-unlocked slot. Intended /// for shutdown / logout paths. The operation is cheap; the Promise /// shape matches the rest of the API.
[implicit_jscontext]
Promise lock();
/* --- DEK / collection management ------------------------------------- */
/// Resolves with an Array<ACString> of every collection currently /// managed by this keystore.
[implicit_jscontext]
Promise listDeks();
/// Resolves with an Array<AUTF8String> of every kekRef that /// currently wraps the DEK named `dekName`. The array is non-empty /// for any DEK that exists (the keystore enforces at least one KEK /// wrapping); the Promise rejects with NS_ERROR_NOT_AVAILABLE if no /// DEK by that name exists (including the empty string). Returns /// only the kekRef strings, never the wrapped key bytes themselves /// — useful for callers that need to discover the wrapping state /// (e.g. login crypto deciding whether to encrypt under LocalKey or /// Password for a given DEK).
[implicit_jscontext]
Promise listKeks(in AUTF8String dekName);
/// Wrap an existing collection's DEK under an additional `kekRef`.
[implicit_jscontext]
Promise addKek(in AUTF8String collection,
in AUTF8String fromKekRef,
in AUTF8String toKekRef);
/// Remove a `kekRef` wrapping from a collection. The last remaining /// wrapping cannot be removed.
[implicit_jscontext]
Promise removeKek(in AUTF8String collection,
in AUTF8String kekRef);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.