(u: unknown): u is Redacted<unknown>Returns true if a value is a Redacted wrapper.
When to use
Use to validate unknown input and narrow it to Redacted.
Details
When this function returns true, TypeScript narrows the value to
Redacted<unknown>.
Example (Checking for redacted values)
import { Redacted } from "effect"
const secret = Redacted.make("my-secret")
const plainString = "not-secret"
console.log(Redacted.isRedacted(secret)) // true
console.log(Redacted.isRedacted(plainString)) // falseexport const const isRedacted: (
u: unknown
) => u is Redacted<unknown>
Returns true if a value is a Redacted wrapper.
When to use
Use to validate unknown input and narrow it to Redacted.
Details
When this function returns true, TypeScript narrows the value to
Redacted<unknown>.
Example (Checking for redacted values)
import { Redacted } from "effect"
const secret = Redacted.make("my-secret")
const plainString = "not-secret"
console.log(Redacted.isRedacted(secret)) // true
console.log(Redacted.isRedacted(plainString)) // false
isRedacted = (u: unknownu: unknown): u: unknownu is interface Redacted<out A = string>A wrapper for sensitive values whose string, JSON, and inspection output is
redacted.
When to use
Use to carry sensitive values while reducing accidental exposure in string,
JSON, and inspection output.
Gotchas
The underlying value is still stored in memory and can be recovered with
Redacted.value until the wrapper is wiped or becomes unreachable. Use
Redacted to reduce accidental disclosure in logs and diagnostics, not as a
cryptographic protection mechanism.
Example (Creating redacted values)
import { Redacted } from "effect"
// Create a redacted value to protect sensitive information
const apiKey = Redacted.make("secret-key")
const userPassword = Redacted.make("user-password")
// TypeScript will infer the types as Redacted<string>
Namespace containing type-level members associated with Redacted values.
When to use
Use to access type-level helpers associated with Redacted.
Example (Using namespace utilities)
import { Redacted } from "effect"
// Use the Redacted namespace for type-level operations
const secret = Redacted.make("my-secret")
// The namespace contains utilities for working with Redacted values
const isRedacted = Redacted.isRedacted(secret) // true
Redacted<unknown> => import hasPropertyhasProperty(u: unknownu, const TypeId: "~effect/data/Redacted"TypeId)