1212from botocore .exceptions import NoCredentialsError
1313
1414from .infisical_requests import InfisicalRequests
15- from .api_types import ListSecretsResponse , MachineIdentityLoginResponse , ListKmsKeysResponse , SingleKmsKeyResponse , \
16- KmsKey , SymmetricEncryption , KmsKeyEncryptDataResponse , KmsKeyDecryptDataResponse , KmsKeysOrderBy , OrderDirection
17- from .api_types import SingleSecretResponse , BaseSecret
15+
16+ from .api_types import ListSecretsResponse , SingleSecretResponse , BaseSecret
17+ from .api_types import SymmetricEncryption , KmsKeysOrderBy , OrderDirection
18+ from .api_types import ListKmsKeysResponse , SingleKmsKeyResponse , MachineIdentityLoginResponse
19+ from .api_types import KmsKey , KmsKeyEncryptDataResponse , KmsKeyDecryptDataResponse
1820
1921
2022class InfisicalSDKClient :
@@ -346,6 +348,7 @@ def delete_secret_by_name(
346348
347349 return result .data .secret
348350
351+
349352class KMS :
350353 def __init__ (self , client : InfisicalSDKClient ) -> None :
351354 self .client = client
@@ -462,13 +465,13 @@ def delete_key(
462465 def encrypt_data (
463466 self ,
464467 key_id : str ,
465- plaintext : str ) -> str :
468+ base64EncodedPlaintext : str ) -> str :
466469 """
467470 Encrypt data with the specified KMS key.
468471
469472 :param key_id: The ID of the key to decrypt the ciphertext with
470473 :type key_id: str
471- :param plaintext : The base64 encoded plaintext to encrypt
474+ :param base64EncodedPlaintext : The base64 encoded plaintext to encrypt
472475 :type plaintext: str
473476
474477
@@ -477,7 +480,7 @@ def encrypt_data(
477480 """
478481
479482 request_body = {
480- "plaintext" : plaintext
483+ "plaintext" : base64EncodedPlaintext
481484 }
482485
483486 result = self .client .api .post (
@@ -509,11 +512,10 @@ def decrypt_data(
509512 "ciphertext" : ciphertext
510513 }
511514
512-
513515 result = self .client .api .post (
514516 path = f"/api/v1/kms/keys/{ key_id } /decrypt" ,
515517 json = request_body ,
516518 model = KmsKeyDecryptDataResponse
517519 )
518520
519- return result .data .plaintext
521+ return result .data .plaintext
0 commit comments