mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-06-28 22:30:01 +00:00
Add types for sasl-plain
This commit is contained in:
31
types/sasl-plain/index.d.ts
vendored
Normal file
31
types/sasl-plain/index.d.ts
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
// Type definitions for sasl-plain 0.1
|
||||
// Project: https://github.com/jaredhanson/js-sasl-plain
|
||||
// Definitions by: BendingBender <https://github.com/BendingBender>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
import { Mechanism } from 'saslmechanisms';
|
||||
|
||||
export = PlainMechanism;
|
||||
|
||||
declare class PlainMechanism implements Mechanism {
|
||||
static Mechanism: typeof PlainMechanism;
|
||||
static prototype: {
|
||||
name: 'PLAIN';
|
||||
clientFirst: true;
|
||||
};
|
||||
|
||||
name: 'PLAIN';
|
||||
clientFirst: true;
|
||||
|
||||
response(cred: PlainMechanism.Credentials): string;
|
||||
|
||||
challenge(chal: string): this;
|
||||
}
|
||||
|
||||
declare namespace PlainMechanism {
|
||||
interface Credentials {
|
||||
authzid?: string;
|
||||
username: string;
|
||||
password: string;
|
||||
}
|
||||
}
|
||||
23
types/sasl-plain/sasl-plain-tests.ts
Normal file
23
types/sasl-plain/sasl-plain-tests.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import PlainMechanism = require('sasl-plain');
|
||||
import { Mechanism } from 'sasl-plain';
|
||||
import { Factory } from 'saslmechanisms';
|
||||
|
||||
new Factory().use(PlainMechanism);
|
||||
new Factory().use(Mechanism);
|
||||
|
||||
// $ExpectType "PLAIN"
|
||||
PlainMechanism.prototype.name;
|
||||
// $ExpectType true
|
||||
PlainMechanism.prototype.clientFirst;
|
||||
|
||||
const m = new PlainMechanism();
|
||||
|
||||
// $ExpectType "PLAIN"
|
||||
m.name;
|
||||
// $ExpectType true
|
||||
m.clientFirst;
|
||||
// $ExpectType string
|
||||
m.response({ username: 'u', password: 'pw' });
|
||||
m.response({ username: 'u', password: 'pw', authzid: 'a' });
|
||||
// $ExpectType PlainMechanism
|
||||
m.challenge('challenge');
|
||||
23
types/sasl-plain/tsconfig.json
Normal file
23
types/sasl-plain/tsconfig.json
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"sasl-plain-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/sasl-plain/tslint.json
Normal file
1
types/sasl-plain/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user