///
declare module 'browser-encrypt-attachment' {
export interface EncryptedAttachmentInfo {
v: string;
key: {
alg: string;
key_ops: string[];
kty: string;
k: string;
ext: boolean;
};
iv: string;
hashes: {
[alg: string]: string;
};
}
export interface EncryptedAttachment {
data: ArrayBuffer;
info: EncryptedAttachmentInfo;
}
export function encryptAttachment(dataBuffer: ArrayBuffer): Promise;
export function decryptAttachment(
dataBuffer: ArrayBuffer,
info: EncryptedAttachmentInfo
): Promise;
}
declare module '*.svg' {
const content: string;
export default content;
}
interface PluginAPI {
getPath: () => Promise<{ success: boolean; data?: string; error?: string }>;
download: (
pluginId: string,
downloadUrl: string,
name: string
) => Promise<{ success: boolean; data?: { path: string }; error?: string }>;
list: () => Promise<{
success: boolean;
data?: Array<{ id: string; name: string; installedDate: string; path: string }>;
error?: string;
}>;
uninstall: (pluginId: string) => Promise<{ success: boolean; error?: string }>;
readPluginCode: (pluginId: string) => Promise<{ success: boolean; data?: string; error?: string }>;
}
interface ElectronAPI {
platform?: string;
arch?: string;
clipboard?: {
writeText: (text: string) => void;
};
media?: {
saveFile: (payload: {
filename: string;
mimeType?: string;
data: Uint8Array;
}) => Promise<{
success?: boolean;
canceled?: boolean;
path?: string;
error?: string;
}>;
};
plugins?: PluginAPI;
protocol?: {
getStatus: () => Promise<{
success: boolean;
data?: {
scheme: string;
platform: string;
isDefault: boolean;
before: boolean;
registerCall: boolean;
error: string | null;
windows: null | {
userChoiceProgId: string | null;
userChoiceCommand: string | null;
hkcuCommand: string | null;
hklmCommand: string | null;
};
};
error?: string;
}>;
repair: () => Promise<{
success: boolean;
data?: {
scheme: string;
platform: string;
isDefault: boolean;
before: boolean;
registerCall: boolean;
error: string | null;
windows: null | {
userChoiceProgId: string | null;
userChoiceCommand: string | null;
hkcuCommand: string | null;
hklmCommand: string | null;
};
};
error?: string;
}>;
};
updater?: {
onUpdateDownloaded: (callback: (info: {
version: string;
releaseNotes?: unknown;
}) => void) => void;
};
discordCollectibles?: {
fetchCatalog: (force?: boolean) => Promise<{
success: boolean;
data?: { items: unknown[]; fetchedAt: string };
error?: string;
}>;
downloadAssets: (assets: Array<{ role: string; url: string; filename: string; mimeType: string }>) => Promise<{
success: boolean;
data?: Array<{
role: string;
url: string;
filename: string;
mimeType: string;
data: Uint8Array;
}>;
error?: string;
}>;
};
}
declare global {
interface Window {
electron?: ElectronAPI;
}
}
export {};