web_authn 0.0.2 → 0.0.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 648a6cc93f91835ee94c9c5d7efafd7ba788863d61a2e44efba388c4a45f066c
4
- data.tar.gz: a0fa7c5a9848ec784ed62297131022223b6c6c43467532cb2ebb3fa71df706ae
3
+ metadata.gz: ae734c58dcaf2aec7da75436de6611077577ddedf5b5321377892c1d5c50e928
4
+ data.tar.gz: 2a4084397e852119fcc22f3d3c8491f2fa520d8ceed71de56bf7e07af162c77c
5
5
  SHA512:
6
- metadata.gz: 44f73a5564326062ce9614d3df2e3238fad34c0ce5ea8e4381a0ca81e541fb0a893670527f013c12f9698da077d946b140746972ad8718601fd1562bf7a99399
7
- data.tar.gz: 1858d4cb4e878ba8ae0595689f307cb13a4b17e2b21e6baf1569f496d94b01cf0f486bf8758224c114a9c3052e1ac3e46210321718ea4ef9ed5c02db9b923e12
6
+ metadata.gz: 15e45bc2f3da9bc91409cb9db0bb9151144f223ec1d880802588a0cf6a7cb882f4aae9830db6465882ebeb2469a7ef88fa2e532208448f629b2c47b32734ee81
7
+ data.tar.gz: 05d6c10d89ba105db10dc83dec3b61465fd26d1328a01039c682bfd42c536d5206cb95b06afac40a4ddebb3e68c485dbebc29db2bce4369c8d924ec116437206
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.2
1
+ 0.0.3
@@ -12,11 +12,13 @@ module WebAuthn
12
12
  class << self
13
13
  def decode(encoded_client_data_json)
14
14
  raw_client_data_json = Base64.urlsafe_decode64 encoded_client_data_json
15
- new JSON.parse(
15
+ attrs = JSON.parse(
16
16
  raw_client_data_json
17
17
  ).merge(
18
18
  raw: raw_client_data_json
19
19
  ).with_indifferent_access
20
+ attrs[:challenge] = Base64.urlsafe_decode64 attrs[:challenge]
21
+ new attrs
20
22
  end
21
23
  end
22
24
  end
@@ -8,7 +8,7 @@ sign_count = 73
8
8
  client_data_json = 'eyJjaGFsbGVuZ2UiOiJjbUZ1Wkc5dExYTjBjbWx1WnkxblpXNWxjbUYwWldRdFlua3RjbkF0YzJWeWRtVnkiLCJvcmlnaW4iOiJodHRwczovL3dlYi1hdXRobi5zZWxmLWlzc3VlZC5hcHAiLCJ0eXBlIjoid2ViYXV0aG4uZ2V0In0'
9
9
 
10
10
  origin = 'https://web-authn.self-issued.app'
11
- challenge = 'cmFuZG9tLXN0cmluZy1nZW5lcmF0ZWQtYnktcnAtc2VydmVy'
11
+ challenge = 'random-string-generated-by-rp-server'
12
12
 
13
13
  public_key = OpenSSL::PKey::EC.new <<-PEM
14
14
  -----BEGIN PUBLIC KEY-----
@@ -5,7 +5,7 @@ attestation_object = 'o2NmbXRkbm9uZWdhdHRTdG10oGhhdXRoRGF0YVjEMsuA3KzDw1JGLLAfO_
5
5
  client_data_json = 'eyJjaGFsbGVuZ2UiOiJjbUZ1Wkc5dExYTjBjbWx1WnkxblpXNWxjbUYwWldRdFlua3RjbkF0YzJWeWRtVnkiLCJvcmlnaW4iOiJodHRwczovL3dlYi1hdXRobi5zZWxmLWlzc3VlZC5hcHAiLCJ0eXBlIjoid2ViYXV0aG4uY3JlYXRlIn0'
6
6
 
7
7
  origin = 'https://web-authn.self-issued.app'
8
- challenge = 'cmFuZG9tLXN0cmluZy1nZW5lcmF0ZWQtYnktcnAtc2VydmVy'
8
+ challenge = 'random-string-generated-by-rp-server'
9
9
 
10
10
  context = WebAuthn.context_for(
11
11
  client_data_json,
@@ -12,7 +12,7 @@ RSpec.describe WebAuthn::Context::Authentication do
12
12
  'eyJjaGFsbGVuZ2UiOiJjbUZ1Wkc5dExYTjBjbWx1WnkxblpXNWxjbUYwWldRdFlua3RjbkF0YzJWeWRtVnkiLCJvcmlnaW4iOiJodHRwczovL3dlYi1hdXRobi5zZWxmLWlzc3VlZC5hcHAiLCJ0eXBlIjoid2ViYXV0aG4uZ2V0In0'
13
13
  end
14
14
  let(:origin) { 'https://web-authn.self-issued.app' }
15
- let(:challenge) { 'cmFuZG9tLXN0cmluZy1nZW5lcmF0ZWQtYnktcnAtc2VydmVy' }
15
+ let(:challenge) { 'random-string-generated-by-rp-server' }
16
16
  let(:rp_id_hash) do
17
17
  'MsuA3KzDw1JGLLAfO_4wLebzcS8w_SDs0Zw7pbhYlJU'
18
18
  end
@@ -17,7 +17,9 @@ module ContextFactory
17
17
  base_context
18
18
  end
19
19
  let(:client_data_json) do
20
- Base64.urlsafe_encode64(context.to_json, padding: false)
20
+ _context_ = context.dup
21
+ _context_[:challenge] = Base64.urlsafe_encode64(_context_[:challenge], padding: false)
22
+ Base64.urlsafe_encode64(_context_.to_json, padding: false)
21
23
  end
22
24
  end
23
25
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: web_authn
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - nov matake