Skip to content

Commit

Permalink
Merge branch 'release/1.2.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
BrunoMiguens committed Jul 18, 2019
2 parents 22d5a95 + d2cd924 commit 5fa52f7
Show file tree
Hide file tree
Showing 56 changed files with 1,199 additions and 315 deletions.
14 changes: 14 additions & 0 deletions CHANGELOG.md
Expand Up @@ -22,3 +22,17 @@
* Refactor some components
* Minor code style enhancements
* Increase options export option for generate url function

## [1.2.0]

* Minor enhancements
* Add new counter property inside hotp object
* Update documentation according to dart guidelines
* Add support for SHA256 algorithm (available: SHA1 and SHA256)
* Add extra url proprties to otp object in order to export:
* Digits
* Issuer
* Period
* Account
* Counter
* Algorithm
7 changes: 5 additions & 2 deletions Makefile
Expand Up @@ -7,12 +7,15 @@ build: lib/*dart test/*dart deps
deps: pubspec.yaml
pub get

reformatting:
format:
dartfmt -w lib/ test/

build-local: reformatting build
build-local: format build check-publish
genhtml -o coverage coverage/lcov.info
open coverage/index.html

check-publish:
pub publish -n

publish:
pub publish
5 changes: 3 additions & 2 deletions README.md
@@ -1,5 +1,6 @@
# dart_otp

[![pub package](https://img.shields.io/pub/v/dart_otp.svg)](https://pub.dev/packages/dart_otp)
[![Build Status](https://travis-ci.org/BrunoMiguens/dart_otp.svg?branch=master)](https://travis-ci.org/BrunoMiguens/dart_otp)
[![Coverage Status](https://coveralls.io/repos/github/BrunoMiguens/dart_otp/badge.svg?branch=master)](https://coveralls.io/github/BrunoMiguens/dart_otp?branch=master)

Expand All @@ -21,7 +22,7 @@ Add `dart_otp` as a dependency in your `pubspec.yaml` file.

```yaml
dependencies:
dart_otp: ^1.1.0
dart_otp: ^1.2.0
```

### Example
Expand Down Expand Up @@ -60,7 +61,7 @@ void main() {
HOTP hotp = HOTP(secret: "J22U6B3WIWRRBTAV");
/// initialization for custom digit value
HOTP hotp = HOTP(secret: "J22U6B3WIWRRBTAV", digits: 8);
HOTP hotp = HOTP(secret: "J22U6B3WIWRRBTAV", counter: 50, digits: 8);
hotp.at(counter: 0); /// => 432143
hotp.at(counter: 1); /// => 231434
Expand Down
2 changes: 1 addition & 1 deletion doc/api/__404error.html
Expand Up @@ -73,7 +73,7 @@ <h1>404: Something's gone wrong :-(</h1>

<footer>
<span class="no-break">
dart_otp 1.1.0
dart_otp 1.2.0
</span>


Expand Down
52 changes: 40 additions & 12 deletions doc/api/dart_otp/HOTP-class.html
Expand Up @@ -67,19 +67,20 @@ <h5>dart_otp library</h5>
<div id="dartdoc-main-content" class="col-xs-12 col-sm-9 col-md-8 main-content">
<div><h1><span class="kind-class">HOTP</span> class </h1></div>

<section class="desc markdown">
<p>HOTP class will generate the OTP (One Time Password) object with given counter.</p>
</section>


<section class="summary offset-anchor" id="constructors">
<h2>Constructors</h2>

<dl class="constructor-summary-list">
<dt id="HOTP" class="callable">
<span class="name"><a href="dart_otp/HOTP/HOTP.html">HOTP</a></span><span class="signature">({<span class="parameter" id="-param-secret"><span class="type-annotation">String</span> <span class="parameter-name">secret</span>, </span> <span class="parameter" id="-param-digits"><span class="type-annotation">int</span> <span class="parameter-name">digits</span>: <span class="default-value">6</span></span> })</span>
<span class="name"><a href="dart_otp/HOTP/HOTP.html">HOTP</a></span><span class="signature">({<span class="parameter" id="-param-secret"><span class="type-annotation">String</span> <span class="parameter-name">secret</span>, </span> <span class="parameter" id="-param-counter"><span class="type-annotation">int</span> <span class="parameter-name">counter</span>: <span class="default-value">0</span>, </span> <span class="parameter" id="-param-digits"><span class="type-annotation">int</span> <span class="parameter-name">digits</span>: <span class="default-value">6</span>, </span> <span class="parameter" id="-param-algorithm"><span class="type-annotation">OTPAlgorithm</span> <span class="parameter-name">algorithm</span>: <span class="default-value">OTPAlgorithm.SHA1</span></span> })</span>
</dt>
<dd>
@param {secret}
@type {String}
@desc random base32-encoded key to generate OTP. <a href="dart_otp/HOTP/HOTP.html">[...]</a>
This constructor will create an HOTP instance. <a href="dart_otp/HOTP/HOTP.html">[...]</a>
</dd>
</dl>
</section>
Expand All @@ -88,20 +89,44 @@ <h2>Constructors</h2>
<h2>Properties</h2>

<dl class="properties">
<dt id="counter" class="property">
<span class="name"><a href="dart_otp/HOTP/counter.html">counter</a></span>
<span class="signature">&#8596; int</span>
</dt>
<dd>
The counter value for one-time password.
<div class="features">read / write</div>
</dd>
<dt id="extraUrlProperties" class="property">
<span class="name"><a href="dart_otp/HOTP/extraUrlProperties.html">extraUrlProperties</a></span>
<span class="signature">&#8594; Map<span class="signature">&lt;<wbr><span class="type-parameter">String</span>, <span class="type-parameter">dynamic</span>&gt;</span></span>
</dt>
<dd>
To access custom properties when generating the url.
<div class="features">read-only</div>
</dd>
<dt id="type" class="property">
<span class="name"><a href="dart_otp/HOTP/type.html">type</a></span>
<span class="signature">&#8594; OTPType</span>
</dt>
<dd>

The type of the token.
<div class="features">read-only</div>
</dd>
<dt id="algorithm" class="property inherited">
<span class="name"><a href="dart_otp/HOTP/algorithm.html">algorithm</a></span>
<span class="signature">&#8596; OTPAlgorithm</span>
</dt>
<dd class="inherited">
The crypto algorithm used on HMAC encoding.
<div class="features">read / write, inherited</div>
</dd>
<dt id="digits" class="property inherited">
<span class="name"><a href="dart_otp/HOTP/digits.html">digits</a></span>
<span class="signature">&#8596; int</span>
</dt>
<dd class="inherited">

The length of the one-time password, between 6 and 8.
<div class="features">read / write, inherited</div>
</dd>
<dt id="hashCode" class="property inherited">
Expand All @@ -125,7 +150,7 @@ <h2>Properties</h2>
<span class="signature">&#8596; String</span>
</dt>
<dd class="inherited">

The Base32 secret key used to generate the one-time password.
<div class="features">read / write, inherited</div>
</dd>
</dl>
Expand All @@ -140,7 +165,7 @@ <h2>Methods</h2>
</span>
</dt>
<dd>
Generate the OTP with the given count <a href="dart_otp/HOTP/at.html">[...]</a>
Generate the HOTP value with the given count <a href="dart_otp/HOTP/at.html">[...]</a>

</dd>
<dt id="verify" class="callable">
Expand All @@ -149,11 +174,11 @@ <h2>Methods</h2>
</span>
</dt>
<dd>
Verifies the OTP passed in against the current time OTP. <a href="dart_otp/HOTP/verify.html">[...]</a>
Verifies the HOTP value passed in against the a given counter. <a href="dart_otp/HOTP/verify.html">[...]</a>

</dd>
<dt id="generateOTP" class="callable inherited">
<span class="name"><a href="dart_otp/HOTP/generateOTP.html">generateOTP</a></span><span class="signature">(<wbr>{<span class="parameter" id="generateOTP-param-input"><span class="type-annotation">int</span> <span class="parameter-name">input</span></span> })
<span class="name"><a href="dart_otp/HOTP/generateOTP.html">generateOTP</a></span><span class="signature">(<wbr>{<span class="parameter" id="generateOTP-param-input"><span class="type-annotation">int</span> <span class="parameter-name">input</span>, </span> <span class="parameter" id="generateOTP-param-algorithm"><span class="type-annotation">OTPAlgorithm</span> <span class="parameter-name">algorithm</span>: <span class="default-value">OTPAlgorithm.SHA1</span></span> })
<span class="returntype parameter">&#8594; String</span>
</span>
</dt>
Expand All @@ -169,7 +194,7 @@ <h2>Methods</h2>
</span>
</dt>
<dd class="inherited">
Generate a url with TOTP instance. <a href="dart_otp/HOTP/generateUrl.html">[...]</a>
Generate a url with OTP instance. <a href="dart_otp/HOTP/generateUrl.html">[...]</a>
<div class="features">inherited</div>
</dd>
<dt id="noSuchMethod" class="callable inherited">
Expand Down Expand Up @@ -221,7 +246,10 @@ <h2>Operators</h2>
<li class="section-title">
<a href="dart_otp/HOTP-class.html#instance-properties">Properties</a>
</li>
<li><a href="dart_otp/HOTP/counter.html">counter</a></li>
<li><a href="dart_otp/HOTP/extraUrlProperties.html">extraUrlProperties</a></li>
<li><a href="dart_otp/HOTP/type.html">type</a></li>
<li class="inherited"><a href="dart_otp/HOTP/algorithm.html">algorithm</a></li>
<li class="inherited"><a href="dart_otp/HOTP/digits.html">digits</a></li>
<li class="inherited"><a href="dart_otp/HOTP/hashCode.html">hashCode</a></li>
<li class="inherited"><a href="dart_otp/HOTP/runtimeType.html">runtimeType</a></li>
Expand All @@ -247,7 +275,7 @@ <h2>Operators</h2>

<footer>
<span class="no-break">
dart_otp 1.1.0
dart_otp 1.2.0
</span>


Expand Down
28 changes: 17 additions & 11 deletions doc/api/dart_otp/HOTP/HOTP.html
Expand Up @@ -59,7 +59,10 @@ <h5>HOTP class</h5>
<li class="section-title">
<a href="dart_otp/HOTP-class.html#instance-properties">Properties</a>
</li>
<li><a href="dart_otp/HOTP/counter.html">counter</a></li>
<li><a href="dart_otp/HOTP/extraUrlProperties.html">extraUrlProperties</a></li>
<li><a href="dart_otp/HOTP/type.html">type</a></li>
<li class="inherited"><a href="dart_otp/HOTP/algorithm.html">algorithm</a></li>
<li class="inherited"><a href="dart_otp/HOTP/digits.html">digits</a></li>
<li class="inherited"><a href="dart_otp/HOTP/hashCode.html">hashCode</a></li>
<li class="inherited"><a href="dart_otp/HOTP/runtimeType.html">runtimeType</a></li>
Expand All @@ -86,23 +89,26 @@ <h5>HOTP class</h5>

<section class="multi-line-signature">

<span class="name ">HOTP</span>(<wbr>{<span class="parameter" id="-param-secret"><span class="type-annotation">String</span> <span class="parameter-name">secret</span>, </span> <span class="parameter" id="-param-digits"><span class="type-annotation">int</span> <span class="parameter-name">digits</span>: <span class="default-value">6</span></span> })
<span class="name ">HOTP</span>(<wbr>{<span class="parameter" id="-param-secret"><span class="type-annotation">String</span> <span class="parameter-name">secret</span>, </span> <span class="parameter" id="-param-counter"><span class="type-annotation">int</span> <span class="parameter-name">counter</span>: <span class="default-value">0</span>, </span> <span class="parameter" id="-param-digits"><span class="type-annotation">int</span> <span class="parameter-name">digits</span>: <span class="default-value">6</span>, </span> <span class="parameter" id="-param-algorithm"><span class="type-annotation">OTPAlgorithm</span> <span class="parameter-name">algorithm</span>: <span class="default-value">OTPAlgorithm.SHA1</span></span> })
</section>

<section class="desc markdown">
<p>@param {secret}
@type {String}
@desc random base32-encoded key to generate OTP.</p>
<p>@param {digits}
@type {int}
@desc the length of the one-time password.
This defaults to 6.</p>
<p>@return {HOTP}</p>
<p>This constructor will create an HOTP instance.</p>
<p>All parameters are mandatory however <code>counter</code>,
<code>digits</code> and <code>algorithm</code> have a default values, so can be ignored.</p>
<p>Will throw an exception if the line above isn't satisfied.</p>
</section>

<section class="summary source-code" id="source">
<h2><span>Implementation</span></h2>
<pre class="language-dart"><code class="language-dart">HOTP({String secret, int digits = 6}) : super(secret: secret, digits: digits);</code></pre>
<pre class="language-dart"><code class="language-dart">HOTP(
{String secret,
int counter = 0,
int digits = 6,
OTPAlgorithm algorithm = OTPAlgorithm.SHA1})
: super(secret: secret, digits: digits, algorithm: algorithm) {
this.counter = counter;
}</code></pre>
</section>

</div> <!-- /.main-content -->
Expand All @@ -114,7 +120,7 @@ <h2><span>Implementation</span></h2>

<footer>
<span class="no-break">
dart_otp 1.1.0
dart_otp 1.2.0
</span>


Expand Down
129 changes: 129 additions & 0 deletions doc/api/dart_otp/HOTP/algorithm.html
@@ -0,0 +1,129 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, height=device-height, initial-scale=1, user-scalable=no">
<meta name="description" content="API docs for the algorithm property from the HOTP class, for the Dart programming language.">
<title>algorithm property - HOTP class - dart_otp library - Dart API</title>
<!-- required because all the links are pseudo-absolute -->
<base href="../..">

<link href="https://fonts.googleapis.com/css?family=Source+Code+Pro:500,400i,400,300|Source+Sans+Pro:400,300,700" rel="stylesheet">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<link rel="stylesheet" href="static-assets/github.css">
<link rel="stylesheet" href="static-assets/styles.css">
<link rel="icon" href="static-assets/favicon.png">

</head>

<body>

<div id="overlay-under-drawer"></div>

<header id="title">
<button id="sidenav-left-toggle" type="button">&nbsp;</button>
<ol class="breadcrumbs gt-separated dark hidden-xs">
<li><a href="index.html">dart_otp</a></li>
<li><a href="dart_otp/dart_otp-library.html">dart_otp</a></li>
<li><a href="dart_otp/HOTP-class.html">HOTP</a></li>
<li class="self-crumb">algorithm property</li>
</ol>
<div class="self-name">algorithm</div>
<form class="search navbar-right" role="search">
<input type="text" id="search-box" autocomplete="off" disabled class="form-control typeahead" placeholder="Loading search...">
</form>
</header>

<main>

<div id="dartdoc-sidebar-left" class="col-xs-6 col-sm-3 col-md-2 sidebar sidebar-offcanvas-left">
<header id="header-search-sidebar" class="hidden-l">
<form class="search-sidebar" role="search">
<input type="text" id="search-sidebar" autocomplete="off" disabled class="form-control typeahead" placeholder="Loading search...">
</form>
</header>

<ol class="breadcrumbs gt-separated dark hidden-l" id="sidebar-nav">
<li><a href="index.html">dart_otp</a></li>
<li><a href="dart_otp/dart_otp-library.html">dart_otp</a></li>
<li><a href="dart_otp/HOTP-class.html">HOTP</a></li>
<li class="self-crumb">algorithm property</li>
</ol>

<h5>HOTP class</h5>
<ol>
<li class="section-title"><a href="dart_otp/HOTP-class.html#constructors">Constructors</a></li>
<li><a href="dart_otp/HOTP/HOTP.html">HOTP</a></li>

<li class="section-title">
<a href="dart_otp/HOTP-class.html#instance-properties">Properties</a>
</li>
<li><a href="dart_otp/HOTP/counter.html">counter</a></li>
<li><a href="dart_otp/HOTP/extraUrlProperties.html">extraUrlProperties</a></li>
<li><a href="dart_otp/HOTP/type.html">type</a></li>
<li class="inherited"><a href="dart_otp/HOTP/algorithm.html">algorithm</a></li>
<li class="inherited"><a href="dart_otp/HOTP/digits.html">digits</a></li>
<li class="inherited"><a href="dart_otp/HOTP/hashCode.html">hashCode</a></li>
<li class="inherited"><a href="dart_otp/HOTP/runtimeType.html">runtimeType</a></li>
<li class="inherited"><a href="dart_otp/HOTP/secret.html">secret</a></li>

<li class="section-title"><a href="dart_otp/HOTP-class.html#instance-methods">Methods</a></li>
<li><a href="dart_otp/HOTP/at.html">at</a></li>
<li><a href="dart_otp/HOTP/verify.html">verify</a></li>
<li class="inherited"><a href="dart_otp/HOTP/generateOTP.html">generateOTP</a></li>
<li class="inherited"><a href="dart_otp/HOTP/generateUrl.html">generateUrl</a></li>
<li class="inherited"><a href="dart_otp/HOTP/noSuchMethod.html">noSuchMethod</a></li>
<li class="inherited"><a href="dart_otp/HOTP/toString.html">toString</a></li>

<li class="section-title inherited"><a href="dart_otp/HOTP-class.html#operators">Operators</a></li>
<li class="inherited"><a href="dart_otp/HOTP/operator_equals.html">operator ==</a></li>



</ol>
</div><!--/.sidebar-offcanvas-->

<div id="dartdoc-main-content" class="col-xs-12 col-sm-9 col-md-8 main-content">
<div><h1><span class="kind-property">algorithm</span> property</h1></div>

<section class="multi-line-signature">
<span class="returntype">OTPAlgorithm</span>
<span class="name ">algorithm</span>
<div class="features">read / write, inherited</div>
</section>
<section class="desc markdown">
<p>The crypto algorithm used on HMAC encoding.</p>
</section>
<section class="summary source-code" id="source">
<h2><span>Implementation</span></h2>
<pre class="language-dart"><code class="language-dart">OTPAlgorithm algorithm

</code></pre>
</section>

</div> <!-- /.main-content -->

<div id="dartdoc-sidebar-right" class="col-xs-6 col-sm-6 col-md-2 sidebar sidebar-offcanvas-right">
</div><!--/.sidebar-offcanvas-->

</main>

<footer>
<span class="no-break">
dart_otp 1.2.0
</span>


</footer>

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="static-assets/typeahead.bundle.min.js"></script>
<script src="static-assets/highlight.pack.js"></script>
<script src="static-assets/URI.js"></script>
<script src="static-assets/script.js"></script>


</body>

</html>

0 comments on commit 5fa52f7

Please sign in to comment.