Repository Public License
1// ORIX Convert — Packages/ORIXConvertCore/Sources/ConvertCore/Secrets.swift2// Description: Secret option values (passwords). They travel in memory with a job request so the engine can use3// them, and are removed wherever options are persisted: history rows and preset files.4// Author: Simon-Pierre Boucher — contact@spboucher.ai5import Foundation67public extension ConversionOptions {8 /// `true` for an option key whose value is a secret: any key containing `password` (case-insensitive), e.g.9 /// `password`, `output.password.user`.10 static func isSecretKey(_ key: String) -> Bool { key.lowercased().contains("password") }1112 /// The keys of this set that hold secrets, sorted.13 var secretKeys: [String] { values.keys.filter(Self.isSecretKey).sorted() }1415 /// A copy without any secret value. This is what gets persisted (history, presets); the values themselves are16 /// never written anywhere.17 func redactingSecrets() -> ConversionOptions {18 ConversionOptions(values.filter { !Self.isSecretKey($0.key) })19 }20}21