Giter VIP home page Giter VIP logo

base64url's Introduction

base64url

base64url, implemented in go (golang) is a small library supporting base64url encoding and decoding (collectively called coding). In addition, it is a command-line tool similar to BSD's base64 tool.

WARNING: THIS SOFTWARE CAN'T BE ERROR-FREE, SO USE IT AT YOUR OWN RISK. I HAVE DONE MY BEST TO MAKE SURE THAT THE TOOLS BEHAVE AS EXPECTED. BUT AGAIN ... USE IT AT YOUR OWN RISK. I AM NOT GIVING ANY KIND OF WARRANTY, NEITHER EXPLICITLY NOR IMPLICITLY.

Sample usage of library

    package main

    import (
        "fmt"
        "os"

        "github.com/theovassiliou/base64url"
    )

    const testString = "A text content to be base64url encoded"
    const encodedTestString = "QSB0ZXh0IGNvbnRlbnQgdG8gYmUgYmFzZTY0dXJsIGVuY29kZWQ"

    func main() {
        // encode a []byte and get the encoded value
        output := base64url.Encode([]byte(testString))
        fmt.Println(output) // returns QSB0ZXh0IGNvbnRlbnQgdG8gYmUgYmFzZTY0dXJsIGVuY29kZWQ

        // decode a string
        decodedOutput, err := base64url.Decode(encodedTestString)

        if err != nil {
            fmt.Println(err)
            os.Exit(1)
        }

        fmt.Println(string(decodedOutput))

        // check for symmetry
        decodedOutput, _ = base64url.Decode(base64url.Encode([]byte(testString)))
        fmt.Println(string(decodedOutput))

    }

Installation binaries

You can download the binaries directly from the releases section. Unzip/untar the downloaded archive and copy the files to a location of your choice, e.g. /usr/local/bin/ on *NIX or MacOS. If you install only the binaries, make sure that they are accessible from the command line. Ideally, they are accessible via $PATH or %PATH%, respectively.

Installation From Source

base64url requires golang version 1.13 or newer, the Makefile requires GNU make.

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.

Prerequisites

There is no particular requirement beyond the fact that you should have a working go installation.

Install Go >=1.13

Installing

Download base64url source by running, assuming you have git installed

cd $GOPATH/src/github.com/theovassiliou
git clone https://github.com/theovassiliou/base64url.git

This gets you your copy of base64url installed under $GOPATH/src/github.com/theovassiliou/base64url

Run make from the source directory by running

cd $GOPATH/src/github.com/theovassiliou/base64url
make all

to compile and build the executable base64url

and run

make go-install

to install a copy of the executable into $GOPATH/bin

For information on how to use the executable base64url consult the README)

Running the tests

We are using two different make targets for running tests.

make test
go test -short `go list`
ok      github.com/theovassiliou/base64url 0.3s

executes all short package tests, while

make test-all
go vet $(go list ./... )
go test `go list`
ok      github.com/theovassiliou/base64url 0.3s

executes in addition go vet on the package. Before committing to the code base please use make test-all to ensure that all tests pass.

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

Authors

License

This project is licensed under the MIT License - see the LICENSE file for details

Acknowledgments

Thanks to all the people out there that produce amazing open-source software, which supported the creation of this piece of software. In particular, I wasn't only able to use libraries, etc. But also, to learn and understand golang better. In particular, I wanted to thank


History

This project has been developed as I was seeking a library to support my work on identifying microservice.

base64url's People

Contributors

theovassiliou avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.