talcotp 0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +1 -0
- data/bin/talcotp +6 -0
- data/lib/talcotp.rb +31 -0
- data/talcotp.gemspec +16 -0
- metadata +77 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: f14bba7a953545aa936b65d6a46b5b89c00ec395
|
4
|
+
data.tar.gz: 4c43da1bc7cb21b9b7008031b8cc02af76b58fcd
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 006e68b2c59c527c1c140a94a8836d167d11cf35ce7eaf629c0a657390f4c9b3987d6478583046d4483d0ebf48ad05f3043392c3da27470f37c9175888405a4e
|
7
|
+
data.tar.gz: 6216e16c13bff9eecff9cc4c1f9724fce9787fc61adb844620572300686ae05f77d722b9a816c0ac8589478e521974f3990e15fc07298fc71058999457694049
|
data/.gitignore
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
*.gem
|
data/bin/talcotp
ADDED
data/lib/talcotp.rb
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
require "rotp"
|
2
|
+
require "json"
|
3
|
+
|
4
|
+
class TalcOTP
|
5
|
+
def initialize file
|
6
|
+
file = File.file?(file) ? File.read(file) : ''
|
7
|
+
|
8
|
+
begin
|
9
|
+
@accounts = JSON.parse(file)
|
10
|
+
rescue JSON::ParserError
|
11
|
+
@accounts = {}
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def codes
|
16
|
+
output = ''
|
17
|
+
@accounts.each do |account|
|
18
|
+
account_settings = {
|
19
|
+
interval: account['period'],
|
20
|
+
digits: account['digits'],
|
21
|
+
digest: account['algorithm']
|
22
|
+
}
|
23
|
+
auth_code = ROTP::TOTP.new(account['secret'], account_settings).now
|
24
|
+
|
25
|
+
output += "#{account['label']}: #{auth_code}\n"
|
26
|
+
end
|
27
|
+
|
28
|
+
output
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
data/talcotp.gemspec
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
Gem::Specification.new do |s|
|
2
|
+
s.name = "talcotp"
|
3
|
+
s.version = 0.1
|
4
|
+
s.license = "MIT"
|
5
|
+
s.authors = ["Keeyan Nejad"]
|
6
|
+
s.email = ["keeyan@keeyan.xyz"]
|
7
|
+
s.homepage = "http://github.com/knejad/talcotp"
|
8
|
+
s.summary = %q{TalcOTP is an otp password generator}
|
9
|
+
|
10
|
+
s.files = `git ls-files`.split("\n")
|
11
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
12
|
+
s.require_paths = ["lib"]
|
13
|
+
|
14
|
+
s.add_development_dependency 'rake', '~> 10.5'
|
15
|
+
s.add_development_dependency 'rspec', '~> 3.5'
|
16
|
+
end
|
metadata
ADDED
@@ -0,0 +1,77 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: talcotp
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: '0.1'
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Keeyan Nejad
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-06-17 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rake
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '10.5'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '10.5'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rspec
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '3.5'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '3.5'
|
41
|
+
description:
|
42
|
+
email:
|
43
|
+
- keeyan@keeyan.xyz
|
44
|
+
executables:
|
45
|
+
- talcotp
|
46
|
+
extensions: []
|
47
|
+
extra_rdoc_files: []
|
48
|
+
files:
|
49
|
+
- ".gitignore"
|
50
|
+
- bin/talcotp
|
51
|
+
- lib/talcotp.rb
|
52
|
+
- talcotp.gemspec
|
53
|
+
homepage: http://github.com/knejad/talcotp
|
54
|
+
licenses:
|
55
|
+
- MIT
|
56
|
+
metadata: {}
|
57
|
+
post_install_message:
|
58
|
+
rdoc_options: []
|
59
|
+
require_paths:
|
60
|
+
- lib
|
61
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
62
|
+
requirements:
|
63
|
+
- - ">="
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: '0'
|
66
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
67
|
+
requirements:
|
68
|
+
- - ">="
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: '0'
|
71
|
+
requirements: []
|
72
|
+
rubyforge_project:
|
73
|
+
rubygems_version: 2.6.8
|
74
|
+
signing_key:
|
75
|
+
specification_version: 4
|
76
|
+
summary: TalcOTP is an otp password generator
|
77
|
+
test_files: []
|