mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
Add types for sasl-digest-md5
This commit is contained in:
parent
e1a9b84984
commit
0eebf91a2d
41
types/sasl-digest-md5/index.d.ts
vendored
Normal file
41
types/sasl-digest-md5/index.d.ts
vendored
Normal file
@ -0,0 +1,41 @@
|
||||
// Type definitions for sasl-digest-md5 0.1
|
||||
// Project: https://github.com/jaredhanson/js-sasl-digest-md5
|
||||
// Definitions by: BendingBender <https://github.com/BendingBender>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
import { Mechanism } from 'saslmechanisms';
|
||||
|
||||
export = DigestMd5Mechanism;
|
||||
|
||||
declare class DigestMd5Mechanism implements Mechanism {
|
||||
static Mechanism: typeof DigestMd5Mechanism;
|
||||
static prototype: {
|
||||
name: 'DIGEST-MD5';
|
||||
clientFirst: false;
|
||||
};
|
||||
|
||||
name: 'DIGEST-MD5';
|
||||
clientFirst: false;
|
||||
|
||||
constructor(options?: DigestMd5Mechanism.Options);
|
||||
|
||||
response(cred: DigestMd5Mechanism.Credentials): string;
|
||||
|
||||
challenge(chal: string): this;
|
||||
}
|
||||
|
||||
declare namespace DigestMd5Mechanism {
|
||||
interface Options {
|
||||
genNonce?: () => number;
|
||||
}
|
||||
|
||||
interface Credentials {
|
||||
serviceType: string;
|
||||
host: string;
|
||||
username: string;
|
||||
password: string;
|
||||
serviceName?: string;
|
||||
realm?: string;
|
||||
authzid?: string;
|
||||
}
|
||||
}
|
||||
30
types/sasl-digest-md5/sasl-digest-md5-tests.ts
Normal file
30
types/sasl-digest-md5/sasl-digest-md5-tests.ts
Normal file
@ -0,0 +1,30 @@
|
||||
import DigestMd5Mechanism = require('sasl-digest-md5');
|
||||
import { Mechanism } from 'sasl-digest-md5';
|
||||
import { Factory } from 'saslmechanisms';
|
||||
|
||||
new Factory().use(DigestMd5Mechanism);
|
||||
new Factory().use(Mechanism);
|
||||
|
||||
// $ExpectType "DIGEST-MD5"
|
||||
DigestMd5Mechanism.prototype.name;
|
||||
// $ExpectType false
|
||||
DigestMd5Mechanism.prototype.clientFirst;
|
||||
|
||||
const m = new DigestMd5Mechanism();
|
||||
new DigestMd5Mechanism({
|
||||
genNonce() {
|
||||
return 1;
|
||||
},
|
||||
});
|
||||
|
||||
// $ExpectType "DIGEST-MD5"
|
||||
m.name;
|
||||
// $ExpectType false
|
||||
m.clientFirst;
|
||||
// $ExpectType string
|
||||
m.response({ serviceType: 's', host: 'h', username: 'u', password: 'p' });
|
||||
m.response({ serviceType: 's', host: 'h', username: 'u', password: 'p', serviceName: 'sn' });
|
||||
m.response({ serviceType: 's', host: 'h', username: 'u', password: 'p', realm: 'r' });
|
||||
m.response({ serviceType: 's', host: 'h', username: 'u', password: 'p', authzid: 'a' });
|
||||
// $ExpectType DigestMd5Mechanism
|
||||
m.challenge('challenge');
|
||||
23
types/sasl-digest-md5/tsconfig.json
Normal file
23
types/sasl-digest-md5/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-digest-md5-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/sasl-digest-md5/tslint.json
Normal file
1
types/sasl-digest-md5/tslint.json
Normal file
@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Loading…
Reference in New Issue
Block a user