diff --git a/types/cryptr/cryptr-tests.ts b/types/cryptr/cryptr-tests.ts new file mode 100644 index 0000000000..3c655d7288 --- /dev/null +++ b/types/cryptr/cryptr-tests.ts @@ -0,0 +1,10 @@ +import Cryptr = require('cryptr'); + +// $ExpectType Cryptr +const cryptr = new Cryptr('myTotallySecretKey'); + +// $ExpectType string +const encrypted_string = cryptr.encrypt('bacon'); + +// $ExpectType string +cryptr.decrypt(encrypted_string); diff --git a/types/cryptr/index.d.ts b/types/cryptr/index.d.ts new file mode 100644 index 0000000000..4aec15c419 --- /dev/null +++ b/types/cryptr/index.d.ts @@ -0,0 +1,20 @@ +// Type definitions for cryptr 4.0 +// Project: https://github.com/MauriceButler/cryptr +// Definitions by: Roman Rogowski +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare class Cryptr { + /** + * Cryptr provides a mechanism for aes-256-ctr encryption/decryption. + * @param secret key used for encryption/decryption + */ + constructor(secret: string); + + /** Encrypt a string. */ + encrypt(value: string): string; + + /** Decrypt a string. */ + decrypt(value: string): string; +} + +export = Cryptr; diff --git a/types/cryptr/tsconfig.json b/types/cryptr/tsconfig.json new file mode 100644 index 0000000000..2727c48e08 --- /dev/null +++ b/types/cryptr/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "strictFunctionTypes": true + }, + "files": [ + "index.d.ts", + "cryptr-tests.ts" + ] +} diff --git a/types/cryptr/tslint.json b/types/cryptr/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/cryptr/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }