mirror of
https://github.com/status-im/status-mobile.git
synced 2025-01-19 21:19:42 +00:00
20 lines
536 B
Plaintext
20 lines
536 B
Plaintext
|
(ns status-im.utils.security)
|
||
|
|
||
|
(defprotocol Unmaskable
|
||
|
;; Retrieve the stored value.
|
||
|
(unmask [this]))
|
||
|
|
||
|
;; MaskedData ensures that the object passed to it won't be occasionally printed
|
||
|
;; via println or log functions. Useful for keeping sensitive data, such as passwords
|
||
|
;; to avoid accidentally exposing them.
|
||
|
(deftype MaskedData [data]
|
||
|
Object
|
||
|
(toString [_] "******")
|
||
|
Unmaskable
|
||
|
(unmask [this]
|
||
|
(.-data this)))
|
||
|
|
||
|
;; Returns a MaskedData instance that stores the piece of data.
|
||
|
(defn mask-data [data]
|
||
|
(MaskedData. data))
|