User
RubyonRails中的模型。我已经成功地加密了另一个表上的其他6列,但这次我得到了错误
must specify an iv
用户
桌子。
以下是我的原始迁移以添加列:
class AddPushNotificationColumnsToUser < ActiveRecord::Migration[5.1]
def change
add_column :users, :endpoint, :string
add_column :users, :expiration_time, :string
add_column :users, :encrypted_p256dh, :string
add_column :users, :encrypted_auth, :string
add_column :users, :encrypted_p256dh_iv, :string
add_column :users, :encrypted_auth_iv, :string
end
end
我的型号:
attr_encrypted :p256dh, key: Rails.application.secrets.db_encryption_key
attr_encrypted :auth, key: Rails.application.secrets.db_encryption_key
User.first.p256dh
或
User.first.auth
我得到一个错误:
必须指定iv
任何帮助都将不胜感激。