Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
LeKristapino committed Mar 3, 2020
0 parents commit d8d12f2
Show file tree
Hide file tree
Showing 29 changed files with 845 additions and 0 deletions.
104 changes: 104 additions & 0 deletions .byebug_history
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
c
response.body
c
request_params
api_url
c
api_url
request_params
request_arams
c
e.http_code
c
e.http_code
c
e.http_code
e.methods
e.status_code
e.code
e.status
e
c
JSON.parse(response.body)
response.body
response
c
request
c
request_params
c
request_params
api_url
c
s.chars.last(4).join
s = "123456789"
s = "123456789
s.chars.last(4).join
s.chars.last(4).join()
s.chars.last(4)
s.last(4)
s.length
s.lengh
s.len
s[-3..-1]
s[-2..-1]
s[-4..-1]
s[-4..[-1]]
s[-4]
s = (int % 10000).to_s
data
(int % 10000).to_s
(int % 10000).to_s[-4..-1]
n
rightmost_bytes.unpack('n*')[0]
c
rightmost_bytes.unpack('n*')[0]
digestrightmost_bytes.unpack('n*')[0]
rightmost_bytes
c
rightmost_bytes
digest
c
digest
rightmost_bytes
c
data
digest
rightmost_bytes
c
rightmost_bytes
c
cc
c
rightmost_bytes
digest
int
c
rightmost_bytes
digest
int
c
"0" * pad
pad
pad * "0"
paddable_string
c
rightmost_bytes
rightmost_bytes.unpack('n*')[1]
rightmost_bytes.unpack('n*')
rightmost_bytes.unpack('s*')
rightmost_bytes.unpack('S')
rightmost_bytes = digest[-2..-1]
rightmost_bytes
rightmost_bytes.unpack('N*')
rightmost_bytes.unpack('S*')
rightmost_bytes.unpack('s*')
rightmost_bytes.unpack('s')
rightmost_bytes.unpack('S')
rightmost_bytes.unpack('n*')
digest[-2..-1]
digest[-2...-1]
AuthenticationHash.new(data).calculate_digest
rightmost_bytes.unpack('n*')
rightmost_bytes.unpack('n*')[1]
rightmost_bytes
11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/.bundle/
/.yardoc
/_yardoc/
/coverage/
/doc/
/pkg/
/spec/reports/
/tmp/

# rspec failure tracking
.rspec_status
3 changes: 3 additions & 0 deletions .rspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
--format documentation
--color
--require spec_helper
7 changes: 7 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
sudo: false
language: ruby
cache: bundler
rvm:
- 2.6.0
before_install: gem install bundler -v 2.0.2
4 changes: 4 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
source "https://rubygems.org"

# Specify your gem's dependencies in smart_id.gemspec
gemspec
55 changes: 55 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
PATH
remote: .
specs:
smart_id (0.1.0)
rest-client (~> 2.0)

GEM
remote: https://rubygems.org/
specs:
byebug (11.1.1)
diff-lcs (1.3)
domain_name (0.5.20190701)
unf (>= 0.0.5, < 1.0.0)
http-accept (1.7.0)
http-cookie (1.0.3)
domain_name (~> 0.5)
mime-types (3.3.1)
mime-types-data (~> 3.2015)
mime-types-data (3.2019.1009)
netrc (0.11.0)
rake (10.5.0)
rest-client (2.1.0)
http-accept (>= 1.7.0, < 2.0)
http-cookie (>= 1.0.2, < 2.0)
mime-types (>= 1.16, < 4.0)
netrc (~> 0.8)
rspec (3.9.0)
rspec-core (~> 3.9.0)
rspec-expectations (~> 3.9.0)
rspec-mocks (~> 3.9.0)
rspec-core (3.9.1)
rspec-support (~> 3.9.1)
rspec-expectations (3.9.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.9.0)
rspec-mocks (3.9.1)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.9.0)
rspec-support (3.9.2)
unf (0.1.4)
unf_ext
unf_ext (0.0.7.6)

PLATFORMS
ruby

DEPENDENCIES
bundler (~> 2.0)
byebug
rake (~> 10.0)
rspec (~> 3.0)
smart_id!

BUNDLED WITH
2.0.2
21 changes: 21 additions & 0 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2020 lekristapino

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.
39 changes: 39 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# SmartId

Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/smart_id`. To experiment with that code, run `bin/console` for an interactive prompt.

TODO: Delete this and the text above, and describe your gem

## Installation

Add this line to your application's Gemfile:

```ruby
gem 'smart_id'
```

And then execute:

$ bundle

Or install it yourself as:

$ gem install smart_id

## Usage

TODO: Write usage instructions here

## Development

After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).

## Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/smart_id.

## License

The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
6 changes: 6 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
require "bundler/gem_tasks"
require "rspec/core/rake_task"

RSpec::Core::RakeTask.new(:spec)

task :default => :spec
14 changes: 14 additions & 0 deletions bin/console
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/usr/bin/env ruby

require "bundler/setup"
require "smart_id"

# You can add fixtures and/or initialization code here to make experimenting
# with your gem easier. You can also use a different console, if you like.

# (If you use this, don't forget to add pry to your Gemfile!)
# require "pry"
# Pry.start

require "irb"
IRB.start(__FILE__)
8 changes: 8 additions & 0 deletions bin/setup
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env bash
set -euo pipefail
IFS=$'\n\t'
set -vx

bundle install

# Do any other automated setup that you need to do here
61 changes: 61 additions & 0 deletions lib/smart_id.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
require "smart_id/version"
require "smart_id/utils/authentication_hash"
require "smart_id/utils/verification_code_calculator"
require "smart_id/api/response"
require "smart_id/api/confirmation_response"
require "smart_id/api/authentication/identity_number"
require "smart_id/api/authentication/document"
require "smart_id/api/authentication/confirmation_poller"

module SmartId
@@relying_party_uuid = nil
@@relying_party_name = nil
@@default_certificate_level = "QUALIFIED"
@@host_url = nil
@@smart_id_base_url = "https://sid.demo.sk.ee/smart-id-rp/v1/"
@@poller_timeout_seconds = 10

def self.configure(&block)
yield(self)
end

def self.relying_party_uuid=(value)
@@relying_party_uuid = value
end

def self.relying_party_uuid
@@relying_party_uuid
end

def self.relying_party_name=(value)
@@relying_party_name = value
end

def self.relying_party_name
@@relying_party_name
end

def self.default_certificate_level=(value)
@@default_certificate_level = value
end

def self.default_certificate_level
@@default_certificate_level
end

def self.smart_id_base_url=(value)
@@smart_id_base_url = value
end

def self.smart_id_base_url
@@smart_id_base_url
end

def self.poller_timeout_seconds=(value)
@@poller_timeout_seconds = value
end

def self.poller_timeout_seconds
@@poller_timeout_seconds
end
end
Loading

0 comments on commit d8d12f2

Please sign in to comment.