Comments (4)
Strongbox has tests for more than one field which pass under 3.1, so my guess is that's not the root of the problem. "Cannot visit" appears to be raised when a string is expected and instead an object is found. Strongbox turns the encrypted fields into objects, so this seems likely. Do you have any validations on those fields?
from strongbox.
I've solved the problem.
I had this line in my user model.
validates_uniqueness_of :phone_number, scope: [:username]
I used the validation above before I changed the type of the username
column from string to binary.
In other words; this should work.
validates_uniqueness_of :phone_number
@spikex Any idea why this is happening?
from strongbox.
It happens because when the scope feature of validates_uniqueness_of ends up with the Lock object when it was expecting the string value of the column. You could argue that this is a bug in validates_uniqueness_of, that it should call to_s to make sure it has a string.
But, it's never going to work in Stongbox; even if you had the username for the scope, given that a string is never encrypted the same way twice, that username can't be matched against the already encrypted ones in the database.
from strongbox.
That explains a lot, thanks!
from strongbox.
Related Issues (20)
- dynamic :public_key and :private_key HOT 4
- "stack level too deep" With Database Migration HOT 10
- Encoding::CompatibilityError HOT 1
- Allow empty encryption field HOT 2
- Tags for Releases HOT 2
- Per-Compnay encryption settings
- Travis-CI HOT 3
- Using strongbox with NSS HOT 1
- Format validations failing HOT 1
- Ciphertexts are unauthenticated HOT 6
- Default PKCS#1 v1.5 padding leaks information
- How to avoid storing private key by re-generating it HOT 1
- Decrypt Data Offline HOT 3
- Validation before encryption? HOT 3
- string contains null byte HOT 2
- Changelog HOT 1
- OpenSSL::PKey::RSAError: padding check failed
- Validate uniqueness is possible? HOT 3
- Current state of this gem HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from strongbox.