mobile_id 0.0.13 → 0.0.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -2
- data/README.md +4 -2
- data/lib/mobile_id/auth.rb +38 -34
- data/lib/mobile_id/cert.rb +45 -34
- data/lib/mobile_id/locales/lt.yml +10 -0
- data/lib/mobile_id/railtie.rb +8 -6
- data/lib/mobile_id.rb +4 -3
- metadata +44 -13
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: f6586590b52a7e282042dcc43d8de42c821d1d8b1ccfeb243ef4b9f75f2ac0ad
         | 
| 4 | 
            +
              data.tar.gz: ae6c05b4242a3beadf025c109f0912b5be3f99da2f8ad78c55ea0a58f5a66b0b
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 67a128c840d171f2fc0199c86fea6d2c8cedca2d2efba844649595a156fc6cd29f9b50a442b8273bd1a719f8f26fbc57e66b5aa66c01e5e1204795b89b5d93ad
         | 
| 7 | 
            +
              data.tar.gz: db6c5d6cfd37d16c8fa6c1e826614d0861d5827785183d9e93807ed5ebde7a9f63f1548d9ec1d5d427a0a6210082c53ffdcd85228462e645b0069386e58f7904
         | 
    
        data/CHANGELOG.md
    CHANGED
    
    | @@ -1,6 +1,11 @@ | |
| 1 | 
            +
            Release 0.0.14
         | 
| 2 | 
            +
            * Added LT locale with locale init update (thanks Mijora)
         | 
| 3 | 
            +
            * Init rubocop (thanks Thales Ribeiro)
         | 
| 4 | 
            +
             | 
| 1 5 | 
             
            Release 0.0.13
         | 
| 2 | 
            -
            *  | 
| 3 | 
            -
            * More  | 
| 6 | 
            +
            * Gems updated to latest
         | 
| 7 | 
            +
            * More test friendly init (thanks Juri Linkov)
         | 
| 8 | 
            +
            * More precise sert check (thanks Andri Möll)
         | 
| 4 9 |  | 
| 5 10 | 
             
            Release 0.0.12
         | 
| 6 11 | 
             
            * Supports session RUNNING state
         | 
    
        data/README.md
    CHANGED
    
    | @@ -114,10 +114,12 @@ After checking out the repo, run `bundle` to install dependencies. For testing c | |
| 114 114 | 
             
            * Priit Tark
         | 
| 115 115 | 
             
            * Andri Möll for pointing out user signature issue and cert date check
         | 
| 116 116 | 
             
            * Juri Linkov for pointing out unpack method issue and test friendly init
         | 
| 117 | 
            +
            * Thales Ribeiro for rubocop initial
         | 
| 118 | 
            +
            * Mijora for LT locale
         | 
| 117 119 |  | 
| 118 120 | 
             
            ## Contributing
         | 
| 119 121 |  | 
| 120 | 
            -
            Bug reports and pull requests are welcome on GitHub at https://github.com/ | 
| 122 | 
            +
            Bug reports and pull requests are welcome on GitHub at https://github.com/domify/mobile_id
         | 
| 121 123 |  | 
| 122 124 | 
             
            ## Roadmap
         | 
