Copyright (c) 2014 - Gustavo Niemeyer <gustavo@niemeyer.net> All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Package scram implements a SCRAM-{SHA-1,etc} client per RFC5802. http://tools.ietf.org/html/rfc5802
package scram
import (
)
Client implements a SCRAM-* client (SCRAM-SHA-1, SCRAM-SHA-256, etc). A Client may be used within a SASL conversation with logic resembling: var in []byte var client = scram.NewClient(sha1.New, user, pass) for client.Step(in) { out := client.Out() // send out to server in := serverOut } if client.Err() != nil { // auth failed }
NewClient returns a new SCRAM-* client with the provided hash algorithm. For SCRAM-SHA-256, for example, use: client := scram.NewClient(sha256.New, user, pass)
Step processes the incoming data from the server and makes the next round of data for the server available via Client.Out. Step returns false if there are no errors and more data is still expected.
The pages are generated with Goldsv0.3.2-preview. (GOOS=darwin GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu.
PR and bug reports are welcome and can be submitted to the issue list.
Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds.