package com.kryptnostic.storage.v1.http;

import com.kryptnostic.kodex.v1.exceptions.types.BadRequestException;
import com.kryptnostic.kodex.v1.models.response.BasicResponse;

import retrofit.http.Body;
import retrofit.http.GET;
import retrofit.http.PUT;

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";

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

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

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

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

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

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

    @PUT( CONTROLLER + RSA_PUB )
    BasicResponse<String> setRsaPublicKey( @Body byte[] key ) throws BadRequestException;

    @GET( CONTROLLER + RSA_PUB )
    byte[] getRsaPublicKeyForCurrentUser() throws BadRequestException;
}
@@ -35,16 +35,40 @@
 .http;%0A%0A
+import java.util.UUID;%0A%0A
 import c
@@ -129,16 +129,16 @@
 eption;%0A
-
 import c
@@ -271,16 +271,43 @@
 ttp.PUT;
+%0Aimport retrofit.http.Path;
 %0A%0Apublic
@@ -634,16 +634,71 @@
  = %22id%22;
+%0A    final String ID_PATH            = %22/%7B%22 + ID + %22%7D%22;
 %0A%0A    @P
@@ -1361,24 +1361,24 @@
 ER + HASH )%0A
-
     byte%5B%5D g
@@ -1429,32 +1429,155 @@
 uestException;%0A%0A
+    @GET( CONTROLLER + RSA_PUB )%0A    byte%5B%5D getRsaPublicKeyForUser( @Path( ID ) UUID userId ) throws BadRequestException;%0A%0A
     @PUT( CONTRO

add an endpoint to get an arbitrary users public key