Coder Social home page Coder Social logo

guitarrapc / base64urlcore Goto Github PK

View Code? Open in Web Editor NEW
3.0 3.0 2.0 96 KB

CLI tool for base64 & base64url encode/decode for URL applications.

License: MIT License

C# 100.00%
base64 base64url base64encode base64decode netcore2 dotnet-global-tool

base64urlcore's Introduction

Base64UrlCore

CircleCI Build Status codecov License: MIT

NuGet NuGet

Converting to, and from, base64url

base64urls offer you to run Base64UrlCore on the CLI.

Install

CLI

dotnet tool install -g base64urls

Library

dotnet add package Base64UrlCore

CLI Usage

SYNTAX

base64urls [-version] [-help] [encode|decode|escape|unescape] [args]

Decode

base64url encode input. Input should be a string or a Buffer.

$ base64urls decode QyMgaXMgYXdlc29tZQ==
C# is awesome

Encode

Convert a base64url encoded string into a raw string. The encoding argument can be used if the input is a string that's not utf8.

$ base64urls encode "C# is awesome."
QyMgaXMgYXdlc29tZS4=

Escape

Convert a base64 encoded string to a base64url encoded string.

$ base64urls escape "This+is/goingto+escape=="
This-is_goingto-escape

Unescape

Convert a base64url encoded string to a base64 encoded string.

$ base64urls unescape "This-is_goingto-escape"
This+is/goingto+escape==

Library Usage

Decode

base64url encode input. Input should be a string or a Buffer.

Base64Url.Decode("QyMgaXMgYXdlc29tZQ==");
// C# is awesome

Encode

Convert a base64url encoded string into a raw string. The encoding argument can be used if the input is a string that's not utf8.

Base64Url.Encode("C# is awesome.");
// QyMgaXMgYXdlc29tZS4=

Escape

Convert a base64 encoded string to a base64url encoded string.

Base64Url.Escape("This+is/goingto+escape==");
// "This-is_goingto-escape" 

Unescape

Convert a base64url encoded string to a base64 encoded string.

Base64Url.Unescape("This-is_goingto-escape");
// "This+is/goingto+escape=="

PadString

Add padding to encoded string.

Base64Url.PadString("aG9nZW1vZ2U");
// aG9nZW1vZ2U=

RemovePadding

Remove padding from encoded string.

Base64Url.RemovePadding("MQ==");
// MQ

Docker

Library

docker build -t base64urlcore . -f Dockerfile.Base64UrlCore

global tool

docker build -t base64urls . -f Dockerfile.base64urls

CI

Retired appveyor, now using CircleCI.

Local run

validate ci config.

docker run --rm -v $(pwd):/data circleci/circleci-cli:alpine config validate /data/.circleci/config.yml

Code Coverage

Using Coverlet and dotnet-reportgenerator. Add coverlet.msbuild to your csproj, add dotnet global tool dotnet tool install -g dotnet-reportgenerator-globaltool, and add environment variables CODECOV_TOKEN to CI. (You can find TOKEN at https://codecov.io/gh/guitarrapc/Base64UrlCore)

NuGet push

Add environment variable NUGET_KEY to CI. You can generate it at https://www.nuget.org/account/apikeys.

License

MIT

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.