-
Notifications
You must be signed in to change notification settings - Fork 137
Upgrading to v6
Gerald Yeo edited this page Aug 26, 2017
·
5 revisions
Previously, all files are compiled via babel and directly exported.
As such, we have issues such as needing to do var hotp = require('otplib/hotp').default
Following a switch to rollup
, all exported modules are by default cjs
format.
In v6
, entry points to the modules have been collated and consolidated.
As such there are now only 6 main sub-packages and other standalone compiled packages.
i.e.
// Contains all functional interfaces for both HOTP and TOTP
import core from 'otplib/core';
// Contains HOTP Class Instance and HOTP Class
import hotp from 'otplib/hotp';
// Contains TOTP Class Instance and TOTP Class
import totp from 'otplib/totp';
// Contains Authenticator Class Instance and Authenticator Class
// As well as Authenticator functional interfaces as utils
import authenticator from 'otplib/authenticator';
// All utility methods used by the above classes
import utils from 'otplib/utils';
// All libraries
import otplib from 'otplib';
// Standalone browser standalone.
import browser from 'otplib/browser';