mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
parent
3648c25cad
commit
2032daa415
2 changed files with 4 additions and 4 deletions
|
@ -12,7 +12,7 @@ module ActiveRecord
|
||||||
end
|
end
|
||||||
|
|
||||||
# Returns a random key in hexadecimal format. The key will have a size in bytes of +:length+ (configured +Cipher+'s
|
# Returns a random key in hexadecimal format. The key will have a size in bytes of +:length+ (configured +Cipher+'s
|
||||||
# lenght by default)
|
# length by default)
|
||||||
#
|
#
|
||||||
# Hexadecimal format is handy for representing keys as printable text. To maximize the space of characters used, it is
|
# Hexadecimal format is handy for representing keys as printable text. To maximize the space of characters used, it is
|
||||||
# good practice including not printable characters. Hexadecimal format ensures that generated keys are representable with
|
# good practice including not printable characters. Hexadecimal format ensures that generated keys are representable with
|
||||||
|
|
|
@ -119,14 +119,14 @@ If you need to support a custom type, the recommended way is using a [serialized
|
||||||
```ruby
|
```ruby
|
||||||
# GOOD
|
# GOOD
|
||||||
class Article < ApplicationRecord
|
class Article < ApplicationRecord
|
||||||
serialize :title, Title
|
serialize :title, Title
|
||||||
encrypts :title
|
encrypts :title
|
||||||
end
|
end
|
||||||
|
|
||||||
# WRONG
|
# WRONG
|
||||||
class Article < ApplicationRecord
|
class Article < ApplicationRecord
|
||||||
encrypts :title
|
encrypts :title
|
||||||
serialize :title, Title
|
serialize :title, Title
|
||||||
end
|
end
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -404,7 +404,7 @@ The available config options are:
|
||||||
| `deterministic_key` | The key or list of keys used for deterministic encryption. It's preferred to configure it via a credential `active_record_encryption.deterministic_key`. |
|
| `deterministic_key` | The key or list of keys used for deterministic encryption. It's preferred to configure it via a credential `active_record_encryption.deterministic_key`. |
|
||||||
| `key_derivation_salt` | The salt used when deriving keys. It's preferred to configure it via a credential `active_record_encryption.key_derivation_salt`. |
|
| `key_derivation_salt` | The salt used when deriving keys. It's preferred to configure it via a credential `active_record_encryption.key_derivation_salt`. |
|
||||||
|
|
||||||
NOTE: It's recommende to use Rails built-in credentials support to store keys. If you prefer to set them manually via config properties, make sure you don't commit them with your code (e.g: use environment variables).
|
NOTE: It's recommended to use Rails built-in credentials support to store keys. If you prefer to set them manually via config properties, make sure you don't commit them with your code (e.g: use environment variables).
|
||||||
|
|
||||||
### Encryption contexts
|
### Encryption contexts
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue