privacy

package module
v1.7.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 22, 2026 License: MIT Imports: 2 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Privacy module

Opt-in redaction via Meta SAM 3.1: scans every media and profile-picture upload and blurs sensitive regions before anything is stored.

Seams

  • domain.Segmenter — finds detections, one Responses-API call per concept with boxes extracted. Implemented by infrastructure.SAMService.
  • domain.Service.RedactMedia — blurs faces, plates, nudity (media).
  • domain.Service.RedactProfilePicture — blurs plates and nudity, keeps faces visible (profile pictures).
  • media.Redactor (Redact) — adapted in internal/modules via NewMediaPrivacyRedactor.
  • profilepicture.Redactor (Redact) — adapted via NewProfilePicturePrivacyRedactor.

Fail-closed: any scan failure rejects the upload and stores nothing. Empty AI_SAM_API_KEY keeps the legacy pipeline byte-identical.

Documentation

Overview

Package privacy is the official privacy redaction module: the SAM 3.1 scan that blurs faces, plates, and nudity before media and profile pictures are stored. It owns no routes: the media and users domains call it through narrow seams the composition root adapts.

Index

Constants

View Source
const (
	// Name is the registry key for this module.
	Name = "privacy"

	// Version is the module version reported via Module.Version.
	Version = "0.1.0"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Module

type Module struct {
	// contains filtered or unexported fields
}

Module is the privacy kernel module.

func New

func New(opts ...Option) *Module

New builds the module, adopting the composition root's wiring.

func (*Module) AdminManifest

func (m *Module) AdminManifest() kernel.AdminExtensionManifest

AdminManifest declares this module's admin-shell extensions. Redaction is env-driven with no UI toggle, so the module declares nothing.

func (*Module) Init

func (m *Module) Init(_ kernel.Kernel) error

Init wires the module. The service is already adopted by New; Init only validates presence.

func (*Module) Name

func (m *Module) Name() string

Name returns the registry key.

func (*Module) Optional

func (m *Module) Optional() []string

Optional lists soft dependencies. None: the SAM client is built by the composition root, not discovered from another module.

func (*Module) Requires

func (m *Module) Requires() []string

Requires lists hard dependencies. Redaction degrades to inert without a segmenter, so nothing is required.

func (*Module) Service

func (m *Module) Service() *privacydomain.Service

Service exposes the adopted redaction service for composition-root wiring (media and profile-picture adapters). It stays valid for the module's lifetime.

func (*Module) Shutdown

func (m *Module) Shutdown() error

Shutdown releases module resources. There are none beyond memory.

func (*Module) Version

func (m *Module) Version() string

Version returns the module version.

type Option

type Option func(*Module)

Option configures a Module. The composition root supplies every option; direct construction without options yields a standalone module with an inert service (nil Segmenter returns its input unchanged).

func WithLogger

func WithLogger(logger kernel.Logger) Option

WithLogger attaches the module logger. Without one there is nothing to log: the service reports failures to its caller, which fails closed.

func WithService

func WithService(service *privacydomain.Service) Option

WithService adopts the redaction service (composition root, built over the SAM client when AI_SAM_API_KEY is set).

Directories

Path Synopsis
Package privacy owns the redaction domain: the Segmenter port that the SAM client implements and the Redactor service that blurs detections.
Package privacy owns the redaction domain: the Segmenter port that the SAM client implements and the Redactor service that blurs detections.
Package infrastructure adapts the privacy Segmenter port onto Meta's Model API (SAM 3.1): one Responses-API call per concept, boxes extracted.
Package infrastructure adapts the privacy Segmenter port onto Meta's Model API (SAM 3.1): one Responses-API call per concept, boxes extracted.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL