11using Microsoft . Extensions . Logging ;
2+ using TonLibDotNet . Utils ;
23
34namespace TonLibDotNet . Samples
45{
@@ -31,6 +32,9 @@ public async Task Run(bool inMainnet)
3132 var key = await tonClient . CreateNewKey ( localPass , mnemonicPass , randomExtra ) ;
3233 logger . LogInformation ( "New key: public = {PublicKey}, secret = {Secret}" , key . PublicKey , key . Secret ) ;
3334
35+ var decodedPublicKey = KeyUtils . Instance . ParseEd25519PublicKey ( key . PublicKey ) ;
36+ logger . LogInformation ( "Decoded public key (hex): {Value}" , Convert . ToHexString ( decodedPublicKey ) . ToLowerInvariant ( ) ) ;
37+
3438 var ek = await tonClient . ExportKey ( key , localPass ) ;
3539 logger . LogInformation ( "Mnemonic for this key is: {Words}" , string . Join ( " " , ek . WordList ) ) ;
3640
@@ -41,7 +45,8 @@ public async Task Run(bool inMainnet)
4145 logger . LogInformation ( "Same key exported with password: {Value}" , eek . Data ) ;
4246
4347 var euk = await tonClient . ExportUnencryptedKey ( key , localPass ) ;
44- logger . LogInformation ( "Same key in unencrypted form: {Value}" , euk . Data ) ;
48+ logger . LogInformation ( "Same key in unencrypted form (base64): {Value}" , euk . Data ) ;
49+ logger . LogInformation ( "Same key in unencrypted form (hex): {Value}" , Convert . ToHexString ( Convert . FromBase64String ( euk . Data ) ) . ToLowerInvariant ( ) ) ;
4550
4651 //// does not work, see https://github.com/ton-blockchain/ton/issues/202
4752 //// key = await tonClient.ChangeLocalPassword(key, localPass, Convert.ToBase64String(new byte[] { 7, 6, 5 }));
0 commit comments