HORIZON HASKELLDocslts/ghc-9.14.x3e2d5682026-10-11Search names, modules, packages, or :: a typeCtrl K

GHC 9.14.1 · lts/ghc-9.14.x · 3e2d568 · 2026-10-11

Modulecrypton-2.1.7Haskell2010

Crypto.Debug

Printing secret key material, on purpose.

The Show instance of a type that holds a secret does not print it. That is deliberate: Show is what print, a message built with error, an exception and a test framework's failure output all reach for, and a private key reaching a log or a bug report that way is an accident nobody asked for. Those instances render the public part and write <secret> for the rest.

This module is how you print one when printing it is what you mean. What debugShow returns is what the derived Show used to return, so for the types that still have a Read instance

read (debugShow k) == k

and a call site that was serializing a key through show moves by one word.

Needing debugShow in scope is the record of the intent: nothing here is exported anywhere else, so a search for this module finds every place a key can be revealed. Do not leave a call to it where production code runs.

  • 1 class
  • 1 value
  • Packagecrypton-2.1.7
  • Exports2
  • LanguageHaskell2010
  • LicenceBSD-3-Clause AND MIT AND ISC
  • SourceDebug.hs
classclass DebugShow a where
#

Rendering a value with its secret in place.

Methods

Instances15DebugShow, …
valuedebugShowBytes :: ByteArrayAccess ba => String -> ba -> String
#

Render a secret that is held as bytes, in hexadecimal. The secret keys that keep theirs in a ScrubbedBytes never had a Show that printed it, so unlike the rest of this module what comes back is for reading and not for read.