Hyperlinkv0.8.0-beta.28

Redacted

Redacted.makeconsteffect/Redacted.ts:185
<T>(
  value: T,
  options?: { readonly label?: string | undefined }
): Redacted<T>

Creates a Redacted wrapper for a sensitive value.

When to use

Use to wrap a sensitive value so normal string, JSON, and inspection output is redacted.

Details

The wrapper redacts string, JSON, and inspection output to reduce accidental disclosure. The original value remains retrievable with Redacted.value until the wrapper is wiped or becomes unreachable.

Example (Creating a redacted value)

import { Redacted } from "effect"

const API_KEY = Redacted.make("1234567890")
constructors
Source effect/Redacted.ts:18510 lines
export const make = <T>(value: T, options?: {
  readonly label?: string | undefined
}): Redacted<T> => {
  const self = Object.create(Proto)
  if (options?.label) {
    self.label = options.label
  }
  redacted.redactedRegistry.set(self, value)
  return self
}
Referenced by 2 symbols