Add @types for ntlm-client (#42081)

* Add @types/ntlm-client

* Remove namespace

* Replace import for reference types
This commit is contained in:
Manuel Borrajo
2020-02-26 15:40:25 -08:00
committed by GitHub
parent 9583dfad4a
commit e1f3734de2
4 changed files with 84 additions and 0 deletions
+29
View File
@@ -0,0 +1,29 @@
// Type definitions for ntlm-client 0.1
// Project: https://github.com/clncln1/node-ntlm-client
// Definitions by: Manuel Borrajo <https://github.com/borrajo>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node"/>
interface NtlmType2 {
flags: number;
encoding: string;
version: number;
challenge: Buffer;
targetName: string;
targetInfo: {
parsed: {
DOMAIN: string;
SERVER: string;
DNS: string;
FQDN: string;
PARENT_DNS: string;
},
buffer: Buffer;
};
}
declare function createType1Message(workstation: string, domain: string): string;
declare function decodeType2Message(type1Message: string): NtlmType2;
declare function createType3Message(type2Message: NtlmType2, username: string, password: string, workstation: string, domain: string): string;
export { createType1Message, decodeType2Message, createType3Message };
+28
View File
@@ -0,0 +1,28 @@
import ntlm = require('ntlm-client');
const type2 = {
flags: 0,
encoding: '',
version: 3,
challenge: new Buffer(''),
targetName: '',
targetInfo: {
parsed: {
DOMAIN: '',
SERVER: '',
DNS: '',
FQDN: '',
PARENT_DNS: '',
},
buffer: new Buffer(''),
}
};
// $ExpectType string
ntlm.createType1Message('', '');
// $ExpectType string
ntlm.createType3Message(type2, '', '', '', '');
// $ExpectType NtlmType2
ntlm.decodeType2Message('');
+24
View File
@@ -0,0 +1,24 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictFunctionTypes": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [
],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"ntlm-client-tests.ts"
]
}
+3
View File
@@ -0,0 +1,3 @@
{
"extends": "dtslint/dt.json"
}