Skip to content

Commit fdec0cd

Browse files
authored
Avoid logging sensitive wallet data in example (#273)
1 parent 2de479f commit fdec0cd

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

docs/examples/create_wallet/create_wallet.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ func main() {
2626
if err != nil {
2727
log.Fatalf("Failed to generate mnemonic: %v", err)
2828
}
29-
fmt.Printf("Generated Mnemonic: %s\n\n", mnemonic)
29+
fmt.Println("Mnemonic generated (not logged for security). Store it securely.")
3030

3131
// Generate a seed from the mnemonic
3232
// An empty password is used for simplicity in this example
@@ -39,7 +39,7 @@ func main() {
3939
if err != nil {
4040
log.Fatalf("Failed to create master key: %v", err)
4141
}
42-
fmt.Printf("Master Private Key (xPriv): %s\n", masterKey.String())
42+
fmt.Println("Master private key created (not logged for security).")
4343

4444
// Create a wallet instance from the master private key
4545
// Note: The wallet instance itself doesn't store the mnemonic or master xPriv directly for this example
@@ -75,7 +75,7 @@ func main() {
7575
if err != nil {
7676
log.Fatalf("Failed to get derived private key: %v", err)
7777
}
78-
fmt.Printf("Derived Private Key (Hex): %x\n", privateKey.Serialize())
78+
fmt.Println("Derived private key created (not logged for security).")
7979

8080
// Get the public key from the private key
8181
publicKey := privateKey.PubKey()
@@ -93,5 +93,5 @@ func main() {
9393

9494
fmt.Println("Wallet creation and key derivation complete.")
9595
fmt.Println("IMPORTANT: Store your mnemonic phrase securely. This example generates a new wallet on each run.")
96-
fmt.Printf("To use this wallet, you would typically persist the mnemonic or the master extended private key (xPriv: %s).\n", masterKey.String())
96+
fmt.Println("Never log or transmit your mnemonic or private keys in plaintext.")
9797
}

0 commit comments

Comments
 (0)