ectoken

package module
v0.0.0-...-26f6d37 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 8, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

README

go-ectoken

golang implementation of EdgeCast token (ectoken)

Table of Contents

Background

golang implementation of the "EdgeCast Token" (ectoken) -see main repo ectoken for more details.

Install

Build with Make
go-ectoken>make
go build ./cmd/ectoken/ectoken.go
Running tests
go-ectoken>make test
go clean -testcache
go test ./...
ok  	_/go-ectoken	0.002s
?   	_/go-ectoken/cmd/ectoken	[no test files]
go test ./cmd/ectoken/...
?   	_/go-ectoken/cmd/ectoken	[no test files]

Usage

Help
~>./ectoken 
Usage:
 To Encrypt:
     ec_encrypt <key> <text>
 or:
     ec_encrypt encrypt <key> <text>
 To Decrypt:
     ec_encrypt decrypt <key> <text>
Encrypt

Encrypt clear text token <token> with key: <key>:

~>./ectoken encrypt MY_SECRET_KEY MY_COOL_TOKEN
aaOUHrqxEmCLpnSAwTD06I54ffrtaa0K-3P7KKbosRChSubvbtWq5VY
Decrypt

Decrypt ciphertext token <token> with key: <key>:

~>./ectoken decrypt MY_SECRET_KEY lm6b156_M3XkS8SWOdJ_D1UBPZZzX7cDxh6aCb9kJ7pox0eco9XZqSk
MY_COOL_TOKEN

Contribute

  • We welcome issues, questions and pull requests.

License

This project is licensed under the terms of the Apache 2.0 open source license. Please refer to the LICENSE-2.0.txt file for the full terms.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Decrypt

func Decrypt(key, token string) (string, error)

* Decrypt decrypts the given token using the supplied key. On success, * returns the decrypted content and a nil error. If the token is invalid or * can not be decrypted, returns an empty string and a non-nil error.

func Encrypt

func Encrypt(key, token string) string

* Encrypt encrypts the given content using the supplied key.

Types

This section is empty.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL