Skip to content

Commit

Permalink
Document
Browse files Browse the repository at this point in the history
  • Loading branch information
Anthony Green committed Nov 27, 2023
1 parent 55f1e06 commit a82cd62
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,34 @@
# privacy-output-stream
A Common Lisp output stream that masks secret strings

`privacy-output-stream` is a character output stream that wraps other
streams, like `*standard-output*` and masks secrets from the output by
replacing them with a series of `*`.

For example, the following code:
```
(let ((*standard-output* (make-instance 'privacy-output-stream
:stream *standard-output*
:secrets '("passw0rd" "sekret"))))
(format t "Hello, my password is passw0rd~%"))
```

...prints:
```
Hello, my password is ********
```

```secrets``` is a list of secret values you want to mask in the final
output. They are processed in order, so I recommend that you sort
your secrets by length in case one is a substring of another.

Note also, that `privacy-output-stream` only masks secrets that are
presented in full as part of a string or sequence being written to the
stream. Secrets written in fragments (by character or substring) will
not be masked.

Author and License
-------------------

``privacy-output-stream`` was written by [Anthony Green](https://github.com/atgreen),
and is distributed under the terms of the MIT license.

0 comments on commit a82cd62

Please sign in to comment.