@@ -223,7 +223,30 @@ int_cipher_text, signature = build_input_text(plaintext, user_aes_key, sender, c
223223- ` int_cipher_text ` : The integer representation of the ciphertext.
224224- ` signature ` : The generated signature.
225225
226- ### 8. ` generate_rsa_keypair() `
226+ ### 8. ` build_string_input_text(plaintext, user_aes_key, sender, contract, func_sig, signing_key) `
227+
228+ ** Purpose:** Builds input text by encrypting the plaintext and signing it.
229+
230+ ** Usage:**
231+
232+ ``` python
233+ int_cipher_text, signature = build_string_input_text(plaintext, user_aes_key, sender, contract, func_sig, signing_key)
234+ ```
235+
236+ ** Parameters:**
237+
238+ - ` plaintext ` : The plaintext message.
239+ - ` user_aes_key ` : The user's AES key.
240+ - ` sender ` : The sender's address.
241+ - ` contract ` : The contract address.
242+ - ` func_sig ` : The function signature.
243+ - ` signing_key ` : The private key used for signing.
244+
245+ ** Returns:**
246+
247+ - ` input_text ` : A dictionary of the form { "ciphertext": { "value": int[ ] }, "signature": bytes[ ] }
248+
249+ ### 9. ` generate_rsa_keypair() `
227250
228251** Purpose:** Generates an RSA key pair.
229252
@@ -238,7 +261,7 @@ private_key_bytes, public_key_bytes = generate_rsa_keypair()
238261- ` private_key_bytes ` : The serialized private key.
239262- ` public_key_bytes ` : The serialized public key.
240263
241- ### 9 . ` encrypt_rsa(public_key_bytes, plaintext) `
264+ ### 10 . ` encrypt_rsa(public_key_bytes, plaintext) `
242265
243266** Purpose:** Encrypts plaintext using RSA encryption with a provided public key.
244267
@@ -257,7 +280,7 @@ ciphertext = encrypt_rsa(public_key_bytes, plaintext)
257280
258281- ` ciphertext ` : The encrypted message.
259282
260- ### 10 . ` decrypt_rsa(private_key_bytes, ciphertext) `
283+ ### 11 . ` decrypt_rsa(private_key_bytes, ciphertext) `
261284
262285** Purpose:** Decrypts ciphertext using RSA decryption with a provided private key.
263286
@@ -276,7 +299,7 @@ plaintext = decrypt_rsa(private_key_bytes, ciphertext)
276299
277300- ` plaintext ` : The decrypted message.
278301
279- ### 11 . ` keccak256(data) `
302+ ### 12 . ` keccak256(data) `
280303
281304** Purpose:** Computes the Keccak-256 hash of the provided data.
282305
@@ -294,7 +317,7 @@ hash_value = keccak256(data)
294317
295318- ` hash_value ` : The computed hash.
296319
297- ### 12 . ` get_func_sig(function_signature) `
320+ ### 13 . ` get_func_sig(function_signature) `
298321
299322** Purpose:** Computes the function signature hash using Keccak-256.
300323
@@ -312,7 +335,7 @@ func_sig_hash = get_func_sig(function_signature)
312335
313336- ` func_sig_hash ` : The first 4 bytes of the computed hash.
314337
315- ### 13 . ` decrypt_uint(ciphertext, user_key) `
338+ ### 14 . ` decrypt_uint(ciphertext, user_key) `
316339
317340** Purpose:** Decrypts a value stored in a contract using a user key
318341
@@ -331,7 +354,7 @@ plaintext = decrypt_uint(ciphertext, user_key)
331354
332355- ` result ` : The decrypted value.
333356
334- ### 14 . ` decrypt_string(ciphertext, user_key) `
357+ ### 15 . ` decrypt_string(ciphertext, user_key) `
335358
336359** Purpose:** Decrypts a value stored in a contract using a user key
337360
@@ -343,7 +366,7 @@ plaintext = decrypt_string(ciphertext, user_key)
343366
344367** Parameters:**
345368
346- - ` ciphertext ` : The value to be decrypted.
369+ - ` ciphertext ` : A dictionary of the form { " value": int [ ] } where each cell holds up to 8 characters (padded at the end with zeroes) encrypted
347370- ` userKey ` : The user's AES key.
348371
349372** Returns:**
0 commit comments