Rails 7 introduced a new option in ActiveRecord to encrypt data.
This library aims at decrypting the data with a simple interface.
- Find your credentials primary_keyandkey_derivation_salt(those generated by Railsbin/rails db:encryption:init- see RoR docs linked below)
- Add the package pip install git+ssh://git@github.com/digitalepidemiologylab/rails_ar_encryption.git
- Use it
from rails_ar_encryption import derive_key, decrypt # step 1 - derive the encryption key key = derive_key(primary_key, key_derivation_salt) # step 2 - decrypt message (message is the full payload generated by Rails) clear_text = decrypt(message, key) Have a look at a working example.