jaguar_otp 0.1.0

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • 31

jaguar_otp

TOTP utilities for Dart and Jaguar.dart

Usage

Generate secret

generateSecret method on Totp generates a Base32 encoded secret for use with TOTP.

  // Generate secret for an account
  final String secret = Totp.generateSecret();
  print('secret');

Create TOTP Uri

makeUri method on Totp creates TOTP Uri from individual components.

  // Create TOTP Uri
  String uri = Totp.makeUri('teja', 'tejainece@gmail.com', secret);
  print(uri);

Generate code

  // Generate for present time
  print(Totp.generateCode(secret));

Generate Qr code for TOTP Uri

  // Create TOTP Uri Qr code
  final qr = new Qr(uri);
  await qr.save('qr.png');

Changelog

0.0.1

  • Initial version, created by Stagehand

example/jaguar_otp_example.dart

// Copyright (c) 2017, teja. All rights reserved. Use of this source code
// is governed by a BSD-style license that can be found in the LICENSE file.

import 'package:jaguar_otp/jaguar_otp.dart';
import 'package:jaguar_otp/src/qr.dart';

main() async {
  // Generate secret for an account
  final String secret = Totp.generateSecret();
  print('secret');

  // Create TOTP Uri
  final String uri = Totp.makeUri('teja', 'tejainece@gmail.com', secret);
  print(uri);

  // Create TOTP Uri Qr code
  final qr = new Qr(uri);
  await qr.save('qr.png');

  // Generate for present time
  print(Totp.generateCode(secret));
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  jaguar_otp: ^0.1.0

2. Install it

You can install packages from the command line:

with pub:


$ pub get

Alternatively, your editor might support pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:jaguar_otp/jaguar_otp.dart';
  
Version Uploaded Documentation Archive
0.1.0 Jul 18, 2017 Go to the documentation of jaguar_otp 0.1.0 Download jaguar_otp 0.1.0 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
62
Health:
Code health derived from static analysis. [more]
0
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
0
Overall:
Weighted score of the above. [more]
31
Learn more about scoring.

The package version is not analyzed, because it does not support Dart 2. Until this is resolved, the package will receive a health and maintenance score of 0.

Issues and suggestions

Support Dart 2 in pubspec.yaml.

The SDK constraint in pubspec.yaml doesn't allow the Dart 2.0.0 release. For information about upgrading it to be Dart 2 compatible, please see https://www.dartlang.org/dart-2#migration.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.20.1 <2.0.0