| 123 125 |  | 
| @@ -130,4 +132,4 @@ The gem is available as open source under the terms of the [MIT License](http:// | |
| 130 132 |  | 
| 131 133 | 
             
            ## Sponsors
         | 
| 132 134 |  | 
| 133 | 
            -
            Gem development and testing is sponsored by [ | 
| 135 | 
            +
            Gem development and testing is sponsored by [Domify](https://domify.io).
         | 
    
        data/lib/mobile_id/auth.rb
    CHANGED
    
    | @@ -2,12 +2,13 @@ | |
| 2 2 |  | 
| 3 3 | 
             
            module MobileId
         | 
| 4 4 | 
             
              class Auth
         | 
| 5 | 
            +
             | 
| 5 6 | 
             
                # API documentation https://github.com/SK-EID/MID
         | 
| 6 | 
            -
                LIVE_URL =  | 
| 7 | 
            -
                TEST_URL =  | 
| 7 | 
            +
                LIVE_URL = 'https://mid.sk.ee/mid-api'
         | 
| 8 | 
            +
                TEST_URL = 'https://tsp.demo.sk.ee/mid-api'
         | 
| 8 9 |  | 
| 9 | 
            -
                TEST_UUID  =  | 
| 10 | 
            -
                TEST_NAME  =  | 
| 10 | 
            +
                TEST_UUID  = '00000000-0000-0000-0000-000000000000'
         | 
| 11 | 
            +
                TEST_NAME  = 'DEMO'
         | 
| 11 12 |  | 
| 12 13 | 
             
                attr_accessor :url, :uuid, :name, :doc, :hash, :user_cert, :live
         | 
| 13 14 |  | 
| @@ -24,25 +25,25 @@ module MobileId | |
| 24 25 | 
             
                  self.hash = Digest::SHA256.digest(doc)
         | 
| 25 26 | 
             
                end
         | 
| 26 27 |  | 
| 27 | 
            -
                def authenticate!(phone_calling_code: nil,  | 
| 28 | 
            +
                def authenticate!(phone:, personal_code:, phone_calling_code: nil, language: nil, display_text: nil)
         | 
| 28 29 | 
             
                  phone_calling_code ||= '+372'
         | 
| 29 30 | 
             
                  full_phone = "#{phone_calling_code}#{phone}"
         | 
| 30 | 
            -
                  language ||= | 
| 31 | 
            +
                  language ||=
         | 
| 31 32 | 
             
                    case I18n.locale
         | 
| 32 33 | 
             
                    when :et
         | 
| 33 | 
            -
                      display_text ||= 'Autentimine' | 
| 34 | 
            +
                      display_text ||= 'Autentimine'
         | 
| 34 35 | 
             
                      'EST'
         | 
| 35 36 | 
             
                    when :ru
         | 
| 36 | 
            -
                      display_text ||= 'Аутентификация' | 
| 37 | 
            +
                      display_text ||= 'Аутентификация'
         | 
| 37 38 | 
             
                      'RUS'
         | 
| 38 39 | 
             
                    else
         | 
| 39 | 
            -
                      display_text ||= 'Authentication' | 
| 40 | 
            +
                      display_text ||= 'Authentication'
         | 
| 40 41 | 
             
                      'ENG'
         | 
| 41 42 | 
             
                    end
         | 
| 42 | 
            -
             | 
| 43 | 
            +
             | 
| 43 44 | 
             
                  options = {
         | 
| 44 45 | 
             
                    headers: {
         | 
| 45 | 
            -
                       | 
| 46 | 
            +
                      'Content-Type': 'application/json'
         | 
| 46 47 | 
             
                    },
         | 
| 47 48 | 
             
                    query: {},
         | 
| 48 49 | 
             
                    body: {
         | 
| @@ -52,20 +53,20 @@ module MobileId | |
| 52 53 | 
             
                      nationalIdentityNumber: personal_code.to_s.strip,
         | 
| 53 54 | 
             
                      hash: Base64.strict_encode64(hash),
         | 
| 54 55 | 
             
                      hashType: 'SHA256',
         | 
| 55 | 
            -
                      language | 
| 56 | 
            +
                      language:,
         | 
| 56 57 | 
             
                      displayText: display_text,
         | 
| 57 58 | 
             
                      displayTextFormat: 'GSM-7' # or "UCS-2”
         | 
| 58 59 | 
             
                    }.to_json
         | 
| 59 60 | 
             
                  }
         | 
| 60 61 |  | 
| 61 | 
            -
                  response = HTTParty.post(url | 
| 62 | 
            +
                  response = HTTParty.post("#{url}/authentication", options)
         | 
| 62 63 | 
             
                  raise Error, "#{I18n.t('mobile_id.some_error')} #{response}" unless response.code == 200
         | 
| 63 64 |  | 
| 64 65 | 
             
                  ActiveSupport::HashWithIndifferentAccess.new(
         | 
| 65 66 | 
             
                    session_id: response['sessionID'],
         | 
| 66 | 
            -
                    phone | 
| 67 | 
            -
                    phone_calling_code | 
| 68 | 
            -
                    doc: | 
| 67 | 
            +
                    phone:,
         | 
| 68 | 
            +
                    phone_calling_code:,
         | 
| 69 | 
            +
                    doc:
         | 
| 69 70 | 
             
                  )
         | 
| 70 71 | 
             
                end
         | 
| 71 72 |  | 
| @@ -73,9 +74,9 @@ module MobileId | |
| 73 74 | 
             
                  long_poll!(session_id: auth['session_id'], doc: auth['doc'])
         | 
| 74 75 |  | 
| 75 76 | 
             
                  ActiveSupport::HashWithIndifferentAccess.new(
         | 
| 76 | 
            -
                    personal_code | 
| 77 | 
            -
                    first_name | 
| 78 | 
            -
                    last_name | 
| 77 | 
            +
                    personal_code:,
         | 
| 78 | 
            +
                    first_name:,
         | 
| 79 | 
            +
                    last_name:,
         | 
| 79 80 | 
             
                    phone: auth['phone'],
         | 
| 80 81 | 
             
                    phone_calling_code: auth['phone_calling_code'],
         | 
| 81 82 | 
             
                    auth_provider: 'mobileid' # User::MOBILEID
         | 
| @@ -85,49 +86,51 @@ module MobileId | |
| 85 86 | 
             
                def session_request(session_id)
         | 
| 86 87 | 
             
                  response = HTTParty.get(url + "/authentication/session/#{session_id}")
         | 
| 87 88 | 
             
                  raise Error, "#{I18n.t('mobile_id.some_error')} #{response.code} #{response}" if response.code != 200
         | 
| 89 | 
            +
             | 
| 88 90 | 
             
                  response
         | 
| 89 91 | 
             
                end
         | 
| 90 92 |  | 
| 91 93 | 
             
                def long_poll!(session_id:, doc:)
         | 
| 92 94 | 
             
                  response = nil
         | 
| 93 95 |  | 
| 94 | 
            -
                  # Retries until RUNNING state turns to COMPLETE | 
| 95 | 
            -
                  30.times do | | 
| 96 | 
            +
                  # Retries until RUNNING state turns to COMPLETE
         | 
| 97 | 
            +
                  30.times do |_i|
         | 
| 96 98 | 
             
                    response = session_request(session_id)
         | 
| 97 99 | 
             
                    break if response['state'] == 'COMPLETE'
         | 
| 100 | 
            +
             | 
| 98 101 | 
             
                    sleep 1
         | 
| 99 102 | 
             
                  end
         | 
| 100 103 | 
             
                  raise Error, "#{I18n.t('mobile_id.some_error')} #{response.code} #{response}" if response['state'] != 'COMPLETE'
         | 
| 101 104 |  | 
| 102 105 | 
             
                  if response['result'] != 'OK'
         | 
| 103 | 
            -
                    message = | 
| 106 | 
            +
                    message =
         | 
| 104 107 | 
             
                      case response['result']
         | 
| 105 | 
            -
                      when  | 
| 108 | 
            +
                      when 'TIMEOUT'
         | 
| 106 109 | 
             
                        I18n.t('mobile_id.timeout')
         | 
| 107 | 
            -
                      when  | 
| 110 | 
            +
                      when 'NOT_MID_CLIENT'
         | 
| 108 111 | 
             
                        I18n.t('mobile_id.user_is_not_mobile_id_client')
         | 
| 109 | 
            -
                      when  | 
| 112 | 
            +
                      when 'USER_CANCELLED'
         | 
| 110 113 | 
             
                        I18n.t('mobile_id.user_cancelled')
         | 
| 111 | 
            -
                      when  | 
| 114 | 
            +
                      when 'SIGNATURE_HASH_MISMATCH'
         | 
| 112 115 | 
             
                        I18n.t('mobile_id.signature_hash_mismatch')
         | 
| 113 | 
            -
                      when  | 
| 116 | 
            +
                      when 'PHONE_ABSENT'
         | 
| 114 117 | 
             
                        I18n.t('mobile_id.phone_absent')
         | 
| 115 | 
            -
                      when  | 
| 118 | 
            +
                      when 'DELIVERY_ERROR'
         | 
| 116 119 | 
             
                        I18n.t('mobile_id.delivery_error')
         | 
| 117 | 
            -
                      when  | 
| 120 | 
            +
                      when 'SIM_ERROR'
         | 
| 118 121 | 
             
                        I18n.t('mobile_id.sim_error')
         | 
| 119 122 | 
             
                      end
         | 
| 120 | 
            -
             | 
| 123 | 
            +
                    raise Error, message
         | 
| 121 124 | 
             
                  end
         | 
| 122 125 |  | 
| 123 | 
            -
                  @user_cert = MobileId::Cert.new(response['cert'], live: | 
| 126 | 
            +
                  @user_cert = MobileId::Cert.new(response['cert'], live:)
         | 
| 124 127 | 
             
                  @user_cert.verify_signature!(response['signature']['value'], doc)
         | 
| 125 128 | 
             
                  self.user_cert = @user_cert
         | 
| 126 129 | 
             
                end
         | 
| 127 130 |  | 
| 128 131 | 
             
                def verification_code
         | 
| 129 | 
            -
                  binary = hash.to_s. | 
| 130 | 
            -
                   | 
| 132 | 
            +
                  binary = hash.to_s.unpack1('B*')
         | 
| 133 | 
            +
                  '%04d' % (binary[0...6] + binary[-7..]).to_i(2)
         | 
| 131 134 | 
             
                end
         | 
| 132 135 |  | 
| 133 136 | 
             
                def given_name
         | 
| @@ -139,7 +142,7 @@ module MobileId | |
| 139 142 | 
             
                  user_cert.surname
         | 
| 140 143 | 
             
                end
         | 
| 141 144 | 
             
                alias last_name surname
         | 
| 142 | 
            -
             | 
| 145 | 
            +
             | 
| 143 146 | 
             
                def country
         | 
| 144 147 | 
             
                  user_cert.country
         | 
| 145 148 | 
             
                end
         | 
| @@ -156,5 +159,6 @@ module MobileId | |
| 156 159 | 
             
                  user_cert.serial_number
         | 
| 157 160 | 
             
                end
         | 
| 158 161 | 
             
                alias personal_code serial_number
         | 
| 162 | 
            +
             | 
| 159 163 | 
             
              end
         | 
| 160 164 | 
             
            end
         | 
    
        data/lib/mobile_id/cert.rb
    CHANGED
    
    | @@ -2,49 +2,55 @@ | |
| 2 2 |  | 
| 3 3 | 
             
            module MobileId
         | 
| 4 4 | 
             
              class Cert
         | 
| 5 | 
            +
             | 
| 5 6 | 
             
                class << self
         | 
| 7 | 
            +
             | 
| 6 8 | 
             
                  def root_path
         | 
| 7 9 | 
             
                    @root_path ||= File.expand_path('certs', __dir__)
         | 
| 8 10 | 
             
                  end
         | 
| 9 11 |  | 
| 10 12 | 
             
                  def live_store
         | 
| 11 | 
            -
                    @live_store ||= | 
| 13 | 
            +
                    @live_store ||=
         | 
| 12 14 | 
             
                      build_store([
         | 
| 13 | 
            -
             | 
| 14 | 
            -
             | 
| 15 | 
            -
             | 
| 16 | 
            -
             | 
| 17 | 
            -
             | 
| 18 | 
            -
             | 
| 19 | 
            -
             | 
| 20 | 
            -
             | 
| 21 | 
            -
             | 
| 22 | 
            -
             | 
| 23 | 
            -
             | 
| 24 | 
            -
             | 
| 25 | 
            -
             | 
| 15 | 
            +
                                    File.join(root_path, 'EE_Certification_Centre_Root_CA.pem.crt'),
         | 
| 16 | 
            +
                                    File.join(root_path, 'EE-GovCA2018.pem.crt'),
         | 
| 17 | 
            +
                                    File.join(root_path, 'EID-SK_2011.pem.crt'),
         | 
| 18 | 
            +
                                    File.join(root_path, 'EID-SK_2016.pem.crt'),
         | 
| 19 | 
            +
                                    File.join(root_path, 'esteid2018.pem.crt'),
         | 
| 20 | 
            +
                                    File.join(root_path, 'ESTEID-SK_2011.pem.crt'),
         | 
| 21 | 
            +
                                    File.join(root_path, 'ESTEID-SK_2015.pem.crt'),
         | 
| 22 | 
            +
                                    File.join(root_path, 'KLASS3-SK_2010_EECCRCA.pem.crt'),
         | 
| 23 | 
            +
                                    File.join(root_path, 'KLASS3-SK_2010_EECCRCA_SHA384.pem.crt'),
         | 
| 24 | 
            +
                                    File.join(root_path, 'KLASS3-SK_2016_EECCRCA_SHA384.pem.crt'),
         | 
| 25 | 
            +
                                    File.join(root_path, 'KLASS3-SK.pem.crt'),
         | 
| 26 | 
            +
                                    File.join(root_path, 'NQ-SK_2016.pem.crt')
         | 
| 27 | 
            +
                                  ])
         | 
| 26 28 | 
             
                  end
         | 
| 27 29 |  | 
| 28 30 | 
             
                  def test_store
         | 
| 29 | 
            -
                    @test_store ||= | 
| 31 | 
            +
                    @test_store ||=
         | 
| 30 32 | 
             
                      build_store([
         | 
| 31 | 
            -
             | 
| 32 | 
            -
             | 
| 33 | 
            -
             | 
| 33 | 
            +
                                    File.join(root_path, 'TEST_of_EE_Certification_Centre_Root_CA.pem.crt'),
         | 
| 34 | 
            +
                                    File.join(root_path, 'TEST_of_ESTEID-SK_2015.pem.crt')
         | 
| 35 | 
            +
                                  ])
         | 
| 34 36 | 
             
                  end
         | 
| 35 37 |  | 
| 36 38 | 
             
                  def build_store(paths)
         | 
| 37 39 | 
             
                    store = OpenSSL::X509::Store.new
         | 
| 38 | 
            -
                    paths.each  | 
| 40 | 
            +
                    paths.each do |path|
         | 
| 41 | 
            +
                      cert = OpenSSL::X509::Certificate.new(File.read(path))
         | 
| 42 | 
            +
                      store.add_cert(cert)
         | 
| 43 | 
            +
                    end
         | 
| 39 44 | 
             
                    store
         | 
| 40 45 | 
             
                  end
         | 
| 46 | 
            +
             | 
| 41 47 | 
             
                end
         | 
| 42 48 |  | 
| 43 49 | 
             
                attr_accessor :cert, :subject
         | 
| 44 50 |  | 
| 45 51 | 
             
                def initialize(base64_cert, live:)
         | 
| 46 52 | 
             
                  self.cert = OpenSSL::X509::Certificate.new(Base64.decode64(base64_cert))
         | 
| 47 | 
            -
                  verify!( | 
| 53 | 
            +
                  verify!(cert, live:)
         | 
| 48 54 | 
             
                  build_cert_subject
         | 
| 49 55 | 
             
                end
         | 
| 50 56 |  | 
| @@ -52,11 +58,14 @@ module MobileId | |
| 52 58 | 
             
                  if live == true
         | 
| 53 59 | 
             
                    raise Error, 'User certificate is not valid' unless self.class.live_store.verify(cert)
         | 
| 54 60 | 
             
                  else
         | 
| 55 | 
            -
                     | 
| 61 | 
            +
                    unless self.class.test_store.verify(cert) || self.class.live_store.verify(cert)
         | 
| 62 | 
            +
                      raise Error,
         | 
| 63 | 
            +
                            'User certificate is not valid'
         | 
| 64 | 
            +
                    end
         | 
| 56 65 | 
             
                  end
         | 
| 57 66 |  | 
| 58 67 | 
             
                  raise Error, 'User certificate is not valid [check_key]' unless cert.public_key.check_key
         | 
| 59 | 
            -
                  raise Error, 'User certificate is expired' unless (cert.not_before...cert.not_after) | 
| 68 | 
            +
                  raise Error, 'User certificate is expired' unless (cert.not_before...cert.not_after).include?(Time.now)
         | 
| 60 69 |  | 
| 61 70 | 
             
                  true
         | 
| 62 71 | 
             
                end
         | 
| @@ -77,49 +86,51 @@ module MobileId | |
| 77 86 | 
             
                end
         | 
| 78 87 |  | 
| 79 88 | 
             
                def cvc_to_der(cvc)
         | 
| 80 | 
            -
                  sign_hex = cvc. | 
| 89 | 
            +
                  sign_hex = cvc.unpack1('H*')
         | 
| 81 90 | 
             
                  half = sign_hex.size / 2
         | 
| 82 | 
            -
                  i = [OpenSSL::ASN1::Integer.new(sign_hex[0...half].to_i(16)), | 
| 91 | 
            +
                  i = [OpenSSL::ASN1::Integer.new(sign_hex[0...half].to_i(16)),
         | 
| 92 | 
            +
                       OpenSSL::ASN1::Integer.new(sign_hex[half..sign_hex.size].to_i(16))]
         | 
| 83 93 | 
             
                  seq = OpenSSL::ASN1::Sequence.new(i)
         | 
| 84 94 | 
             
                  seq.to_der
         | 
| 85 95 | 
             
                end
         | 
| 86 96 |  | 
| 87 97 | 
             
                def given_name
         | 
| 88 | 
            -
                  subject[ | 
| 98 | 
            +
                  subject['GN'].tr(',', ' ')
         | 
| 89 99 | 
             
                end
         | 
| 90 100 | 
             
                alias first_name given_name
         | 
| 91 101 |  | 
| 92 102 | 
             
                def surname
         | 
| 93 | 
            -
                  subject[ | 
| 103 | 
            +
                  subject['SN'].tr(',', ' ')
         | 
| 94 104 | 
             
                end
         | 
| 95 105 | 
             
                alias last_name surname
         | 
| 96 | 
            -
             | 
| 106 | 
            +
             | 
| 97 107 | 
             
                def country
         | 
| 98 | 
            -
                  subject[ | 
| 108 | 
            +
                  subject['C'].tr(',', ' ')
         | 
| 99 109 | 
             
                end
         | 
| 100 110 |  | 
| 101 111 | 
             
                def common_name
         | 
| 102 | 
            -
                  subject[ | 
| 112 | 
            +
                  subject['CN']
         | 
| 103 113 | 
             
                end
         | 
| 104 114 |  | 
| 105 115 | 
             
                def organizational_unit
         | 
| 106 | 
            -
                  subject[ | 
| 116 | 
            +
                  subject['OU']
         | 
| 107 117 | 
             
                end
         | 
| 108 118 |  | 
| 109 119 | 
             
                def serial_number
         | 
| 110 | 
            -
                  subject[ | 
| 120 | 
            +
                  subject['serialNumber']
         | 
| 111 121 | 
             
                end
         | 
| 112 122 | 
             
                alias personal_code serial_number
         | 
| 113 123 |  | 
| 114 124 | 
             
                private
         | 
| 115 125 |  | 
| 116 126 | 
             
                def build_cert_subject
         | 
| 117 | 
            -
                  self.subject = cert.subject.to_utf8.split(/(?<!\\) | 
| 118 | 
            -
                    next unless c.include?( | 
| 127 | 
            +
                  self.subject = cert.subject.to_utf8.split(/(?<!\\),+/).each_with_object({}) do |c, result|
         | 
| 128 | 
            +
                    next unless c.include?('=')
         | 
| 119 129 |  | 
| 120 | 
            -
                    key, val = c.split( | 
| 130 | 
            +
                    key, val = c.split('=')
         | 
| 121 131 | 
             
                    result[key] = val
         | 
| 122 132 | 
             
                  end
         | 
| 123 133 | 
             
                end
         | 
| 134 | 
            +
             | 
| 124 135 | 
             
              end
         | 
| 125 136 | 
             
            end
         | 
| @@ -0,0 +1,10 @@ | |
| 1 | 
            +
            lt:
         | 
| 2 | 
            +
              mobile_id:
         | 
| 3 | 
            +
                some_error: Įvyko klaida
         | 
| 4 | 
            +
                timeout: "M-parašo sesija pasibaigė"
         | 
| 5 | 
            +
                user_is_not_mobile_id_client: Vartotojas nėra m-parašo klientas.
         | 
| 6 | 
            +
                user_cancelled: Vartotojas nutraukė m-parašo operaciją.
         | 
| 7 | 
            +
                signature_hash_mismatch: "M-parašo turi problemą. Vartotojas turėtų kreiptis į savo operatorių."
         | 
| 8 | 
            +
                phone_absent: m-parašo SIM nepasiekiama.
         | 
| 9 | 
            +
                delivery_error: m-parašo SMS siuntimo klaida.
         | 
| 10 | 
            +
                sim_error: Neteisingas atsakymas iš m-parašo SIM kortelės
         | 
    
        data/lib/mobile_id/railtie.rb
    CHANGED
    
    | @@ -1,13 +1,15 @@ | |
| 1 | 
            +
            # frozen_string_literal: true
         | 
| 2 | 
            +
             | 
| 1 3 | 
             
            require 'rails'
         | 
| 2 4 |  | 
| 3 5 | 
             
            module MobileId
         | 
| 4 | 
            -
              class Railtie < ::Rails::Railtie  | 
| 5 | 
            -
             | 
| 6 | 
            -
             | 
| 7 | 
            -
             | 
| 8 | 
            -
             | 
| 9 | 
            -
                    end
         | 
| 6 | 
            +
              class Railtie < ::Rails::Railtie # :nodoc:
         | 
| 7 | 
            +
             | 
| 8 | 
            +
                initializer 'mobile_id' do |_app|
         | 
| 9 | 
            +
                  MobileId::LOCALES.each do |loc|
         | 
| 10 | 
            +
                    I18n.load_path << File.expand_path("locales/#{loc}.yml", __dir__)
         | 
| 10 11 | 
             
                  end
         | 
| 11 12 | 
             
                end
         | 
| 13 | 
            +
             | 
| 12 14 | 
             
              end
         | 
| 13 15 | 
             
            end
         | 
    
        data/lib/mobile_id.rb
    CHANGED
    
    | @@ -5,16 +5,17 @@ require 'digest' | |
| 5 5 | 
             
            require 'httparty'
         | 
| 6 6 | 
             
            require 'active_support/core_ext/hash/indifferent_access'
         | 
| 7 7 | 
             
            require 'i18n'
         | 
| 8 | 
            +
             | 
| 8 9 | 
             
            if defined?(Rails)
         | 
| 9 | 
            -
              require 'mobile_id/railtie' | 
| 10 | 
            +
              require 'mobile_id/railtie'
         | 
| 10 11 | 
             
            else
         | 
| 11 | 
            -
              I18n.load_path << Dir[File.expand_path( | 
| 12 | 
            +
              I18n.load_path << Dir["#{File.expand_path('lib/mobile_id/locales')}/*.yml"]
         | 
| 12 13 | 
             
            end
         | 
| 13 14 |  | 
| 14 15 | 
             
            module MobileId
         | 
| 15 16 | 
             
              class Error < StandardError; end
         | 
| 16 17 |  | 
| 17 | 
            -
              LOCALES = [ | 
| 18 | 
            +
              LOCALES = %i[en et lt ru].freeze
         | 
| 18 19 | 
             
            end
         | 
| 19 20 |  | 
| 20 21 | 
             
            require 'mobile_id/cert'
         | 
    
        metadata
    CHANGED
    
    | @@ -1,15 +1,29 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: mobile_id
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.0. | 
| 4 | 
            +
              version: 0.0.14
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Priit Tark
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date:  | 
| 11 | 
            +
            date: 2023-05-16 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 14 | 
            +
              name: activesupport
         | 
| 15 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 16 | 
            +
                requirements:
         | 
| 17 | 
            +
                - - ">="
         | 
| 18 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 19 | 
            +
                    version: '0'
         | 
| 20 | 
            +
              type: :runtime
         | 
| 21 | 
            +
              prerelease: false
         | 
| 22 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 23 | 
            +
                requirements:
         | 
| 24 | 
            +
                - - ">="
         | 
| 25 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 26 | 
            +
                    version: '0'
         | 
| 13 27 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 28 | 
             
              name: httparty
         | 
| 15 29 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| @@ -24,6 +38,20 @@ dependencies: | |
| 24 38 | 
             
                - - ">="
         | 
| 25 39 | 
             
                  - !ruby/object:Gem::Version
         | 
| 26 40 | 
             
                    version: '0'
         | 
| 41 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 42 | 
            +
              name: i18n
         | 
| 43 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 44 | 
            +
                requirements:
         | 
| 45 | 
            +
                - - ">="
         | 
| 46 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 47 | 
            +
                    version: '0'
         | 
| 48 | 
            +
              type: :runtime
         | 
| 49 | 
            +
              prerelease: false
         | 
| 50 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 51 | 
            +
                requirements:
         | 
| 52 | 
            +
                - - ">="
         | 
| 53 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 54 | 
            +
                    version: '0'
         | 
| 27 55 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 28 56 | 
             
              name: openssl
         | 
| 29 57 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| @@ -39,13 +67,13 @@ dependencies: | |
| 39 67 | 
             
                  - !ruby/object:Gem::Version
         | 
| 40 68 | 
             
                    version: 2.2.0
         | 
| 41 69 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 42 | 
            -
              name:  | 
| 70 | 
            +
              name: pry
         | 
| 43 71 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 44 72 | 
             
                requirements:
         | 
| 45 73 | 
             
                - - ">="
         | 
| 46 74 | 
             
                  - !ruby/object:Gem::Version
         | 
| 47 75 | 
             
                    version: '0'
         | 
| 48 | 
            -
              type: : | 
| 76 | 
            +
              type: :development
         | 
| 49 77 | 
             
              prerelease: false
         | 
| 50 78 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 51 79 | 
             
                requirements:
         | 
| @@ -53,13 +81,13 @@ dependencies: | |
| 53 81 | 
             
                  - !ruby/object:Gem::Version
         | 
| 54 82 | 
             
                    version: '0'
         | 
| 55 83 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 56 | 
            -
              name:  | 
| 84 | 
            +
              name: rspec
         | 
| 57 85 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 58 86 | 
             
                requirements:
         | 
| 59 87 | 
             
                - - ">="
         | 
| 60 88 | 
             
                  - !ruby/object:Gem::Version
         | 
| 61 89 | 
             
                    version: '0'
         | 
| 62 | 
            -
              type: : | 
| 90 | 
            +
              type: :development
         | 
| 63 91 | 
             
              prerelease: false
         | 
| 64 92 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 65 93 | 
             
                requirements:
         | 
| @@ -67,7 +95,7 @@ dependencies: | |
| 67 95 | 
             
                  - !ruby/object:Gem::Version
         | 
| 68 96 | 
             
                    version: '0'
         | 
| 69 97 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 70 | 
            -
              name:  | 
| 98 | 
            +
              name: rubocop
         | 
| 71 99 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 72 100 | 
             
                requirements:
         | 
| 73 101 | 
             
                - - ">="
         | 
| @@ -81,7 +109,7 @@ dependencies: | |
| 81 109 | 
             
                  - !ruby/object:Gem::Version
         | 
| 82 110 | 
             
                    version: '0'
         | 
| 83 111 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 84 | 
            -
              name:  | 
| 112 | 
            +
              name: rubocop-rspec
         | 
| 85 113 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 86 114 | 
             
                requirements:
         | 
| 87 115 | 
             
                - - ">="
         | 
| @@ -94,8 +122,8 @@ dependencies: | |
| 94 122 | 
             
                - - ">="
         | 
| 95 123 | 
             
                  - !ruby/object:Gem::Version
         | 
| 96 124 | 
             
                    version: '0'
         | 
| 97 | 
            -
            description: Estonia Mobile ID authentication
         | 
| 98 | 
            -
            email: priit@ | 
| 125 | 
            +
            description: Ruby client for Estonia and Lithuania Mobile ID authentication
         | 
| 126 | 
            +
            email: priit@domify.io
         | 
| 99 127 | 
             
            executables: []
         | 
| 100 128 | 
             
            extensions: []
         | 
| 101 129 | 
             
            extra_rdoc_files: []
         | 
| @@ -122,12 +150,15 @@ files: | |
| 122 150 | 
             
            - lib/mobile_id/certs/esteid2018.pem.crt
         | 
| 123 151 | 
             
            - lib/mobile_id/locales/en.yml
         | 
| 124 152 | 
             
            - lib/mobile_id/locales/et.yml
         | 
| 153 | 
            +
            - lib/mobile_id/locales/lt.yml
         | 
| 125 154 | 
             
            - lib/mobile_id/locales/ru.yml
         | 
| 126 155 | 
             
            - lib/mobile_id/railtie.rb
         | 
| 127 | 
            -
            homepage: https://github.com/ | 
| 156 | 
            +
            homepage: https://github.com/domify/mobile_id
         | 
| 128 157 | 
             
            licenses:
         | 
| 129 158 | 
             
            - MIT
         | 
| 130 | 
            -
            metadata: | 
| 159 | 
            +
            metadata:
         | 
| 160 | 
            +
              changelog_uri: https://github.com/domify/mobile_id/blob/main/CHANGELOG.md
         | 
| 161 | 
            +
              rubygems_mfa_required: 'true'
         | 
| 131 162 | 
             
            post_install_message: 
         | 
| 132 163 | 
             
            rdoc_options: []
         | 
| 133 164 | 
             
            require_paths:
         | 
| @@ -146,5 +177,5 @@ requirements: [] | |
| 146 177 | 
             
            rubygems_version: 3.4.10
         | 
| 147 178 | 
             
            signing_key: 
         | 
| 148 179 | 
             
            specification_version: 4
         | 
| 149 | 
            -
            summary: Estonia Mobile ID authentication
         | 
| 180 | 
            +
            summary: Estonia and Lithuania Mobile ID authentication
         | 
| 150 181 | 
             
            test_files: []
         |