{"id":19080942,"url":"https://github.com/linuxwolf/sazzle","last_synced_at":"2025-04-30T06:23:18.949Z","repository":{"id":6219022,"uuid":"7450345","full_name":"linuxwolf/sazzle","owner":"linuxwolf","description":"The SASL library with *PIZZAZZ*!","archived":false,"fork":false,"pushed_at":"2014-12-04T16:27:25.000Z","size":861,"stargazers_count":3,"open_issues_count":3,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-25T03:15:07.423Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/linuxwolf.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-01-05T01:58:37.000Z","updated_at":"2023-02-21T03:06:27.000Z","dependencies_parsed_at":"2022-09-11T10:03:43.753Z","dependency_job_id":null,"html_url":"https://github.com/linuxwolf/sazzle","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/linuxwolf%2Fsazzle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/linuxwolf%2Fsazzle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/linuxwolf%2Fsazzle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/linuxwolf%2Fsazzle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/linuxwolf","download_url":"https://codeload.github.com/linuxwolf/sazzle/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251652298,"owners_count":21621917,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-09T02:26:14.079Z","updated_at":"2025-04-30T06:23:18.927Z","avatar_url":"https://github.com/linuxwolf.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SAZZLE - The SASL library with *PIZZAZZ*! #\n\n**SAZZLE** is a pure JavaScript library for the Simple Authentication and Security Layer ([SASL](http://tools.ietf.org/html/rfc4422)). The goal is to provide a simple promised-based framework for processing SASL challenges and responses.\n\nThis library includes built-in support for [PLAIN](https://tools.ietf.org/html/rfc4616) and [SCRAM-SHA1](http://tools.ietf.org/html/rfc5802), while additional (or alternative) mechanisms can be added as needed.\n\nThis software is liecensed under the terms of the [MIT License](http://opensource.org/licenses/MIT).\n\n## Installation ##\n\nTo install the current stable release:\n\n    npm install sazzle\n\nTo install from sources:\n\n    git clone git@github.com:linuxwolf/sazzle.git\n    npm install ./sazzle\n\n## Usage ##\n\nTL;DR -- ficticious client version:\n\n    var sazzle = require(\"sazzle\");\n\n    // ... once the server's mechanism list is received\n    // create a SASL session based on the intersection of\n    // server-offered and client-enabled mechanisms ...\n    var ssesssion = sazzle.client.create(mechlist, {\n        username:\"bilbo.baggins\",\n        password:\"Th3r3 \u0026 84CK Aga!n\"\n    });\n\n    // call step() to get started ...\n    ssession.step().then(function(output) {\n        // NOTE: output is a Buffer\n        socket.send(output);\n    });\n    \n    var onSASL = function(input) {\n        // call step() to keep going, until completed!\n        ssession.step(input).then(function(output) {\n            if (output) {\n                socket.send(outupt);\n            }\n            if (ssession.completed) {\n                // YAY!  we're authenticated!\n                console.log(\"auth succeeded (username == %s; authzid == %s)\",\n                            ssession.properties.username,\n                            ssession.properties.authzid);\n                socket.removeListener(\"data\", onSASL);\n                // ... move on ...\n            }\n        }, function(err) {\n            // BOO! We've failed!\n            console.log(\"auth failed: %s\", err.message);\n            // c'est la vie\n        });\n    };\n    socket.on(\"data\", onSASL);\n\nTL;DR -- ficticious server version:\n\n    var sazzle = require(\"sazzle\"),\n        q = require(\"q\");\n\n    /// ... once we've got something, tell the client the offered mechanisms\n    socket.send(new Buffer(sazzle.server.enabled.join(\" \")));\n\n    var ssession;\n    socket.once(\"data\", function(input) {\n        // protocol-specific parse of input\n        // into mechanism name and initial data\n        ssession = sazzle.server.create(input.name, {\n            password: function(config, username) {\n                // lookup password, return in a promise (or directly)\n                return q.resolve(passwords[username]);\n            }\n        });\n\n        // process client initial\n        ssession.step(input.data).then(function(output) {\n            socket.send(output);\n            \n            function onSASL(output) {\n                ssession.step(input).then(function(output) {\n                    if (output) {\n                        socket.send(output);\n                    }\n                    if (ssession.completed) {\n                        // YAY!  we're authenticated!\n                        console.log(\"auth succeeded (username == %s; authzid == %s)\",\n                                    ssession.properties.username,\n                                    ssession.properties.authzid);\n                        socket.removeListener(\"data\", onSASL);\n                        // ... move on ...\n                    }\n                }, function(err) {\n                    // BOO! We've failed!\n                    console.log(\"auth failed: %s\", err.message);\n                    // c'est la vie\n                });\n            };\n            socket.on(\"data\", onSASL);\n        });\n    });\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flinuxwolf%2Fsazzle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flinuxwolf%2Fsazzle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flinuxwolf%2Fsazzle/lists"}