API
@agape/metadata

Sensitive Decorator

Marks the decorated class, property, method, or parameter as containing sensitive data.

API

Sensitive

Marks the decorated class, property, method, or parameter as containing sensitive data.

@Sensitive(  sensitive?: boolean)

Sensitive

Marks the decorated class, property, method, or parameter as containing sensitive data.

@paramsensitive:  boolean
Optional boolean to explicitly enable or disable sensitivity. Defaults to `true` if omitted.

Description

Marks the decorated class, property, method, or parameter as containing sensitive data.

This decorator sets sensitive to true on the corresponding MetadataDescriptor

Usage

Class

@Sensitive
class Credentials {
  username: string;
  password: string;
}

Property

class Employee {
  @Sensitive
  salary: number;
}

Method

class AuthService {
  @Sensitive
  authenticate(): Token {
    // authentication logic
  }
}

Parameter

class AuthService {
  login(
    @Sensitive credentials: Credentials
  ): Token {
    // login logic
  }
}

Explicitly disable sensitivity

class Admin extends User {
  @Sensitive(false)
  auditLog: string;
}

Class

@Sensitive
class Credentials {
  username: string;
  password: string;
}

Property

class Employee {
  @Sensitive
  salary: number;
}

Method

class AuthService {
  @Sensitive
  authenticate(): Token {
    // authentication logic
  }
}

Parameter

class AuthService {
  login(
    @Sensitive credentials: Credentials
  ): Token {
    // login logic
  }
}

Explicitly disable sensitivity

class Admin extends User {
  @Sensitive(false)
  auditLog: string;
}