package com.kryptnostic.storage.v1.http;

import com.google.common.base.Optional;
import com.kryptnostic.kodex.v1.exceptions.types.BadRequestException;
import retrofit.http.Body;
import retrofit.http.GET;
import retrofit.http.POST;

public interface CryptoKeyStorageApi {
    final String CONTROLLER         = "/keys";
    final String PRIVATE            = "/private";
    final String SEARCH_PRIVATE     = "/searchprivate";
    final String HASH               = "/hash";
    final String RSA_PUB            = "/rsapublic";
    final String ID                 = "id";
    final String ID_PATH            = "/{" + ID + "}";

    @POST( CONTROLLER + PRIVATE )
    Optional<String> setFHEPrivateKeyForCurrentUser( @Body byte[] key ) throws BadRequestException;

    @GET( CONTROLLER + PRIVATE )
    byte[] getFHEPrivateKeyForCurrentUser() throws BadRequestException;

    @POST( CONTROLLER + SEARCH_PRIVATE )
    Optional<String> setFHESearchPrivateKeyForCurrentUser( @Body byte[] key ) throws BadRequestException;

    @GET( CONTROLLER + SEARCH_PRIVATE )
    byte[] getFHESearchPrivateKeyForUser() throws BadRequestException;

    @POST( CONTROLLER + HASH )
    Optional<String> setHashFunctionForCurrentUser( @Body byte[] key ) throws BadRequestException;

    @GET( CONTROLLER + HASH )
    byte[] getHashFunctionForCurrentUser() throws BadRequestException;

//
//    For future use!
//
//    @GET( CONTROLLER + RSA_PUB )
//    byte[] getRsaPublicKeyForUser( @Path( ID ) UUID userId ) throws BadRequestException;
//
//    @POST( CONTROLLER + RSA_PUB )
//    BasicResponse<String> setRsaPublicKey( @Body byte[] key ) throws BadRequestException;
//
//    @GET( CONTROLLER + RSA_PUB )
//    byte[] getRsaPublicKeyForCurrentUser() throws BadRequestException;
}
@@ -46,189 +46,254 @@
 ort 
-com.google.common.base.Optional;%0Aimport com.kryptnostic.kodex.v1.exceptions.types.BadRequestException;%0Aimport retrofit.http.Body;%0Aimport retrofit.http.GET;%0Aimport retrofit.http.POST
+retrofit.http.Body;%0Aimport retrofit.http.GET;%0Aimport retrofit.http.POST;%0A%0Aimport com.google.common.base.Optional;%0Aimport com.kryptnostic.kodex.v1.crypto.ciphers.BlockCiphertext;%0Aimport com.kryptnostic.kodex.v1.exceptions.types.BadRequestException
 ;%0A%0Ap
@@ -767,38 +767,47 @@
 rentUser( @Body 
-byte%5B%5D
+BlockCiphertext
  key ) throws Ba
@@ -859,30 +859,39 @@
 IVATE )%0A    
-byte%5B%5D
+BlockCiphertext
  getFHEPriva
@@ -1039,38 +1039,47 @@
 rentUser( @Body 
-byte%5B%5D
+BlockCiphertext
  key ) throws Ba
@@ -1138,30 +1138,39 @@
 IVATE )%0A    
-byte%5B%5D
+BlockCiphertext
  getFHESearc
@@ -1300,38 +1300,47 @@
 rentUser( @Body 
-byte%5B%5D
+BlockCiphertext
  key ) throws Ba
@@ -1389,30 +1389,39 @@
  HASH )%0A    
-byte%5B%5D
+BlockCiphertext
  getHashFunc
@@ -1531,38 +1531,47 @@
 RSA_PUB )%0A//    
-byte%5B%5D
+BlockCiphertext
  getRsaPublicKey
@@ -1723,22 +1723,31 @@
 ( @Body 
-byte%5B%5D
+BlockCiphertext
  key ) t
@@ -1821,14 +1821,23 @@
     
-byte%5B%5D
+BlockCiphertext
  get

Switch to block ciphertexts.