mirror of
https://github.com/signalapp/Signal-Server.git
synced 2026-12-02 14:36:53 +00:00
Allow clients to request zkc-based auth creds
Allow clients to pass a zkcCredential=true query parameter to request the new auth credential format implemented with the zkcredential Rust library.
This commit is contained in:
1 parent
4863e1d227
commit
39fd955f13
2 files changed
+45
-2
No files matched your search
+8
-2
@@ -91,7 +91,8 @@ public class CertificateController {
|
||||
public GroupCredentials getGroupAuthenticationCredentials(
|
||||
@ReadOnly @Auth AuthenticatedAccount auth,
|
||||
@QueryParam("redemptionStartSeconds") long startSeconds,
|
||||
@QueryParam("redemptionEndSeconds") long endSeconds) {
|
||||
@QueryParam("redemptionEndSeconds") long endSeconds,
|
||||
@QueryParam("zkcCredential") boolean zkcCredential) {
|
||||
|
||||
final Instant startOfDay = clock.instant().truncatedTo(ChronoUnit.DAYS);
|
||||
final Instant redemptionStart = Instant.ofEpochSecond(startSeconds);
|
||||
@@ -115,7 +116,12 @@ public class CertificateController {
|
||||
ServiceId.Pni pni = new ServiceId.Pni(auth.getAccount().getPhoneNumberIdentifier());
|
||||
|
||||
while (!redemption.isAfter(redemptionEnd)) {
|
||||
AuthCredentialWithPniResponse authCredentialWithPni = serverZkAuthOperations.issueAuthCredentialWithPniAsServiceId(aci, pni, redemption);
|
||||
AuthCredentialWithPniResponse authCredentialWithPni;
|
||||
if (zkcCredential) {
|
||||
authCredentialWithPni = serverZkAuthOperations.issueAuthCredentialWithPniZkc(aci, pni, redemption);
|
||||
} else {
|
||||
authCredentialWithPni = serverZkAuthOperations.issueAuthCredentialWithPniAsServiceId(aci, pni, redemption);
|
||||
}
|
||||
credentials.add(new GroupCredentials.GroupCredential(
|
||||
authCredentialWithPni.serialize(),
|
||||
(int) redemption.getEpochSecond()));
|
||||
|
||||
Reference in new issue
Block a user