use of io.getlime.security.powerauth.rest.api.model.response.v2.ActivationCreateResponse in project powerauth-restful-integration by lime-company.
the class ActivationService method createActivation.
/**
* Create activation.
* @param request Create activation request.
* @return Create activation response.
* @throws PowerAuthActivationException In case create activation fails.
*/
public ActivationCreateResponse createActivation(ActivationCreateRequest request) throws PowerAuthActivationException {
try {
final String activationIDShort = request.getActivationIdShort();
final String activationNonce = request.getActivationNonce();
final String cDevicePublicKey = request.getEncryptedDevicePublicKey();
final String activationName = request.getActivationName();
final String extras = request.getExtras();
final String applicationKey = request.getApplicationKey();
final String applicationSignature = request.getApplicationSignature();
final String clientEphemeralKey = request.getEphemeralPublicKey();
final PrepareActivationResponse paResponse = powerAuthClient.v2().prepareActivation(activationIDShort, activationName, activationNonce, clientEphemeralKey, cDevicePublicKey, extras, applicationKey, applicationSignature);
final ActivationCreateResponse response = new ActivationCreateResponse();
response.setActivationId(paResponse.getActivationId());
response.setActivationNonce(paResponse.getActivationNonce());
response.setEncryptedServerPublicKey(paResponse.getEncryptedServerPublicKey());
response.setEncryptedServerPublicKeySignature(paResponse.getEncryptedServerPublicKeySignature());
response.setEphemeralPublicKey(paResponse.getEphemeralPublicKey());
return response;
} catch (Exception ex) {
logger.warn("Creating PowerAuth activation failed, error: {}", ex.getMessage());
logger.debug(ex.getMessage(), ex);
throw new PowerAuthActivationException();
}
}
Aggregations