@softvisio/core
Version:
Softisio core
39 lines (32 loc) • 938 B
JavaScript
const SUPPORTED_MECHANISMS = {
"PLAIN": null,
"LOGIN": null,
"CRAM-MD5": null,
"SCRAM-SHA-256": null,
};
export default class Sasl {
constructor ( username, password ) {
this.
this.
}
// static
static async new ( mechanisms, username, password ) {
for ( const mechanism of mechanisms ) {
if ( mechanism in SUPPORTED_MECHANISMS ) {
if ( !SUPPORTED_MECHANISMS[ mechanism ] ) {
( { "default": SUPPORTED_MECHANISMS[ mechanism ] } = await import( "#lib/sasl/" + mechanism.toLowerCase() ) );
}
return new SUPPORTED_MECHANISMS[ mechanism ]( username, password );
}
}
}
// properties
get username () {
return this.
}
get password () {
return this.
}
}