diff --git a/types/pkcs7-padding/index.d.ts b/types/pkcs7-padding/index.d.ts new file mode 100644 index 0000000000..15eb2c4e05 --- /dev/null +++ b/types/pkcs7-padding/index.d.ts @@ -0,0 +1,11 @@ +// Type definitions for pkcs7-padding 0.1 +// Project: https://github.com/neeh/pkcs7-padding#readme +// Definitions by: Svet Nikolov +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +export function pad(data: Buffer, size: number): Buffer; +export function pad(data: string, size: number): string; +export function unpad(data: Buffer): Buffer; +export function unpad(data: string): string; diff --git a/types/pkcs7-padding/pkcs7-padding-tests.ts b/types/pkcs7-padding/pkcs7-padding-tests.ts new file mode 100644 index 0000000000..8a1c351da5 --- /dev/null +++ b/types/pkcs7-padding/pkcs7-padding-tests.ts @@ -0,0 +1,7 @@ +import * as pkcs7 from 'pkcs7-padding'; + +const paddedValue: string = pkcs7.pad('string to pad', 32); +const paddedBufferValue: Buffer = pkcs7.pad(Buffer.from('string to pad'), 32); + +const unPaddedValue: string = pkcs7.pad(paddedValue, 32); +const unPaddedBufferValue: Buffer = pkcs7.pad(paddedBufferValue, 32); diff --git a/types/pkcs7-padding/tsconfig.json b/types/pkcs7-padding/tsconfig.json new file mode 100644 index 0000000000..10a2d49c61 --- /dev/null +++ b/types/pkcs7-padding/tsconfig.json @@ -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", + "pkcs7-padding-tests.ts" + ] +} diff --git a/types/pkcs7-padding/tslint.json b/types/pkcs7-padding/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/pkcs7-padding/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }