zerot
    Preparing search index...

    Function auditLog

    • Creates an audit logging condition. This condition logs an audit event after a method successfully executes. Sensitive information is sanitized before logging.

      Parameters

      • action: string

        A string describing the action being audited (e.g., "USER_LOGIN", "DATA_UPDATE").

      Returns (output: any, input: any, context: AuthContext) => Promise<boolean>

      A condition function that takes output, input, and authentication context, and returns a Promise resolving to a boolean.

      class AuthService {
      @contract({
      ensures: [auditLog("USER_LOGIN")],
      })
      async login(credentials: { username: string; password: string }, context: AuthContext) {
      // Login logic
      return { success: true, userId: "user123" };
      }
      }