mirror of
https://github.com/google/nomulus
synced 2026-01-05 04:56:03 +00:00
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:
@@ -22,6 +22,8 @@ import java.security.ProviderException;
|
||||
import java.security.SecureRandom;
|
||||
import java.util.Random;
|
||||
|
||||
import javax.inject.Named;
|
||||
|
||||
/** Dagger module for Registry Tool. */
|
||||
@Module
|
||||
abstract class RegistryToolModule {
|
||||
@@ -32,7 +34,7 @@ abstract class RegistryToolModule {
|
||||
}
|
||||
|
||||
@Binds
|
||||
abstract PasswordGenerator providePasswordGenerator(RandomPasswordGenerator passwordGenerator);
|
||||
abstract StringGenerator provideStringGenerator(RandomStringGenerator stringGenerator);
|
||||
|
||||
@Provides
|
||||
static Random provideRandom() {
|
||||
@@ -42,4 +44,10 @@ abstract class RegistryToolModule {
|
||||
throw new ProviderException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Provides
|
||||
@Named("alphabet")
|
||||
static String provideAlphabet() {
|
||||
return StringGenerator.Alphabets.BASE_64;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user