signal-desktop/sticker-creator/util/preload.ts
2020-11-04 13:03:13 -06:00

32 lines
912 B
TypeScript

// Copyright 2019-2020 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import { Metadata } from 'sharp';
declare global {
interface Window {
processStickerImage: ProcessStickerImageFn;
encryptAndUpload: EncryptAndUploadFn;
}
}
export type StickerImageData = {
buffer: Buffer;
src: string;
path: string;
meta: Metadata & { pages?: number }; // Pages is not currently in the sharp metadata type
};
type ProcessStickerImageFn = (path: string) => Promise<StickerImageData>;
export type StickerData = { imageData?: StickerImageData; emoji?: string };
export type PackMetaData = { packId: string; key: string };
export type EncryptAndUploadFn = (
manifest: { title: string; author: string },
stickers: Array<StickerData>,
cover: StickerImageData,
onProgress?: () => unknown
) => Promise<PackMetaData>;
export const { encryptAndUpload, processStickerImage } = window;