Search in sources :

Example 1 with UnexpectedWhiteSpaceException

use of io.github.novacrypto.bip39.Validation.UnexpectedWhiteSpaceException in project popstellar by dedis.

the class Wallet method importSeed.

/**
 * Method that allow import mnemonic seed.
 *
 * @param words a String.
 */
public void importSeed(@NonNull String words) throws SeedValidationException, GeneralSecurityException {
    try {
        MnemonicValidator.ofWordList(English.INSTANCE).validate(words);
    } catch (InvalidChecksumException | InvalidWordCountException | WordNotFoundException | UnexpectedWhiteSpaceException e) {
        throw new SeedValidationException(e);
    }
    seed = aead.encrypt(new SeedCalculator().calculateSeed(words, ""), new byte[0]);
    Log.d(TAG, "ImportSeed: new seed: " + Utils.bytesToHex(seed));
}
Also used : UnexpectedWhiteSpaceException(io.github.novacrypto.bip39.Validation.UnexpectedWhiteSpaceException) SeedValidationException(com.github.dedis.popstellar.utility.error.keys.SeedValidationException) SeedCalculator(io.github.novacrypto.bip39.SeedCalculator) WordNotFoundException(io.github.novacrypto.bip39.Validation.WordNotFoundException) InvalidWordCountException(io.github.novacrypto.bip39.Validation.InvalidWordCountException) InvalidChecksumException(io.github.novacrypto.bip39.Validation.InvalidChecksumException)

Aggregations

SeedValidationException (com.github.dedis.popstellar.utility.error.keys.SeedValidationException)1 SeedCalculator (io.github.novacrypto.bip39.SeedCalculator)1 InvalidChecksumException (io.github.novacrypto.bip39.Validation.InvalidChecksumException)1 InvalidWordCountException (io.github.novacrypto.bip39.Validation.InvalidWordCountException)1 UnexpectedWhiteSpaceException (io.github.novacrypto.bip39.Validation.UnexpectedWhiteSpaceException)1 WordNotFoundException (io.github.novacrypto.bip39.Validation.WordNotFoundException)1