Search in sources :

Example 1 with ClientZkProfileOperations

use of org.signal.zkgroup.profiles.ClientZkProfileOperations in project Signal-Android by WhisperSystems.

the class GroupsV2Operations_decrypt_change_Test method groupCandidate.

GroupCandidate groupCandidate(UUID uuid, ProfileKey profileKey) {
    try {
        ClientZkProfileOperations profileOperations = clientZkOperations.getProfileOperations();
        ProfileKeyCommitment commitment = profileKey.getCommitment(uuid);
        ProfileKeyCredentialRequestContext requestContext = profileOperations.createProfileKeyCredentialRequestContext(uuid, profileKey);
        ProfileKeyCredentialRequest request = requestContext.getRequest();
        ProfileKeyCredentialResponse profileKeyCredentialResponse = server.getProfileKeyCredentialResponse(request, uuid, commitment);
        ProfileKeyCredential profileKeyCredential = profileOperations.receiveProfileKeyCredential(requestContext, profileKeyCredentialResponse);
        GroupCandidate groupCandidate = new GroupCandidate(uuid, Optional.of(profileKeyCredential));
        ProfileKeyCredentialPresentation presentation = profileOperations.createProfileKeyCredentialPresentation(groupSecretParams, profileKeyCredential);
        server.assertProfileKeyCredentialPresentation(groupSecretParams.getPublicParams(), presentation);
        return groupCandidate;
    } catch (VerificationFailedException e) {
        throw new AssertionError(e);
    }
}
Also used : ProfileKeyCredentialResponse(org.signal.zkgroup.profiles.ProfileKeyCredentialResponse) ProfileKeyCredential(org.signal.zkgroup.profiles.ProfileKeyCredential) ClientZkProfileOperations(org.signal.zkgroup.profiles.ClientZkProfileOperations) ProfileKeyCredentialRequest(org.signal.zkgroup.profiles.ProfileKeyCredentialRequest) ProfileKeyCredentialPresentation(org.signal.zkgroup.profiles.ProfileKeyCredentialPresentation) ProfileKeyCommitment(org.signal.zkgroup.profiles.ProfileKeyCommitment) ProfileKeyCredentialRequestContext(org.signal.zkgroup.profiles.ProfileKeyCredentialRequestContext) VerificationFailedException(org.signal.zkgroup.VerificationFailedException)

Example 2 with ClientZkProfileOperations

use of org.signal.zkgroup.profiles.ClientZkProfileOperations in project Signal-Android by signalapp.

the class GroupsV2Operations_decrypt_change_Test method groupCandidate.

GroupCandidate groupCandidate(UUID uuid, ProfileKey profileKey) {
    try {
        ClientZkProfileOperations profileOperations = clientZkOperations.getProfileOperations();
        ProfileKeyCommitment commitment = profileKey.getCommitment(uuid);
        ProfileKeyCredentialRequestContext requestContext = profileOperations.createProfileKeyCredentialRequestContext(uuid, profileKey);
        ProfileKeyCredentialRequest request = requestContext.getRequest();
        ProfileKeyCredentialResponse profileKeyCredentialResponse = server.getProfileKeyCredentialResponse(request, uuid, commitment);
        ProfileKeyCredential profileKeyCredential = profileOperations.receiveProfileKeyCredential(requestContext, profileKeyCredentialResponse);
        GroupCandidate groupCandidate = new GroupCandidate(uuid, Optional.of(profileKeyCredential));
        ProfileKeyCredentialPresentation presentation = profileOperations.createProfileKeyCredentialPresentation(groupSecretParams, profileKeyCredential);
        server.assertProfileKeyCredentialPresentation(groupSecretParams.getPublicParams(), presentation);
        return groupCandidate;
    } catch (VerificationFailedException e) {
        throw new AssertionError(e);
    }
}
Also used : ProfileKeyCredentialResponse(org.signal.zkgroup.profiles.ProfileKeyCredentialResponse) ProfileKeyCredential(org.signal.zkgroup.profiles.ProfileKeyCredential) ClientZkProfileOperations(org.signal.zkgroup.profiles.ClientZkProfileOperations) ProfileKeyCredentialRequest(org.signal.zkgroup.profiles.ProfileKeyCredentialRequest) ProfileKeyCredentialPresentation(org.signal.zkgroup.profiles.ProfileKeyCredentialPresentation) ProfileKeyCommitment(org.signal.zkgroup.profiles.ProfileKeyCommitment) ProfileKeyCredentialRequestContext(org.signal.zkgroup.profiles.ProfileKeyCredentialRequestContext) VerificationFailedException(org.signal.zkgroup.VerificationFailedException)

Aggregations

VerificationFailedException (org.signal.zkgroup.VerificationFailedException)2 ClientZkProfileOperations (org.signal.zkgroup.profiles.ClientZkProfileOperations)2 ProfileKeyCommitment (org.signal.zkgroup.profiles.ProfileKeyCommitment)2 ProfileKeyCredential (org.signal.zkgroup.profiles.ProfileKeyCredential)2 ProfileKeyCredentialPresentation (org.signal.zkgroup.profiles.ProfileKeyCredentialPresentation)2 ProfileKeyCredentialRequest (org.signal.zkgroup.profiles.ProfileKeyCredentialRequest)2 ProfileKeyCredentialRequestContext (org.signal.zkgroup.profiles.ProfileKeyCredentialRequestContext)2 ProfileKeyCredentialResponse (org.signal.zkgroup.profiles.ProfileKeyCredentialResponse)2