diff --git a/readme.adoc b/readme.adoc index 2974ad6..91d424a 100644 --- a/readme.adoc +++ b/readme.adoc @@ -130,7 +130,7 @@ team.sultanov/secret-keeper {:mvn/version "RELEASE"} ;; Transformer with some options: -;; - :key - schema property key (by default ::keeper/secret) +;; - :key - schema property key (by default ::keeper/category) ;; - :secrets - schema type or map key name (def Transformer @@ -146,7 +146,7 @@ team.sultanov/secret-keeper {:mvn/version "RELEASE"} [:lastname string?] [:email string?] [:passport string?] - [:address [:map {:category :personal} + [:address [:map {:category :personal} ; local category [:street string?] [:zip int?] [:city string?] diff --git a/src/main/clojure/secret/keeper/malli.cljc b/src/main/clojure/secret/keeper/malli.cljc index 824c71a..844ef7a 100644 --- a/src/main/clojure/secret/keeper/malli.cljc +++ b/src/main/clojure/secret/keeper/malli.cljc @@ -9,6 +9,7 @@ (defn transformer "Secret transformer. + - Encoder - encodes all secrets using the specified categories. - Decoder - decodes all secrets. @@ -24,7 +25,7 @@ ;; 1. Define your transformer (def Transformer (transformer - {:key :category ;; by default ::keeper/secret + {:key :category ;; by default ::keeper/category :secrets {:passport :confidential :password :internal-only}})) @@ -48,7 +49,8 @@ (m/encode User Transformer) ;; 4. Decode all secrets - (m/decode User Transformer)" + (m/decode User Transformer) + ```" ([] (transformer nil)) ([{:keys [key secrets]