decrypt_mapping#

scikitplot.cleanprompt.decrypt_mapping(mapping, key)[source]#

Decrypt a mapping produced by encrypt_mapping.

Parameters:
mappingobject

The stored mapping. Validated rather than trusted.

keybytes

The Fernet key used to encrypt it.

Returns:
dict of str to str

Label-to-secret pairs.

Raises:
CapabilityError

If the crypto tier is unavailable.

CleanPromptError

If the document is malformed, or a value fails authentication.

Parameters:
Return type:

dict[str, str]

Notes

Developer notes. A failed decryption names the label, not the value, and says the ciphertext failed authentication rather than guessing why. The two causes — wrong key, tampered file — are indistinguishable from here by design, and claiming to know which would be a guess presented as a fact.