"Missing master key" using lockbox

Viewed 963

I am using Lockbox to encrypt an attribute. But calling valid? always results in "Missing master key".

The master key is specified in credentials.yml.enc as lockbox_master_key: <redacted>. config/initializers/lockbox.rb specifies Lockbox.master_key = Rails.application.credentials.lockbox_master_key.

My model looks like:

class Address < ApplicationRecord
  encrypts :line_one
  blind_index :line_one
  ...

I appreciate any pointers on what is causing the exception.

Note: I have tried putsing Lockbox.master_key and it prints the correct decrypted value.

1 Answers

I didn't realize blind_index was a separate library needing its own separate configuration. Once configured (based on directions here), the issue is resolved.

Related