# Env\.schema\.secret: New Secret Schema Type for Environment Variables

Canonical URL : https://adonisjs-signal.jrmc.dev/insights/704e52bf-2fff-4093-bb91-03fa00969706
Source release or documentation date : 2026-10-14T14:23:51.000Z
Category : documentation | Developer impact : medium
Affected packages : @adonisjs/env

The documentation for AdonisJS v7 has been updated to introduce a new environment variable schema type called Env\.schema\.secret\. This schema validates that the value is a non\-empty string and wraps it in a Secret instance, designed for sensitive values like API tokens and encryption keys\. The secret values are redacted in logs and serialization by default, and can be accessed as plain strings by calling the \.release\(\) method\.

## What this means for your code

Developers can now use Env\.schema\.secret\(\) in their environment variable schemas to securely handle sensitive data\. This improves security by preventing accidental logging or serialization of secrets\. The new schema type is documented with examples showing how to define secrets and how to retrieve their plain string values when necessary\.

## Suggested actions

- Update environment variable schemas to use Env\.schema\.secret\(\) for sensitive values such as APP\_KEY and API tokens\.
- Use the \.release\(\) method to access the plain string value of a secret when passing it to libraries or APIs that require a string\.
- Be aware that once released, the secret value is no longer protected from logging or serialization\.

## Updated documentation

- [Configuration &amp; Environment](https://docs.adonisjs.com/configuration)

## Original sources

- [v7\-docs: 3 documentation file\(s\)](https://github.com/adonisjs/v7-docs/compare/e15b707ff25984e7e3c485b4464f250be5c847a0...c662af46d49061ea359a0a1a3ee4f7aabff55421)

AI-generated analysis based on the linked sources. Check the original documentation before changing your application.
