tokentransfer

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2026 License: Apache-2.0 Imports: 12 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package tokentransfer moves an author's identity to another browser (etherpad-lite's /tokenTransfer): the first browser asks for a code, the second redeems it within five minutes, once, and gets the same author token as an HttpOnly cookie plus the pad preferences. The token never appears in a response body.

Index

Constants

View Source
const TTL = 5 * time.Minute

TTL is how long a code can be redeemed.

Variables

This section is empty.

Functions

func Register

func Register(app fiber.Router, h *Handler)

Register adds the routes.

Types

type Handler

type Handler struct {
	Store    db.DataStore
	Settings *settings.Settings
	Now      func() time.Time
}

Handler serves POST /tokenTransfer and GET /tokenTransfer/:id.

func (*Handler) Create

func (h *Handler) Create(c fiber.Ctx) error

Create answers POST /tokenTransfer: a code for the requester's author token cookie (it is HttpOnly, so the browser cannot send it any other way).

func (*Handler) Redeem

func (h *Handler) Redeem(c fiber.Ctx) error

Redeem answers POST /tokenTransfer/:id from a page of this site: 404 for an unknown or used code, 410 for an expired one; otherwise this browser takes over the author token. Not a GET, and never from another site: a link, an image or a form elsewhere must not swap a visitor's identity for one the attacker also holds. The welcome page asks before it redeems.

Jump to

Keyboard shortcuts

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