7474-type dek_snapshot () :: # dek_snapshot {}.
7575-type encryption_type () :: config_encryption | log_encryption |
7676 audit_encryption .
77+ -type fetch_deks_res () :: {ok , # dek_snapshot {}} | {error , term ()}.
7778
7879% %%===================================================================
7980% %% API
@@ -150,7 +151,7 @@ file_encrypt_chunk(Data, #file_encr_state{key = Dek,
150151 NewOffset = Offset + size (ChunkWithSize ),
151152 {ChunkWithSize , State # file_encr_state {offset = NewOffset }}.
152153
153- -spec read_file (string (), cb_deks :dek_kind () | fun (() -> # dek_snapshot {} )) ->
154+ -spec read_file (string (), cb_deks :dek_kind () | fun (() -> fetch_deks_res () )) ->
154155 {decrypted , binary ()} | {raw , binary ()} | {error , term ()}.
155156read_file (Path , GetDekSnapshotFun ) when is_function (GetDekSnapshotFun , 0 ) ->
156157 maybe
@@ -171,7 +172,7 @@ read_file(Path, DekKind) ->
171172 read_file (Path , GetSnapshotFun ).
172173
173174-spec file_decrypt_init (binary (), string (), # dek_snapshot {} |
174- fun (() -> # dek_snapshot {} )) ->
175+ fun (() -> fetch_deks_res () )) ->
175176 {ok , {# file_decr_state {}, RestData :: binary ()}} |
176177 need_more_data |
177178 {error , term ()}.
@@ -219,8 +220,7 @@ new_aes_gcm_iv(#dek_snapshot{iv_random = IVRandom,
219220 iv_atomic_counter = IVAtomic }) ->
220221 new_aes_gcm_iv (IVRandom , IVAtomic ).
221222
222- -spec fetch_deks_snapshot (cb_deks :dek_kind ()) -> {ok , # dek_snapshot {}} |
223- {error , term ()}.
223+ -spec fetch_deks_snapshot (cb_deks :dek_kind ()) -> fetch_deks_res ().
224224fetch_deks_snapshot (DekKind ) ->
225225 cb_atomic_persistent_term :get_or_set_if_undefined (
226226 {encryption_keys , DekKind },
0 commit comments