UNPKG

rpgm-asset-decrypter

Version:

RPG Maker MV/MZ asset decrypter, that can be safely used both in browser and Node.js.

39 lines (38 loc) 1.65 kB
export declare class Decrypter { private key; private keyArray; private readonly headerLength; /** * @param {string} key Encryption key, that can be fetched from `System.json`'s `encryptionKey` field. Leave it `null` to auto-determine the key from input files. You can set it after constructing `Decrypter` using `Decrypter.setKeyFromImage()` or `Decrypter.setKey()`. */ constructor(key?: string | null); private splitEncryptionCode; private processBuffer; /** * Returns the decrypter's key. * * Falls back to empty string if key is not set. */ getKey(): string; /** * @param key {string} Sets the key of decrypter to provided string. */ setKeyString(key: string): void; /** * Sets the key of decrypter from encrypted `fileContent` image data. * @param {ArrayBuffer} fileContent The data of RPG Maker file. */ setKeyFromImage(fileContent: ArrayBuffer): void; /** * The function will return wrong data, when used with audio (`rpgmvo`, `rpgmvm`, `ogg_`, `m4a_`) file without an explicitly set key. * @param {ArrayBuffer} fileContent The data of RPG Maker file. * @returns {ArrayBuffer} Decrypted data. */ decrypt(fileContent: ArrayBuffer): ArrayBuffer; /** * This function needs decrypter to have a key, which you can fetch from `System.json` file or by calling `Decrypter.setKeyFromImage()`/`Decrypter.setKeyString()`. * @param {ArrayBuffer} fileContent The data of `.png`, `.ogg` or `.m4a` file. * @returns {ArrayBuffer} Encrypted data. */ encrypt(fileContent: ArrayBuffer): ArrayBuffer; }