What is saslprep?
The saslprep npm package is used for preparing strings for use in Simple Authentication and Security Layer (SASL) mechanisms, particularly the SCRAM (Salted Challenge Response Authentication Mechanism) family. It implements the Stringprep protocol by providing a way to process user names and passwords before sending them over the network, ensuring that they conform to the requirements for internationalized strings as specified in RFC 4013.
What are saslprep's main functionalities?
String Preparation
This feature allows for the preparation of strings (e.g., user names and passwords) for use in SASL mechanisms. The code sample demonstrates how to use saslprep to process a string containing both ASCII and non-ASCII characters, making it suitable for SASL authentication mechanisms.
"use strict";
const saslprep = require('saslprep');
console.log(saslprep('I\u00ADX'));
Other packages similar to saslprep
stringprep
Similar to saslprep, stringprep provides functionality for preparing Unicode strings in network protocols. However, it covers a broader set of string preparation profiles defined by the Stringprep framework, whereas saslprep specifically targets the SASLprep profile.
saslprep
Stringprep Profile for User Names and Passwords, rfc4013
Usage
const saslprep = require('saslprep')
saslprep('password\u00AD')
saslprep('password\u0007')
API
saslprep(input: String, opts: Options): String
Normalize user name or password.
Options.allowUnassigned: bool
A special behavior for unassigned code points, see https://tools.ietf.org/html/rfc4013#section-2.5. Disabled by default.
License
MIT, 2017 (c) Dmitriy Tsvettsikh