diff --git a/README.md b/README.md index bad08f8..3a53953 100644 --- a/README.md +++ b/README.md @@ -107,7 +107,7 @@ let b32_secret = jsotp.Base32.random_gen(); ### Develop -* Clone depo and install dependencies +* Clone repo and install dependencies ```shell git clone git@github.com:LanceGin/jsotp.git diff --git a/src/hotp.js b/src/hotp.js index fea844b..0e18e79 100644 --- a/src/hotp.js +++ b/src/hotp.js @@ -17,7 +17,7 @@ export class HOTP extends OTP { * * @example * ```javascript - * let hotp = jsotp.HOTP.gen('BASE32_ENCODED_SECRET'); + * let hotp = jsotp.HOTP('BASE32_ENCODED_SECRET'); * hotp.at(0); // => 432143 * ``` */ @@ -40,7 +40,7 @@ export class HOTP extends OTP { * * @example * ```javascript - * let hotp = jsotp.HOTP.gen('BASE32_ENCODED_SECRET'); + * let hotp = jsotp.HOTP('BASE32_ENCODED_SECRET'); * hotp.at(0); // => 432143 * hotp.verify(432143, 0); // => true * hotp.verify(432143, 1); // => false diff --git a/src/nibbler/nibbler.js b/src/nibbler/nibbler.js index c8611a3..862f100 100644 --- a/src/nibbler/nibbler.js +++ b/src/nibbler/nibbler.js @@ -3,75 +3,6 @@ Adapted for Node.js by Matt Robenolt Reference: http://www.tumuski.com/2010/04/nibbler/ */ -/** - * Node.js example: - * - * var nibbler = require('nibbler'); - * - * nibbler.b32encode('Hello, World!'); // returns JBSWY3DPFQQFO33SNRSCC=====' - * nibbler.b32decode('JBSWY3DPFQQFO33SNRSCC====='); // returns 'Hello, World!' - * nibbler.b64encode('Hello, World!'); // returns 'SGVsbG8sIFdvcmxkIQ==' - * nibbler.b64decode('SGVsbG8sIFdvcmxkIQ=='); // returns 'Hello, World!' - */ - -/* -Copyright (c) 2010 Thomas Peri -http://www.tumuski.com/ -Permission is hereby granted, free of charge, to any person obtaining a -copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: -The above copyright notice and this permission notice shall be included -in all copies or substantial portions of the Software. -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -*/ - -/*jslint white: true, browser: true, onevar: true, undef: true, nomen: true, - eqeqeq: true, plusplus: true, regexp: true, newcap: true, immed: true */ -// (good parts minus bitwise and strict, plus white.) - -/** - * Nibbler - Multi-Base Encoder - * - * version 2010-04-07 - * - * Options: - * dataBits: The number of bits in each character of unencoded data. - * codeBits: The number of bits in each character of encoded data. - * keyString: The characters that correspond to each value when encoded. - * pad (optional): The character to pad the end of encoded output. - * arrayData (optional): If truthy, unencoded data is an array instead of a string. - * - * Example: - * - * var base64_8bit = new Nibbler({ - * dataBits: 8, - * codeBits: 6, - * keyString: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/', - * pad: '=' - * }); - * base64_8bit.encode("Hello, World!"); // returns "SGVsbG8sIFdvcmxkIQ==" - * base64_8bit.decode("SGVsbG8sIFdvcmxkIQ=="); // returns "Hello, World!" - * - * var base64_7bit = new Nibbler({ - * dataBits: 7, - * codeBits: 6, - * keyString: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/', - * pad: '=' - * }); - * base64_7bit.encode("Hello, World!"); // returns "kZdmzesQV9/LZkQg==" - * base64_7bit.decode("kZdmzesQV9/LZkQg=="); // returns "Hello, World!" - * - */ var Nibbler = function (options) { var construct, diff --git a/src/totp.js b/src/totp.js index eb32d03..fbe8617 100644 --- a/src/totp.js +++ b/src/totp.js @@ -30,7 +30,7 @@ export class TOTP extends OTP { * * @example * ```javascript - * let totp = jsotp.TOTP.gen('BASE32_ENCODED_SECRET'); + * let totp = jsotp.TOTP('BASE32_ENCODED_SECRET'); * totp.now(); // => 432143 * ``` */ @@ -53,7 +53,7 @@ export class TOTP extends OTP { * * @example * ```javascript - * let totp = jsotp.TOTP.gen('BASE32_ENCODED_SECRET'); + * let totp = jsotp.TOTP('BASE32_ENCODED_SECRET'); * totp.now(); // => 432143 * // Verify for current time * totp.verify(432143); // => true