mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-12 21:10:23 +00:00
feat(rijndael-js): Added type definitions for the rijndael-js package (#37691)
This commit is contained in:
committed by
Pranav Senthilnathan
parent
4e61a08d6b
commit
9a8eef8fec
Vendored
+14
@@ -0,0 +1,14 @@
|
||||
// Type definitions for rijndael-js 1.0
|
||||
// Project: https://github.com/Snack-X/rijndael-js#readme
|
||||
// Definitions by: Svet Nikolov <https://github.com/svetkomir>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="node" />
|
||||
|
||||
export = RijndaelBlock;
|
||||
|
||||
declare class RijndaelBlock {
|
||||
constructor(key: Buffer | string, mode: string);
|
||||
encrypt(_plaintext: Buffer | string, blockSize: string, _iv: Buffer | string): Buffer;
|
||||
decrypt(_ciphertext: Buffer, blockSize: string, _iv: Buffer | string): Buffer;
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
import RijndaelBlock = require('rijndael-js');
|
||||
|
||||
const rijndaelBlockStringTest = new RijndaelBlock('12345678901234567890123456789012', 'cbc');
|
||||
|
||||
const rijndaelBlock = new RijndaelBlock(Buffer.from('12345678901234567890123456789012'), 'cbc');
|
||||
|
||||
let encryptedValue: Buffer = rijndaelBlock.encrypt('text to encrypt', '128', '1234567890123456');
|
||||
encryptedValue = rijndaelBlock.encrypt(Buffer.from('text to encrypt'), '128', Buffer.from('1234567890123456'));
|
||||
|
||||
let decryptedValue: Buffer = rijndaelBlock.decrypt(encryptedValue, '128', '1234567890123456');
|
||||
decryptedValue = rijndaelBlock.decrypt(encryptedValue, '128', Buffer.from('1234567890123456'));
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictFunctionTypes": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"rijndael-js-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user