<T>(self: Redacted<T>): TRetrieves the original value from a Redacted instance. Use this function
with caution, as it exposes the sensitive data.
When to use
Use when you need the underlying sensitive value at a trusted boundary.
Example (Retrieving a redacted value)
import { Redacted } from "effect"
import * as assert from "node:assert"
const API_KEY = Redacted.make("1234567890")
assert.equal(Redacted.value(API_KEY), "1234567890")export const const value: <T>(self: Redacted<T>) => TRetrieves the original value from a Redacted instance. Use this function
with caution, as it exposes the sensitive data.
When to use
Use when you need the underlying sensitive value at a trusted boundary.
Example (Retrieving a redacted value)
import { Redacted } from "effect"
import * as assert from "node:assert"
const API_KEY = Redacted.make("1234567890")
assert.equal(Redacted.value(API_KEY), "1234567890")
value: <function (type parameter) T in <T>(self: Redacted<T>): TT>(self: Redacted<T>(parameter) self: {
label: string | undefined;
pipe: { <A>(this: A): A; <A, B = never>(this: A, ab: (_: A) => B): B; <A, B = never, C = never>(this: A, ab: (_: A) => B, bc: (_: B) => C): C; <A, B = never, C = never, D = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D): D; <…;
}
self: 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<function (type parameter) T in <T>(self: Redacted<T>): TT>) => function (type parameter) T in <T>(self: Redacted<T>): TT = import redactedredacted.const value: <T>(
self: Redacted.Redacted<T>
) => T
value