SecretKey.toString - multiple declarations
Function SecretKey.toString
Print the private key
void toString
(
scope @safe void delegate(in char[]) sink,
agora .crypto .Types .PrintMode mode = PrintMode .Obfuscated
) @safe const;
By default, this function does not prints it, using `**SECRET** instead.
Changing the mode to Clear
makes it print the original value.
This mode is intended for debugging.
Parameters
Name | Description |
---|---|
sink | The sink to write the piecemeal string data to |
mode | The PrintMode to use for printing the content.
By default, the hidden value is printed. |
Function SecretKey.toString
Uses Stellar's representation instead of hex
string toString
(
agora .crypto .Types .PrintMode mode = PrintMode .Obfuscated
) @safe const;
Example
auto sd = SecretKey .fromString("SDQJFVGII75JPFVRDNFJ55L7DE4H7V3RHXLRKW55NDPBRBYUZLTW4TJS");
assert(sd .toString(PrintMode .Obfuscated) == "**SECRET**");
assert(sd .toString(PrintMode .Clear) ==
"SDQJFVGII75JPFVRDNFJ55L7DE4H7V3RHXLRKW55NDPBRBYUZLTW4TJS");
// Test default formatting behavior with writeln, log, etc...
import std .format : phobos_format = format;
import dtext .format .Formatter : dtext_format = format;
assert(phobos_format("%s", sd) == "**SECRET**");
() @trusted { assert(dtext_format("{}", sd) == "**SECRET**"); }();