mirror of
https://github.com/signalapp/Signal-Server.git
synced 2026-12-02 05:36:53 +00:00
Truncate SVR2 IDs to 16 bytes rather than 10.
This commit is contained in:
1 parent
84355963f9
commit
781cd0ca3f
3 files changed
+28
-7
No files matched your search
+11
@@ -112,4 +112,15 @@ class ExternalServiceCredentialsGeneratorTest {
|
||||
assertEquals(generator.validateAndGetTimestamp(credentials, elapsedSeconds + 1).orElseThrow(), TIME_SECONDS);
|
||||
assertTrue(generator.validateAndGetTimestamp(credentials, elapsedSeconds - 1).isEmpty());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTruncateLength() throws Exception {
|
||||
final ExternalServiceCredentialsGenerator generator = ExternalServiceCredentialsGenerator.builder(new byte[32])
|
||||
.withUserDerivationKey(new byte[32])
|
||||
.withTruncateLength(14)
|
||||
.build();
|
||||
final ExternalServiceCredentials creds = generator.generateFor(E164);
|
||||
assertEquals(14*2 /* 2 chars per byte, because hex */, creds.username().length());
|
||||
assertEquals("805b84df7eff1e8fe1baf0c6e838", creds.username());
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user