@crpdo/time v0.0.4
@crpdo/time
time is the key to all mysteries
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/timeUsage
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 installTo run the tests:
npm testContributing
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):
1JUb1yNFH6wjGekRUW6Dfgyg4J4h6wKKdFMonero (XMR):
46uV2fMZT3EWkBrGUgszJCcbqFqEvqrB4bZBJwsbx7yA8e2WBakXzJSUK8aqT4GoqERzbg4oKT2SiPeCgjzVH6VpSQ5y7KQLicense
@crpdo/time is MIT licensed.