Provides an encryptedField function that wraps common Payload field types and encrypts their values at rest using AES-256-CTR with a random IV and the PAYLOAD_SECRET. Hooks encrypt and decrypt automatically, so the admin panel and API work as with normal fields. Values are JSON stringified before encryption and parsed back to keep their data type. Encrypted fields cannot be sorted or filtered in the database.
Database field encryption for Payload.
Installation
npm i @oversightstudio/encrypted-fields84
Stars
9
Forks
2
Open Issues
1 months ago
Last Updated
82
Weekly Downloads
v1.0.0
npm Version
9.9 KB
Unpacked Size
0
Dependencies
84+3 since Sep 7
| Date | Stars |
|---|---|
| Dec 6, 2026 | 84 |
| Dec 5, 2026 | 84 |
| Dec 4, 2026 | 84 |
| Dec 3, 2026 | 84 |
| Dec 2, 2026 | 84 |
| Dec 1, 2026 | 84 |
| Nov 30, 2026 | 84 |
| Nov 29, 2026 | 84 |
| Nov 28, 2026 | 84 |
| Nov 27, 2026 | 84 |
| Nov 26, 2026 | 84 |
| Nov 25, 2026 | 84 |
| Nov 24, 2026 | 84 |
| Nov 23, 2026 | 84 |
| Nov 22, 2026 | 84 |
| Nov 21, 2026 | 84 |
| Nov 20, 2026 | 84 |
| Nov 19, 2026 | 84 |
| Nov 18, 2026 | 84 |
| Nov 17, 2026 | 84 |
| Nov 16, 2026 | 84 |
| Nov 15, 2026 | 84 |
| Nov 14, 2026 | 84 |
| Nov 13, 2026 | 84 |
| Nov 12, 2026 | 84 |
| Nov 11, 2026 | 84 |
| Nov 10, 2026 | 84 |
| Nov 9, 2026 | 84 |
| Nov 8, 2026 | 84 |
| Nov 7, 2026 | 84 |
| Nov 6, 2026 | 84 |
| Nov 5, 2026 | 84 |
| Nov 4, 2026 | 84 |
| Nov 3, 2026 | 83 |
| Nov 2, 2026 | 83 |
| Nov 1, 2026 | 83 |
| Oct 31, 2026 | 83 |
| Oct 30, 2026 | 83 |
| Oct 29, 2026 | 83 |
| Oct 28, 2026 | 83 |
| Oct 27, 2026 | 83 |
| Oct 26, 2026 | 83 |
| Oct 25, 2026 | 83 |
| Oct 24, 2026 | 83 |
| Oct 23, 2026 | 83 |
| Oct 22, 2026 | 83 |
| Oct 21, 2026 | 83 |
| Oct 20, 2026 | 83 |
| Oct 19, 2026 | 83 |
| Oct 18, 2026 | 83 |
| Oct 17, 2026 | 83 |
| Oct 16, 2026 | 83 |
| Oct 15, 2026 | 83 |
| Oct 14, 2026 | 83 |
| Oct 13, 2026 | 83 |
| Oct 12, 2026 | 83 |
| Oct 11, 2026 | 83 |
| Oct 10, 2026 | 83 |
| Oct 9, 2026 | 82 |
| Oct 8, 2026 | 82 |
| Oct 7, 2026 | 82 |
| Oct 6, 2026 | 82 |
| Oct 5, 2026 | 82 |
| Oct 4, 2026 | 82 |
| Oct 3, 2026 | 82 |
| Oct 2, 2026 | 82 |
| Oct 1, 2026 | 82 |
| Sep 30, 2026 | 81 |
| Sep 29, 2026 | 81 |
| Sep 28, 2026 | 81 |
| Sep 27, 2026 | 81 |
| Sep 26, 2026 | 81 |
| Sep 25, 2026 | 81 |
| Sep 24, 2026 | 81 |
| Sep 23, 2026 | 81 |
| Sep 22, 2026 | 81 |
| Sep 21, 2026 | 81 |
| Sep 20, 2026 | 81 |
| Sep 19, 2026 | 81 |
| Sep 18, 2026 | 81 |
| Sep 17, 2026 | 81 |
| Sep 16, 2026 | 81 |
| Sep 15, 2026 | 81 |
| Sep 14, 2026 | 81 |
| Sep 13, 2026 | 81 |
| Sep 12, 2026 | 81 |
| Sep 11, 2026 | 81 |
| Sep 10, 2026 | 81 |
| Sep 9, 2026 | 81 |
| Sep 8, 2026 | 81 |
| Sep 7, 2026 | 81 |
Shared by 3 plugins in oversightstudio/payload-plugins.
82+13 since Sep 7
| Date | Weekly downloads |
|---|---|
| Dec 6, 2026 | 82 |
| Dec 5, 2026 | 77 |
| Dec 4, 2026 | 57 |
| Dec 3, 2026 | 89 |
| Dec 2, 2026 | 96 |
| Dec 1, 2026 | 107 |
| Nov 30, 2026 | 104 |
| Nov 29, 2026 | 108 |
| Nov 28, 2026 | 117 |
| Nov 27, 2026 | 137 |
| Nov 26, 2026 | 103 |
| Nov 25, 2026 | 101 |
| Nov 24, 2026 | 100 |
| Nov 23, 2026 | 112 |
| Nov 22, 2026 | 107 |
| Nov 21, 2026 | 99 |
| Nov 20, 2026 | 76 |
| Nov 19, 2026 | 77 |
| Nov 18, 2026 | 91 |
| Nov 17, 2026 | 82 |
| Nov 16, 2026 | 75 |
| Nov 15, 2026 | 90 |
| Nov 14, 2026 | 91 |
| Nov 13, 2026 | 111 |
| Nov 12, 2026 | 107 |
| Nov 11, 2026 | 111 |
| Nov 10, 2026 | 107 |
| Nov 9, 2026 | 106 |
| Nov 8, 2026 | 88 |
| Nov 7, 2026 | 91 |
| Nov 6, 2026 | 78 |
| Nov 5, 2026 | 85 |
| Nov 4, 2026 | 66 |
| Nov 3, 2026 | 94 |
| Nov 2, 2026 | 113 |
| Nov 1, 2026 | 133 |
| Oct 31, 2026 | 126 |
| Oct 30, 2026 | 156 |
| Oct 29, 2026 | 143 |
| Oct 28, 2026 | 131 |
| Oct 27, 2026 | 107 |
| Oct 26, 2026 | 95 |
| Oct 25, 2026 | 78 |
| Oct 24, 2026 | 80 |
| Oct 23, 2026 | 38 |
| Oct 22, 2026 | 62 |
| Oct 21, 2026 | 101 |
| Oct 20, 2026 | 141 |
| Oct 19, 2026 | 141 |
| Oct 18, 2026 | 141 |
| Oct 17, 2026 | 169 |
| Oct 16, 2026 | 202 |
| Oct 15, 2026 | 187 |
| Oct 14, 2026 | 153 |
| Oct 13, 2026 | 110 |
| Oct 12, 2026 | 98 |
| Oct 11, 2026 | 98 |
| Oct 10, 2026 | 68 |
| Oct 9, 2026 | 47 |
| Oct 8, 2026 | 47 |
| Oct 7, 2026 | 49 |
| Oct 6, 2026 | 48 |
| Oct 5, 2026 | 49 |
| Oct 4, 2026 | 50 |
| Oct 3, 2026 | 51 |
| Oct 2, 2026 | 47 |
| Oct 1, 2026 | 45 |
| Sep 30, 2026 | 51 |
| Sep 29, 2026 | 49 |
| Sep 28, 2026 | 51 |
| Sep 27, 2026 | 50 |
| Sep 26, 2026 | 53 |
| Sep 25, 2026 | 48 |
| Sep 24, 2026 | 44 |
| Sep 23, 2026 | 39 |
| Sep 22, 2026 | 41 |
| Sep 21, 2026 | 40 |
| Sep 20, 2026 | 43 |
| Sep 19, 2026 | 40 |
| Sep 18, 2026 | 50 |
| Sep 17, 2026 | 51 |
| Sep 16, 2026 | 49 |
| Sep 15, 2026 | 53 |
| Sep 14, 2026 | 61 |
| Sep 13, 2026 | 61 |
| Sep 12, 2026 | 66 |
| Sep 11, 2026 | 64 |
| Sep 10, 2026 | 67 |
| Sep 9, 2026 | 72 |
| Sep 8, 2026 | 76 |
| Sep 7, 2026 | 69 |
Each point is npm's rolling 7-day download count.
Health Score
Composite score based on GitHub activity, stars, npm downloads, publish recency, dependency count, and package size.
Badge for your README
[](https://payloaddirectory.dev/plugins/932147916-encrypted-fields)<a href="https://payloaddirectory.dev/plugins/932147916-encrypted-fields"><img src="https://payloaddirectory.dev/badge/932147916-encrypted-fields.svg" alt="Payload Directory"></a>README
pnpm add @oversightstudio/encrypted-fields @payloadcms/ui
This package brings encrypted fields to Payload. It provides an encryptedField function that allows you to easily add encrypted fields to your collections.
It supports most field field types, including ones like select or number with hasMany enabled. Additionally, it fully integrates with Payload’s field customization options and lifecycle events, making it behave just like any other field—just encrypted.
The package automatically encrypts and decrypts field values using hooks, meaning you don’t need any extra setup to use encrypted fields in the admin panel or through the API.
This package uses AES-256-CTR encryption, combined with your PAYLOAD_SECRET and a random IV. The encrypted value is stored as a string in the database.
For a deeper dive into how this encryption works, check out this blog post by Payload. It explains the same encryption approach but for a simple text field. This package expands on that to support more field types and make integration seamless.
Since encryption fundamentally converts data into an unreadable format, this package JSON stringifies your data before encrypting it and automatically parses it back after decryption to retain it's original data type.
Using field encryption comes with some tradeoffs:
These tradeoffs are standard when working with encrypted data, but they’re well worth it if protecting sensitive information is your goal.
Important: Make sure the PAYLOAD_SECRET environment variable is set before using this package.
import { CollectionConfig } from 'payload'
import { encryptedField } from '@oversightstudio/encrypted-fields'
export const SensitiveDataCollection: CollectionConfig = {
slug: 'sensitive-data',
fields: [
encryptedField({
name: 'name',
type: 'text',
}),
encryptedField({
name: 'age',
type: 'number',
}),
encryptedField({
name: 'birthDate',
type: 'date',
}),
encryptedField({
name: 'traits',
type: 'select',
options: [
{ label: 'Awesome', value: 'awesome' },
{ label: 'Based', value: 'based' },
{ label: 'Goat', value: 'goat' },
],
hasMany: true,
}),
],
}
| Field Type | Supported |
|---|---|
text | ✅ Yes |
number | ✅ Yes |
select | ✅ Yes |
checkbox | ✅ Yes |
email | ✅ Yes |
date | ✅ Yes |
json | ✅ Yes |
textarea | ✅ Yes |
code | ✅ Yes |
radio | ✅ Yes |
point | ❌ Not yet supported |
richText | ❌ Not yet supported |
All other missing field types (like as ui, tabs, etc.) are of course not supported, as they do not store user data that needs encryption.
Topics
payload field validators
Validation helper functions for Payload collection fields with custom messages and common format checks
4025/wk4v3
payload fields
Field factories and admin components for Unicode slugs, Jalali dates, integer money and Iranian identity data
75230/wk3v3
payload plugin json form builder
Edit a Payload json field as real admin fields, with the form shape built in the admin panel
72441/wk37v3
payload icon picker
Icon picker field for Payload v4 that stores the icon name and raw SVG, with dropdown or drawer modes
7027/wk0v4
payload phone number plugin
Phone number field with country selection, as-you-type formatting and validation in the Payload admin
69837/wk17v3
link field
Link field and Lexical link feature supporting internal document and custom URL links
6346/wk0v4