feat(pkcs7-padding): Added types for the pkcs7-padding package (#37687)

This commit is contained in:
Svet Nikolov
2019-08-16 15:12:22 -07:00
committed by Pranav Senthilnathan
parent 6918b0f6bb
commit 41fa048193
4 changed files with 42 additions and 0 deletions
+11
View File
@@ -0,0 +1,11 @@
// Type definitions for pkcs7-padding 0.1
// Project: https://github.com/neeh/pkcs7-padding#readme
// Definitions by: Svet Nikolov <https://github.com/svetkomir>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
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;
@@ -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);
+23
View File
@@ -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"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }