Separate username and signature truncation fields

This commit is contained in:
Ravi Khadiwala authored and ravi-signal committed 2023-04-05 09:51:00 -05:00
1 parent e4da59c236
commit 7b331edcde
3 files changed
+15 -12

No files matched your search

@@ -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);
}
}