@crpdo/time

0.0.4 • Public • Published

@crpdo/time

time is the key to all mysteries

npm pipeline license downloads

Gitlab Twitter Discord

This module provides time-related utilities for the parent project, primarily dealing with time-based one-time password (TOTP) generation, verification, and Network Time Protocol (NTP) calculations. @crpdo/time is a submodule of the larger crpdo project, a comprehensive cryptographic library for Node.js and the browser, which leverages TweetNaCl for various cryptographic functions.

Installation

npm install @crpdo/time

Usage

const Time = require('@crpdo/time')

// Generate a TOTP
const secret = 'my_secret'
const totpGap = 10
const now = Date.now()
const totp = Time.code(secret, totpGap, now)

// Verify a token
const token = 'my_token'
const hashed = true
const range = 1
const result = Time.verify(token, secret, now, hashed, range, totpGap)

Documentation

Parent Project

@crpdo/time is part of the crpdo project. For more information on crpdo and its other submodules, please see the main crpdo repository.

Tests

In order to run the test suite, simply clone the repository and install its dependencies:

git clone https://gitlab.com/frenware/core/crpdo/time.git
cd basd
npm install

To run the tests:

npm test

Contributing

Thank you! Please see our contributing guidelines for details.

Donations

If you find this project useful and want to help support further development, please send us some coin. We greatly appreciate any and all contributions. Thank you!

Bitcoin (BTC):

1JUb1yNFH6wjGekRUW6Dfgyg4J4h6wKKdF

Monero (XMR):

46uV2fMZT3EWkBrGUgszJCcbqFqEvqrB4bZBJwsbx7yA8e2WBakXzJSUK8aqT4GoqERzbg4oKT2SiPeCgjzVH6VpSQ5y7KQ

License

@crpdo/time is MIT licensed.

Package Sidebar

Install

npm i @crpdo/time

Weekly Downloads

11

Version

0.0.4

License

MIT

Unpacked Size

19.9 kB

Total Files

8

Last publish

Collaborators

  • basedwon