@tauri-apps/plugin-clipboard-manager 2.4.2 → 2.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist-js/index.cjs CHANGED
@@ -143,10 +143,33 @@ async function writeHtml(html, altText) {
143
143
  async function clear() {
144
144
  await core.invoke('plugin:clipboard-manager|clear');
145
145
  }
146
+ /**
147
+ * Writes sensitive plain text, such as a password, to the clipboard.
148
+ *
149
+ * The text is marked so the system doesn't keep or share it: on Windows it is excluded from
150
+ * clipboard history and cloud sync, on macOS and Linux clipboard managers are asked to skip it,
151
+ * on Android it is flagged as sensitive so the clipboard preview hides it,
152
+ * and on iOS it is not synced to other devices.
153
+ *
154
+ * @example
155
+ * ```typescript
156
+ * import { writeSecret } from '@tauri-apps/plugin-clipboard-manager';
157
+ * await writeSecret('my-password');
158
+ * ```
159
+ *
160
+ * @param text The plain text to write to the clipboard.
161
+ * @returns A promise indicating the success or failure of the operation.
162
+ *
163
+ * @since 2.5.0
164
+ */
165
+ async function writeSecret(text) {
166
+ await core.invoke('plugin:clipboard-manager|write_secret', { text });
167
+ }
146
168
 
147
169
  exports.clear = clear;
148
170
  exports.readImage = readImage;
149
171
  exports.readText = readText;
150
172
  exports.writeHtml = writeHtml;
151
173
  exports.writeImage = writeImage;
174
+ exports.writeSecret = writeSecret;
152
175
  exports.writeText = writeText;
@@ -113,4 +113,24 @@ declare function writeHtml(html: string, altText?: string): Promise<void>;
113
113
  * @since 2.0.0
114
114
  */
115
115
  declare function clear(): Promise<void>;
116
- export { writeText, readText, writeHtml, clear, readImage, writeImage };
116
+ /**
117
+ * Writes sensitive plain text, such as a password, to the clipboard.
118
+ *
119
+ * The text is marked so the system doesn't keep or share it: on Windows it is excluded from
120
+ * clipboard history and cloud sync, on macOS and Linux clipboard managers are asked to skip it,
121
+ * on Android it is flagged as sensitive so the clipboard preview hides it,
122
+ * and on iOS it is not synced to other devices.
123
+ *
124
+ * @example
125
+ * ```typescript
126
+ * import { writeSecret } from '@tauri-apps/plugin-clipboard-manager';
127
+ * await writeSecret('my-password');
128
+ * ```
129
+ *
130
+ * @param text The plain text to write to the clipboard.
131
+ * @returns A promise indicating the success or failure of the operation.
132
+ *
133
+ * @since 2.5.0
134
+ */
135
+ declare function writeSecret(text: string): Promise<void>;
136
+ export { writeText, readText, writeHtml, clear, readImage, writeImage, writeSecret };
package/dist-js/index.js CHANGED
@@ -141,5 +141,27 @@ async function writeHtml(html, altText) {
141
141
  async function clear() {
142
142
  await invoke('plugin:clipboard-manager|clear');
143
143
  }
144
+ /**
145
+ * Writes sensitive plain text, such as a password, to the clipboard.
146
+ *
147
+ * The text is marked so the system doesn't keep or share it: on Windows it is excluded from
148
+ * clipboard history and cloud sync, on macOS and Linux clipboard managers are asked to skip it,
149
+ * on Android it is flagged as sensitive so the clipboard preview hides it,
150
+ * and on iOS it is not synced to other devices.
151
+ *
152
+ * @example
153
+ * ```typescript
154
+ * import { writeSecret } from '@tauri-apps/plugin-clipboard-manager';
155
+ * await writeSecret('my-password');
156
+ * ```
157
+ *
158
+ * @param text The plain text to write to the clipboard.
159
+ * @returns A promise indicating the success or failure of the operation.
160
+ *
161
+ * @since 2.5.0
162
+ */
163
+ async function writeSecret(text) {
164
+ await invoke('plugin:clipboard-manager|write_secret', { text });
165
+ }
144
166
 
145
- export { clear, readImage, readText, writeHtml, writeImage, writeText };
167
+ export { clear, readImage, readText, writeHtml, writeImage, writeSecret, writeText };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tauri-apps/plugin-clipboard-manager",
3
- "version": "2.4.2",
3
+ "version": "2.5.0",
4
4
  "license": "MIT OR Apache-2.0",
5
5
  "authors": [
6
6
  "Tauri Programme within The Commons Conservancy"