Merge pull request #14449 from lith-light-g/master

Add type definitions for cookie-signature
This commit is contained in:
Arthur Ozga
2017-02-09 13:50:34 -08:00
committed by GitHub
4 changed files with 51 additions and 0 deletions
@@ -0,0 +1,7 @@
import * as cookie from "cookie-signature";
let val = cookie.sign('hello', 'tobiiscool');
val = cookie.sign('hello', 'tobiiscool');
cookie.unsign(val, 'tobiiscool');
cookie.unsign(val, 'luna');
+21
View File
@@ -0,0 +1,21 @@
// Type definitions for cookie-signature 1.0
// Project: https://github.com/tj/node-cookie-signature
// Definitions by: François Nguyen <https://github.com/lith-light-g>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/**
* Sign the given `val` with `secret`.
* @param {string} val
* @param {string} secret
* @return {string}
*/
export function sign(value: string, secret: string): string;
/**
* Unsign and decode the given `val` with `secret`,
* returning `false` if the signature is invalid.
* @param {string} val
* @param {string} secret
* @return {string|boolean}
*/
export function unsign(value: string, secret: string): string | boolean;
+22
View File
@@ -0,0 +1,22 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"cookie-signature-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "../tslint.json" }