plinq / pgcrypto Goto Github PK
View Code? Open in Web Editor NEWA transparent ActiveRecord::Base extension pgcrypto encrypted columns
License: MIT License
A transparent ActiveRecord::Base extension pgcrypto encrypted columns
License: MIT License
Hi,
Great gem, I was wondering if you might have some insight about an issue I'm having which I think is due to Arel 6.0 upgrade. In Arel 5.0 BindParams < SqlLiteral < String < Object < BasicObject , but in Arel 6.0 BindParams < Node < Object < BasicObject. I assume this is the reason I get the message:
TypeError: wrong argument type Arel::Nodes::BindParam (expected String)
from ... /vendor/ruby/2.2.0/gems/activerecord-4.2.0/lib/active_record/connection_adapters/postgresql/quoting.rb:19:in escape_string' from ... /vendor/ruby/2.2.0/gems/activerecord-4.2.0/lib/active_record/connection_adapters/postgresql/quoting.rb:19:in
quote_string'
from ... /vendor/ruby/2.2.0/gems/pgcrypto-0.4.1/lib/pgcrypto/adapter.rb:51:in `pgcrypto_encrypt_string'
More info on stack exchange here: (http://stackoverflow.com/questions/29102190/postgres-9-4-pgcrypto-0-4-1-rails-4-2-0-ruby-2-2-0-quoting-expected-string) , happy to help out with a pull request but I'm not clear on how to get a value out of Arel::Nodes::BindParam. I suspect the problem line is in pgcrypto_insert line 64 and pgcrypto_update line 98 (possibly other areas as well) where you are pulling a value from Arel::Nodes::BindParam.
thanks
I follow the steps but I get some errors
Steps followed:
PGCrypto.keys[:private] = {:path => "./keys/private.key" , :armored => false, :password => "password" }
PGCrypto.keys[:public] = {:path => "./keys/public.key"}
3 . Edit my user.rb and add the following: pgcrypto :organisation_name
(column in my users table)
During Create:
It works and the records gets saved
During Read/Update I get:
PG::Error: ERROR: failed to find conversion function from unknown to bytea
Any Ideas?
I am using rails 6 and when i use has_encrypted_column it just throws the binary string instead decrypted value any help here.
has_encrypted_column :date_of_birth
p = PersonalInfo.last
p.date_of_birth is "x313937392d30332d3034"
instead i wanted the value as "1995-08-01"
Any help here.
When I have pgcrypto as the adapter I'm not longer able to drop or create the DB. Only migrate works.
This gem is really cool not trying to take anything away from it. However it would be nice if there was support for some sort of software abstraction surrounding the encryption that allowed you to associate a datatype to a particular column so that when it was unencrypted by the gem, it would automatically be in the correct format (e.g. integer, datetime, etc.) as opposed to everything going in and coming out as a string and needing to convert it accordingly.
Cheers, though, this is super awesome!
I added the in the Gemlist when I update the adapter to pgcrypto
I am getting the above error. Can you please help me with that? I am using rails 6 and ruby 2.6.5
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.