Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

tornado-xsrf

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tornado-xsrf

xsrf token library compatible with tornado

latest
Source
npmnpm
Version
1.2.0
Version published
Weekly downloads
127
1.6%
Maintainers
1
Weekly downloads
 
Created
Source

XSRF token library compatible with tornado

Basically reimplemented for node.js algorithm from tornado. Allows to interop between tornado and node.js services.

API

XSRF tokens in tornado cosist of 4 parts separated by pipe symbol |: version (this lib supports only version 2), bit mask, token itself (masked by, well, a mask) and timestamp: $version|$mask|$token|$timestamp, for example 2|c6f1fb92|756729199a209536ffcfab54893adf63|1686129179.

  • decodeToken(tokenStr: string): [number, Buffer, number] parses string token into parts: version, token and timestamp
  • makeToken(existingToken?: string): string creates or updates token. If existingToken is passed it will be updated with the new mask
  • compareTokens(token1: string, token2: string): boolean — parses and compares tokens

Keywords

tornado

FAQs

Package last updated on 09 Aug 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts