import type { EncryptedSavedObjectTypeRegistration } from './encrypted_saved_objects_service' ; /**
 * Represents the definition of the attributes of the specific saved object that are supposed to be
 * encrypted. The definition also dictates which attributes should be excluded from AAD and/or
 * stripped from response.
 */ export class EncryptedSavedObjectAttributesDefinition { public readonly attributesToEncrypt : ReadonlySet < string > ; private readonly attributesToExcludeFromAAD : ReadonlySet < string > | undefined ; private readonly attributesToStrip : ReadonlySet < string > ; constructor ( typeRegistration ) { const attributesToEncrypt = new Set < string > ( ) ; const attributesToStrip = new Set < string > ( ) ; for ( const attribute of typeRegistration . attributesToEncrypt ) { if ( typeof attribute === 'string' ) { attributesToEncrypt . add ( attribute ) ; attributesToStrip . add ( attribute ) ; } else { attributesToEncrypt . add ( attribute . key ) ; if ( ! attribute . dangerouslyExposeValue ) { attributesToStrip . add ( attribute . key ) ; } } } this . attributesToEncrypt = attributesToEncrypt ; this . attributesToStrip = attributesToStrip ; this . attributesToExcludeFromAAD = typeRegistration . attributesToExcludeFromAAD ; } param attributeName public shouldBeEncrypted ( attributeName ) { return this . attributesToEncrypt . has ( attributeName ) ; } param attributeName public shouldBeExcludedFromAAD ( attributeName ) { return ( this . shouldBeEncrypted ( attributeName ) || ( this . attributesToExcludeFromAAD != null && this . attributesToExcludeFromAAD . has ( attributeName ) ) ) ; } param attributeName public shouldBeStripped ( attributeName ) { return this . attributesToStrip . has ( attributeName ) ; } }