
app.cybrid.cybrid_api_bank.client.apis.VerificationKeysApi.kt Maven / Gradle / Ivy
package app.cybrid.cybrid_api_bank.client.apis
import app.cybrid.cybrid_api_bank.client.infrastructure.CollectionFormats.*
import retrofit2.http.*
import retrofit2.Response
import okhttp3.RequestBody
import app.cybrid.cybrid_api_bank.client.models.ErrorResponseBankModel
import app.cybrid.cybrid_api_bank.client.models.PostVerificationKeyBankModel
import app.cybrid.cybrid_api_bank.client.models.VerificationKeyBankModel
import app.cybrid.cybrid_api_bank.client.models.VerificationKeyListBankModel
interface VerificationKeysApi {
/**
* Create VerificationKey
* Creates a verification key. Example code (python) for generating a Verification Key ```python import base64 from cryptography.hazmat.primitives import hashes from cryptography.hazmat.primitives import serialization from cryptography.hazmat.primitives.asymmetric import padding from cryptography.hazmat.primitives.asymmetric import rsa nonce = \"wen moon\" private_key = rsa.generate_private_key(public_exponent=65537, key_size=2048) signature = base64.b64encode(private_key.sign( data=nonce.encode('ascii'), padding=padding.PKCS1v15(), algorithm=hashes.SHA512())).decode('ascii') public_key = base64.b64encode(private_key.public_key().public_bytes( encoding=serialization.Encoding.DER, format=serialization.PublicFormat.SubjectPublicKeyInfo)).decode('ascii') ### DISCLAIMER:- Since NO ENCRYPTION is used in the key storage/formatting. Please DO NOT use this code in production environment. private_pem = private_key.private_bytes(encoding=serialization.Encoding.PEM, format=serialization.PrivateFormat.TraditionalOpenSSL, encryption_algorithm=serialization.NoEncryption()) ## Store the private_key in a file verification_key.pem with open (\"verification_key.pem\", 'wb') as pem_out: pem_out.write(private_pem) pem_out.close() print(\"Public Key: \", public_key) print(\"Signature: \", signature) ```` ## State | State | Description | |-------|-------------| | storing | The Platform is storing the verification in our private key store | | pending | The Platform is verifying the verification key's signature | | verified | The Platform has verified the verification key's signature and the key can be used | | failed | The Platform was not able to verify the verification key's signature and the key cannot be used | Required scope: **banks:write**
* Responses:
* - 201: verification key created
* - 400: Invalid requests - malformed authentication header
* - 401: Unauthorized - Authentication failed, invalid subject
* - 403: Invalid scope
*
* @param postVerificationKeyBankModel
* @return [VerificationKeyBankModel]
*/
@POST("api/bank_verification_keys")
suspend fun createVerificationKey(@Body postVerificationKeyBankModel: PostVerificationKeyBankModel): Response
/**
* Get VerificationKey
* Retrieves a verification key. Required scope: **banks:read**
* Responses:
* - 200: Verification Key found
* - 400: Invalid requests - malformed authentication header
* - 401: Unauthorized - Authentication failed, invalid subject
* - 403: Invalid scope
* - 404: verification key not found
*
* @param verificationKeyGuid Identifier for the verification key.
* @return [VerificationKeyBankModel]
*/
@GET("api/bank_verification_keys/{verification_key_guid}")
suspend fun getVerificationKey(@Path("verification_key_guid") verificationKeyGuid: kotlin.String): Response
/**
* Get Verification Keys list
* Retrieves a listing of verification keys of a bank. Required scope: **banks:read**
* Responses:
* - 200: get list of verification keys
* - 400: Invalid requests - malformed authentication header
* - 401: Unauthorized - Authentication failed, invalid subject
* - 403: Invalid scope
*
* @param page (optional)
* @param perPage (optional)
* @return [VerificationKeyListBankModel]
*/
@GET("api/bank_verification_keys")
suspend fun listVerificationKeys(@Query("page") page: java.math.BigDecimal? = null, @Query("per_page") perPage: java.math.BigDecimal? = null): Response
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy