Coder Social home page Coder Social logo

renatoliveira / time-based-one-time-password-algorithm-in-apex Goto Github PK

View Code? Open in Web Editor NEW
5.0 4.0 0.0 17 KB

Time-Based One-Time Password Algorithm in Apex

License: MIT License

Apex 100.00%
apex salesforce totp-generator totp proof-of-concept rfc-6238

time-based-one-time-password-algorithm-in-apex's Introduction

Apex Time-Based One-Time Password Algorithm

Based on RFC 6238.

Key URI based on Google Authenticator's.

Usage

When using the provided anonymous Apex sample in the scripts folder, the result would be something like this:

17:00:35.40 (52589659)|USER_DEBUG|[13]|DEBUG|otpauth://totp/TOTPInc:[email protected]?secret=JBSWY3DPEB3W64TMMQQQ====&issuer=TOTPInc&algorithm=SHA1&period=30&digits=6
17:00:35.40 (53790153)|USER_DEBUG|[8]|DEBUG|Generating for step 328aca1
17:00:35.40 (56052233)|USER_DEBUG|[8]|DEBUG|Generating for step 328aca2
17:00:35.40 (57275182)|USER_DEBUG|[15]|DEBUG|(596192, 064211)

The first line contains the Key URI used by authenticator apps such as Authy and 1Password. It is literally the QR Code the user scans when adding a new 2FA method to their account.

The valid code for the current time period would be the first value of 596192. The second value, 064211, is the valid number for the next 30 seconds. This is due the fact that there can be synchronization issues between the client and the server.

Any string can be used as a secret (key) for the algorithm.

time-based-one-time-password-algorithm-in-apex's People

Contributors

darlingtoncbcloud avatar renatoliveira avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

time-based-one-time-password-algorithm-in-apex's Issues

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.