• This repository has been archived on 05/May/2023
  • Stars
    star
    10
  • Rank 1,807,489 (Top 36 %)
  • Language
    Go
  • License
    MIT License
  • Created almost 7 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Compatibility layer for tornado's signed values (and secure cookies consequently)

signedvalue

signedvalue is an implementation of signed and timestamped strings compatible with Tornado's create_signed_value, decode_signed_value, and therefore set_secure_cookie and get_secure_cookie.

Install

go get github.com/sashka/signedvalue

Usage

import "github.com/sashka/signedvalue"

// Sign your "Hello, world".
signed := signedvalue.Create("secret", "name", "Hello, world")

// Decode a signed string.
// Treat signed string as invalid if it's more than 1 minute old.
decoded, err := signedvalue.Decode("secret", "name", signed, 60)
if err != nil {
    // Signed string is no longer valid.
}

Contributing

Pull requests are kindly welcome.