Skip to content

Commit

Permalink
chore: change declaration TypeScript files (#40)
Browse files Browse the repository at this point in the history
  • Loading branch information
FajarKim authored Jul 18, 2024
1 parent 4aa42d7 commit f9cba44
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 57 deletions.
36 changes: 18 additions & 18 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
const { encrypt, Encrypt } = require("./lib/encrypt");
const { decrypt, Decrypt } = require("./lib/decrypt");

/**
* Module declaration for the "@barudakrosul/gcrypt" module.
*
* @module @barudakrosul/gcrypt
*/
declare module "@barudakrosul/gcrypt" {
declare module "gcrypt" {
/**
* Interface representing the gcrypt module.
* Encrypts text using PBKDF2, zlib compression, and AES-256-GCM encryption.
*
* @param {Buffer|string} text - The text to be encrypted.
* @param {string} [password] - The passphrase for encryption.
* @returns {Buffer} - Encrypted data.
*/
interface Gcrypt {
encrypt: Encrypt;
decrypt: Decrypt;
gcrypt: Gcrypt;
}
function encrypt(text: Buffer | string, password?: string): Buffer;

const gcrypt: Gcrypt;
/**
* Decrypts encrypted data using PBKDF2, zlib decompression, and AES-256-GCM decryption.
*
* @param {Buffer|string} text - The encrypted data text.
* @param {string} [password] - The passphrase for decryption.
* @returns {Buffer|string} - Decrypted text.
*/
function decrypt(text: Buffer | string, password?: string): Buffer | string;

export { gcrypt, encrypt, decrypt, Gcrypt, Encrypt, Decrypt };
export default gcrypt;
export { encrypt, decrypt };
}

export = gcrypt;
20 changes: 7 additions & 13 deletions lib/decrypt.d.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,12 @@
/**
* Module declaration for decrypting text.
*
* @module decrypt
*/
declare module "decrypt" {
/**
* Interface representing the decryption function.
* Decrypts encrypted data using PBKDF2, zlib decompression, and AES-256-GCM decryption.
*
* @param {Buffer|string} text - The encrypted data text.
* @param {string} [password] - The passphrase for decryption.
* @returns {Buffer|string} - Decrypted text.
*/
interface Decrypt {
(text: Buffer | string, password?: string): Buffer | string;
}
function decrypt(text: Buffer | string, password?: string): Buffer | string;

const decrypt: Decrypt;

export { decrypt, Decrypt };
export default decrypt;
export = decrypt;
}
20 changes: 7 additions & 13 deletions lib/encrypt.d.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,12 @@
/**
* Module declaration for encrypting text.
*
* @module encrypt
*/
declare module "encrypt" {
/**
* Interface representing the encryption function.
* Encrypts text using PBKDF2, zlib compression, and AES-256-GCM encryption.
*
* @param {Buffer|string} text - The text to be encrypted.
* @param {string} [password] - The passphrase for encryption.
* @returns {Buffer} - Encrypted data.
*/
interface Encrypt {
(text: Buffer | string, password?: string): Buffer;
}
function encrypt(text: Buffer | string, password?: string): Buffer;

const encrypt: Encrypt;

export { encrypt, Encrypt };
export default encrypt;
export = encrypt;
}
19 changes: 6 additions & 13 deletions lib/parse-boolean.d.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,11 @@
/**
* Module declaration for parse boolean value.
*
* @module parse-boolean
*/
declare module "parse-boolean" {
/**
* Interface representing the parsing boolean function.
* Parse a boolean value from either a boolean or string representation.
*
* @param {boolean | string} value - The input value to parse as a boolean.
* @returns {boolean | undefined} - The parsed boolean value, or undefined if parsing fails.
*/
interface ParseBoolean {
(value: boolean | string): boolean | undefined;
}
function parseBoolean(value: boolean | string): boolean | undefined;

const parseBoolean: ParseBoolean;

export { parseBoolean, ParseBoolean };
export default parseBoolean;
export = parseBoolean;
}

0 comments on commit f9cba44

Please sign in to comment.