Separate username and signature truncation fields

This commit is contained in:
Ravi Khadiwala
2023-04-04 16:59:46 -05:00
committed by ravi-signal
parent e4da59c236
commit 7b331edcde
3 changed files with 15 additions and 12 deletions

View File

@@ -170,10 +170,11 @@ class ExternalServiceCredentialsGeneratorTest {
public void testTruncateLength() throws Exception {
final ExternalServiceCredentialsGenerator generator = ExternalServiceCredentialsGenerator.builder(new byte[32])
.withUserDerivationKey(new byte[32])
.withTruncateLength(14)
.withDerivedUsernameTruncateLength(14)
.build();
final ExternalServiceCredentials creds = generator.generateFor(E164);
assertEquals(14*2 /* 2 chars per byte, because hex */, creds.username().length());
assertEquals("805b84df7eff1e8fe1baf0c6e838", creds.username());
generator.validateAndGetTimestamp(creds);
}
}