archethic-node icon indicating copy to clipboard operation
archethic-node copied to clipboard

Add Crypto.decrypt_with_storage_nonce/1 in Interpreter's library

Open samuelmanzanera opened this issue 9 months ago • 0 comments

Description

Add Crypto.decrypt_with_storage_nonce/1 in the Interpreter's library.

This feature allows node to decrypt secrets during the contract's execution.

Type of change

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

  • Unit tests
  • Integration test with the following code:
  @version 1
  actions triggered_by: interval, at: "* * * * * *" do
    cleartext = Crypto.decrypt_with_storage_nonce(0x...)
    Contract.set_content(cleartext)
  end

The ciphertext is generated using the Crypto.ec_encrypt("data to encrypt", Crypto.storage_nonce_public_key())

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

samuelmanzanera avatar May 14 '24 07:05 samuelmanzanera