Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Aw 93 slip-0010#74

Merged
centrys-victor merged 11 commits into
devfrom
aw-93-slip-10
Jun 7, 2018
Merged

Aw 93 slip-0010#74
centrys-victor merged 11 commits into
devfrom
aw-93-slip-10

Conversation

@centrys-victor
Copy link
Copy Markdown
Contributor

No description provided.

@theotniel theotniel changed the title Aw 93 slip 10 Aw 93 slip-0010 Jun 6, 2018

private static final String KEYSTORE_RADIO_BUTTON_ID = "KEYSTORE_RB";

private static final String MNEMONIC_RADIO_BUTTON_ID = "MNEMONIC_RB";
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there are some leftover unused imports in this class, please remove those as well

}
}

private AccountDTO processMasterAccount(String mnemonic, String password) throws ValidationException {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

final
in IDEA you can set auto-final for param/variable generation from Settings->CodeStyle->Java->CodeGenerarion

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Method is private so a final modifier would be pointless here.

byte[] r = Arrays.copyOfRange(keyHash, 32, 64);

// ed25519 supports ONLY hardened keys
i = i | HARDENED_KEY_MULTIPLIER;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can use |= operator

byte[] keyHash = ecKey.getPrivKeyBytes();

// parent private key
byte[] l = Arrays.copyOfRange(keyHash, 0, 32);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we could name l and r as parentPrivateKey and chainCode respectively so we don't need comments

Mac mac = Mac.getInstance(HmacSHA512_ALGORITHM);
SecretKey key = new SecretKeySpec(r, HmacSHA512_ALGORITHM);
mac.init(key);
return new ExtendedKey(new ECKeyEd25519().fromPrivate(mac.doFinal(parentPaddedKey)));
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for less garbage, we can have the new ECKeyEd25519() as a a lcoal constant since we're using the fromPrivate method as a de facto static method


private static final String MNEMONIC_ENCRYPTION_ALGORITHM = "Blowfish";

private static final String MNEMONIC_STRING_CONVERSION_CHARSET_NAME = "ISO-8859-1";
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍


private static final String ACCOUNT_NAME_PROP = ".name";

private static final String MASTER_DERIVATIONS_PROP = "accounts.master.derivations";
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think for these 2 props there's no need to have the accounts. prefix

try {
blockchainConnector.createAccount();
} catch (ValidationException e) {
// todo: log
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can actually slap a quick logger in this class and log this exception

}

private void showInvalidFieldsError(final String message) {
private void showInvalidFieldsError(String message) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why undo the final?

}

public void open(final MouseEvent mouseEvent) {
public void open(MouseEvent mouseEvent) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as ⬆️

@centrys-victor centrys-victor merged commit 16c4af8 into dev Jun 7, 2018
@theotniel theotniel deleted the aw-93-slip-10 branch June 7, 2018 14:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants