mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-07 08:17:05 +00:00
Add types for sasl-scram-sha-1
This commit is contained in:
Vendored
+41
@@ -0,0 +1,41 @@
|
||||
// Type definitions for sasl-scram-sha-1 1.2
|
||||
// Project: https://github.com/legastero/js-sasl-scram-sha-1
|
||||
// Definitions by: BendingBender <https://github.com/BendingBender>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
import { Mechanism } from 'saslmechanisms';
|
||||
|
||||
export = ScramSha1Mechanism;
|
||||
|
||||
declare class ScramSha1Mechanism implements Mechanism {
|
||||
static Mechanism: typeof ScramSha1Mechanism;
|
||||
static prototype: {
|
||||
name: 'SCRAM-SHA-1';
|
||||
clientFirst: true;
|
||||
};
|
||||
|
||||
name: 'SCRAM-SHA-1';
|
||||
clientFirst: true;
|
||||
|
||||
constructor(options?: ScramSha1Mechanism.Options);
|
||||
|
||||
response(cred: ScramSha1Mechanism.Credentials): string;
|
||||
|
||||
challenge(chal: string): this;
|
||||
}
|
||||
|
||||
declare namespace ScramSha1Mechanism {
|
||||
interface Options {
|
||||
genNonce?: () => number;
|
||||
}
|
||||
|
||||
interface Credentials {
|
||||
authzid?: string;
|
||||
username?: string;
|
||||
password?: string;
|
||||
salt?: string;
|
||||
saltedPassword?: string;
|
||||
clientKey?: string;
|
||||
serverKey?: string;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
import ScramSha1Mechanism = require('sasl-scram-sha-1');
|
||||
import { Mechanism } from 'sasl-scram-sha-1';
|
||||
import { Factory } from 'saslmechanisms';
|
||||
|
||||
new Factory().use(ScramSha1Mechanism);
|
||||
new Factory().use(Mechanism);
|
||||
|
||||
// $ExpectType "SCRAM-SHA-1"
|
||||
ScramSha1Mechanism.prototype.name;
|
||||
// $ExpectType true
|
||||
ScramSha1Mechanism.prototype.clientFirst;
|
||||
|
||||
const m = new ScramSha1Mechanism();
|
||||
new ScramSha1Mechanism({
|
||||
genNonce() {
|
||||
return 1;
|
||||
},
|
||||
});
|
||||
|
||||
// $ExpectType "SCRAM-SHA-1"
|
||||
m.name;
|
||||
// $ExpectType true
|
||||
m.clientFirst;
|
||||
// $ExpectType string
|
||||
m.response({ authzid: 'a' });
|
||||
m.response({ username: 'u' });
|
||||
m.response({ password: 'pw' });
|
||||
m.response({ salt: 's' });
|
||||
m.response({ saltedPassword: 'sp' });
|
||||
m.response({ clientKey: 'ck' });
|
||||
m.response({ serverKey: 'sk' });
|
||||
// $ExpectType ScramSha1Mechanism
|
||||
m.challenge('challenge');
|
||||
@@ -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-scram-sha-1-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user