Allow PasswordGenerator to use different alphabets

Per mcilwain's suggestion in the LRP design doc, LRP tokens should use a Base58 alphabet. I'll move PasswordGenerator out of the tools package and into a utils class in a future CL, as we'll want to use this generator in the LrpToken class itself rather than relegate the token definition to a tool.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=132358363
This commit is contained in:
ctingue 2016-09-06 13:56:46 -07:00 committed by Ben McIlwain
parent dbb9ef80c5
commit daca7d65c2
14 changed files with 98 additions and 56 deletions

View file

@ -81,7 +81,7 @@ final class SetupOteCommand extends ConfirmingCommand implements RemoteApiComman
private String premiumList = DEFAULT_PREMIUM_LIST;
@Inject
PasswordGenerator passwordGenerator;
StringGenerator passwordGenerator;
/**
* Long registrar names are truncated and then have an incrementing digit appended at the end so
@ -188,16 +188,16 @@ final class SetupOteCommand extends ConfirmingCommand implements RemoteApiComman
// Storing names and credentials in a list of tuples for later play-back.
List<List<String>> registrars = new ArrayList<>();
registrars.add(ImmutableList.<String>of(
registrar + "-1", passwordGenerator.createPassword(PASSWORD_LENGTH),
registrar + "-1", passwordGenerator.createString(PASSWORD_LENGTH),
registrar + "-sunrise"));
registrars.add(ImmutableList.<String>of(
registrar + "-2", passwordGenerator.createPassword(PASSWORD_LENGTH),
registrar + "-2", passwordGenerator.createString(PASSWORD_LENGTH),
registrar + "-landrush"));
registrars.add(ImmutableList.<String>of(
registrar + "-3", passwordGenerator.createPassword(PASSWORD_LENGTH),
registrar + "-3", passwordGenerator.createString(PASSWORD_LENGTH),
registrar + "-ga"));
registrars.add(ImmutableList.<String>of(
registrar + "-4", passwordGenerator.createPassword(PASSWORD_LENGTH),
registrar + "-4", passwordGenerator.createString(PASSWORD_LENGTH),
registrar + "-ga"));
for (List<String> r : registrars) {