dwyl / fields

🌻 fields is a collection of useful field definitions (Custom Ecto Types) that helps you easily define an Ecto Schema with validation, encryption and hashing functions so that you can ship your Elixir/Phoenix App much faster!

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unable to encrypt data

SimonLab opened this issue · comments

commented

Error while trying to use Fields.Encrypted with a google token:

ya29.Il-yB-eegeLyTvygvFAtX-gJhq-LIfv1UskKVsczYPKtOeNB3l0P2ipcYNs0IrI2S5P1jZXPzfRSIYFhdsSx6ws5FYlNySzxeixEDbnTTtcrBg2a9fQJHzvWM6i9DWp2HA

(Postgrex.Error) ERROR 22021 (character_not_in_repertoire) 
invalid byte sequence for encoding "UTF8": 0xb0

@SimonLab thanks for reporting this bug. 👍
Let's create a regression test for it and ensure we understand why the error occurs and how to prevent it.

Confirmed not a "bug" #49

@SimonLab perhaps we could add Phoenix as a dev dependency
so that we can test the insertion of the ciphertext into Postgres?

Turns out that the data type for the field/column was defined as varchar and needed to be bytea
data is saved to Postgres now. 👍