Skip to content

digitalepidemiologylab/rails_ar_encryption

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rails ActiveRecord encryption for python

Rails 7 introduced a new option in ActiveRecord to encrypt data.

This library aims at decrypting the data with a simple interface.

Usage

  1. Find your credentials primary_key and key_derivation_salt (those generated by Rails bin/rails db:encryption:init - see RoR docs linked below)
  2. Add the package pip install git+ssh://git@github.com/digitalepidemiologylab/rails_ar_encryption.git
  3. 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.

Notes

Releases

No releases published

Packages

No packages published

Languages