1010-export ([supported_ciphers /0 , supported_hashes /0 , default_cipher /0 , default_hash /0 , default_iterations /0 ]).
1111-export ([encrypt_term /5 , decrypt_term /5 ]).
1212-export ([encrypt /5 , decrypt /5 ]).
13+ -export ([encrypt /2 , decrypt /2 ]).
1314
14- -export_type ([encryption_result / 0 ]).
15+ -type encryptable_input () :: iodata () | '$pending-secret' .
16+
17+ -export_type ([encryptable_input / 0 , encryption_result / 0 ]).
1518
1619supported_ciphers () ->
1720 credentials_obfuscation_pbe :supported_ciphers ().
@@ -46,7 +49,7 @@ decrypt_term(Cipher, Hash, Iterations, PassPhrase, {encrypted, _Base64Binary}=En
4649-type crypto_hash_algorithm () :: atom ().
4750
4851-spec encrypt (crypto_cipher (), crypto_hash_algorithm (),
49- pos_integer (), iodata () | '$pending-secret' , binary ()) -> encryption_result ().
52+ pos_integer (), encryptable_input () , binary ()) -> encryption_result ().
5053encrypt (Cipher , Hash , Iterations , PassPhrase , ClearText ) ->
5154 credentials_obfuscation_pbe :encrypt (Cipher , Hash , Iterations , PassPhrase , ClearText ).
5255
@@ -57,3 +60,15 @@ decrypt(_Cipher, _Hash, _Iterations, _PassPhrase, {plaintext, Term}) ->
5760 Term ;
5861decrypt (Cipher , Hash , Iterations , PassPhrase , {encrypted , _Base64Binary }= Encrypted ) ->
5962 credentials_obfuscation_pbe :decrypt (Cipher , Hash , Iterations , PassPhrase , Encrypted ).
63+
64+
65+ -spec encrypt (encryptable_input (), binary ()) -> encryption_result ().
66+ encrypt (PassPhrase , ClearText ) ->
67+ credentials_obfuscation_pbe :encrypt (default_cipher (), default_hash (), default_iterations (), PassPhrase , ClearText ).
68+
69+
70+ -spec decrypt (iodata (), encryption_result ()) -> any ().
71+ decrypt (_PassPhrase , {plaintext , Term }) ->
72+ Term ;
73+ decrypt (PassPhrase , {encrypted , _Base64Binary }= Encrypted ) ->
74+ credentials_obfuscation_pbe :decrypt (default_cipher (), default_hash (), default_iterations (), PassPhrase , Encrypted ).
0 commit comments