diff --git a/convex-core/src/main/java/convex/core/crypto/BIP39.java b/convex-core/src/main/java/convex/core/crypto/BIP39.java index a85598557..1d4f54f6d 100644 --- a/convex-core/src/main/java/convex/core/crypto/BIP39.java +++ b/convex-core/src/main/java/convex/core/crypto/BIP39.java @@ -229,7 +229,7 @@ public static Blob getSeed(List words, String passphrase) throws NoSuchA } public static Blob getSeed(String mnemonic, String passphrase) throws NoSuchAlgorithmException, InvalidKeySpecException { - mnemonic=mnemonic.trim().replaceAll("\\s+"," "); + mnemonic=normaliseSpaces(mnemonic); mnemonic=Normalizer.normalize(mnemonic, Normalizer.Form.NFKD); char[] normalisedMnemonic= mnemonic.toCharArray(); return getSeedInternal(normalisedMnemonic,passphrase); @@ -287,8 +287,9 @@ public static List getWords(String s) { return al; } - public static String normalise(String s) { - return Utils.joinStrings(getWords(s)," "); + public static String normaliseSpaces(String s) { + s=s.trim().replaceAll("\\s+"," "); + return s; } } diff --git a/convex-gui/src/main/java/convex/gui/manager/mainpanels/KeyGenPanel.java b/convex-gui/src/main/java/convex/gui/manager/mainpanels/KeyGenPanel.java index 31df7011e..01cff1649 100644 --- a/convex-gui/src/main/java/convex/gui/manager/mainpanels/KeyGenPanel.java +++ b/convex-gui/src/main/java/convex/gui/manager/mainpanels/KeyGenPanel.java @@ -159,7 +159,7 @@ public KeyGenPanel(PeerGUI manager) { actionPanel.add(btnNormalise); btnNormalise.addActionListener(e -> { String s=mnemonicArea.getText(); - mnemonicArea.setText(BIP39.normalise(s)); + mnemonicArea.setText(BIP39.normaliseSpaces(s)); updateMnemonic(); }); }