Git Product home page Git Product logo

Comments (3)

spikex avatar spikex commented on June 11, 2024

"contact_number" is replaced by a Strongbox::Lock object to allow the encryption to function, which is why you can't call start_with on it

The default is for Strongbox to encrypt when the value is set. If you enable deferred encryption by adding :deferred_encryption => true to the encrypt_with_public_key configuration, then you should be able to validate with something like:

def validate_contact_number_format
   if contact_number.decrypt.start_with?('555')
      errors.add :contact_number, "Invalid Contact Number"
   end
end

If works because the deferred encryption setting means a password isn't required to decrypt until the record is saved.

from strongbox.

prashantjois avatar prashantjois commented on June 11, 2024

Thanks for the quick response Spike.

Took me a while to figure out what was going on but it looks like rubygems has version 0.7 which doesn't have this deferred_encryption option!

I'm pulling directly from this github page now and it's working great.

Thanks for all the work you've put into this!

from strongbox.

spikex avatar spikex commented on June 11, 2024

Ah, I forgot that there were a few more things I wanted to finish before releasing 0.8. I'll try to get it wrapped up in the next couple of weeks.

I'm glad it's of use!

from strongbox.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.