Giter Site home page Giter Site logo

peterfritz / time Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 76 KB

Get the current time, timezone, and a language-sensitive representation of the current time in the local timezone based on the user's IP. Create and validate signed date tokens.

Home Page: https://time.ptr.red/

License: MIT License

JavaScript 8.04% CSS 8.80% TypeScript 83.16%
cryptography date time

time's Introduction


time

Get the current time, timezone, and a language-sensitive representation of the current time in the local timezone based on the user's IP.
Create and validate signed date tokens.


GET https://time.ptr.red/geo

Get the current time, timezone, and a language-sensitive representation of the current time in the local timezone based on the user's IP.

This API endpoint returns a JSON object with the following properties:

{
  "timezone": "Europe/Paris", // IANA timezone
  "offset": -120, // offset from UTC in minutes
  "time": 1712238688600, // unix timestamp in milliseconds
  "unix": 1712238688, // unix timestamp in seconds
  "ISO": "2024-04-04T13:51:28.600Z", // ISO8601
  "RFC2822": "Thu, 04 Apr 2024 13:51:28 GMT", // RFC2822
  "locale": "Donnerstag, 4. April 2024 um 15:51:28 Mitteleuropäische Sommerzeit", // localized time
  "location": {
    "latitude": 53.5544, // latitude
    "longitude": 9.9946, // longitude
    "country": "DE", // ISO 3166-1 alpha-2 country code
    "countryRegion": "HH", // ISO 3166-2 alpha-2 country code
    "city": "Hamburg", // city
    "flag": "🇩🇪", // flag emoji
  },
}

POST https://time.ptr.red/token/sign

Get a signed date token that can be used to verify the authenticity of the time the token was created in the future.

Request body:

{
  "id": "string", // unique identifier
}

Response body:

{
  "token": "ptr::1712239399::cf90e3f8b1290cfb8ff1b1d4127c887582bdf37071f3f39f45748a8e81d6386239b6322e15b2c8e5d4adf99a851bce15d5ba0d5963be388ab6d3cc6bae8b9db0", // "id::unix_time::signature"
}

POST https://time.ptr.red/token/validate

Validate a signed date token.

Request body:

{
  "token": "ptr::1712239399::cf90e3f8b1290cfb8ff1b1d4127c887582bdf37071f3f39f45748a8e81d6386239b6322e15b2c8e5d4adf99a851bce15d5ba0d5963be388ab6d3cc6bae8b9db0", // signed date token
}

Response body:

{
  "valid": true, // valid token
  "id": "ptr", // unique identifier
  "time": 1712239399, // unix timestamp in seconds
}

time's People

Contributors

peterfritz avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.