I have sadly not found any updated documentation regarding NSPasteboard or clipboard history in Spotlight on macOS Tahoe.
However...
It seems to support the standards outlined in NSPasteboard.org.
Here's my example code in macOS 26.0 Beta:
private func addPasswordToClipboardAsSimpleString() {
NSPasteboard.general.declareTypes([.string], owner: nil)
NSPasteboard.general.setString("Insecure password :(", forType:
.string)
}
private func addPasswordToClipboardAsNSPasteboardOrgString() {
NSPasteboard.general.declareTypes(
[
.string,
.init("org.nspasteboard.ConcealedType"),
.init("org.nspasteboard.TransientType")
],
owner: nil
)
NSPasteboard.general.setString(
"Secure password :)",
forType: .string
)
}
When calling addPasswordToClipboardAsSimpleString()
, the string is always visible in clipboard history in spotlight.
When calling addPasswordToClipboardAsNSPasteboardOrgString()
, the string is not visible in clipboard history in spotlight. Once the org.nspasteboard.*
types are removed from the declaration, the item is visible in clipboard history.
Can someone from Apple confirm what the behavior of the clipboard history is regarding NSPasteboard.org standards? Or is there an official API to mark a confidential (e.g. password) item that I write to NSPasteboard.general
not show up in Spotlight's clipboard history?