[#wallet-DecryptSecret]
= xref:wallet.adoc[wallet]::DecryptSecret
:relfileprefix: ../
:mrdocs:

Decrypts a secret with the master key using the given IV&period;

== Synopsis

Declared in `&lt;wallet&sol;crypter&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
&lsqb;&lsqb;nodiscard&rsqb;&rsqb;
bool
DecryptSecret(
    xref:wallet/CKeyingMaterial.adoc[CKeyingMaterial] const& master&lowbar;key,
    std::span&lt;unsigned char const&gt; ciphertext,
    xref:uint256.adoc[uint256] const& iv,
    xref:wallet/CKeyingMaterial.adoc[CKeyingMaterial]& plaintext);
----

== Return Value

true if decryption succeeded&period;

[NOTE]
====
The return value https://en.cppreference.com/cpp/language/attributes/nodiscard[should not be discarded^].
====
== Parameters

[cols="1,4"]
|===
| Name| Description
| *master&lowbar;key*
| The master key used as the decryption key&period;
| *ciphertext*
| The ciphertext to decrypt&period;
| *iv*
| Source of the initialization vector&period;
| *plaintext*
| Receives the recovered secret&period;
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
