webauthn-slim 3.4.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.
Files changed (70) hide show
  1. checksums.yaml +7 -0
  2. data/.github/FUNDING.yml +1 -0
  3. data/.github/actions/install-openssl/action.yml +35 -0
  4. data/.github/actions/install-ruby/action.yml +76 -0
  5. data/.github/dependabot.yml +6 -0
  6. data/.github/workflows/build.yml +49 -0
  7. data/.github/workflows/git.yml +21 -0
  8. data/.github/workflows/release.yml +28 -0
  9. data/.gitignore +16 -0
  10. data/.rspec +2 -0
  11. data/.rubocop.yml +306 -0
  12. data/CHANGELOG.md +462 -0
  13. data/CONTRIBUTING.md +39 -0
  14. data/Gemfile +8 -0
  15. data/LICENSE.txt +21 -0
  16. data/README.md +479 -0
  17. data/Rakefile +10 -0
  18. data/SECURITY.md +21 -0
  19. data/bin/console +15 -0
  20. data/bin/setup +8 -0
  21. data/docs/advanced_configuration.md +173 -0
  22. data/docs/u2f_migration.md +90 -0
  23. data/lib/webauthn/attestation_object.rb +47 -0
  24. data/lib/webauthn/attestation_statement/apple.rb +65 -0
  25. data/lib/webauthn/attestation_statement/base.rb +175 -0
  26. data/lib/webauthn/attestation_statement/fido_u2f/public_key.rb +44 -0
  27. data/lib/webauthn/attestation_statement/fido_u2f.rb +71 -0
  28. data/lib/webauthn/attestation_statement/none.rb +23 -0
  29. data/lib/webauthn/attestation_statement/packed.rb +72 -0
  30. data/lib/webauthn/attestation_statement.rb +35 -0
  31. data/lib/webauthn/authenticator_assertion_response.rb +87 -0
  32. data/lib/webauthn/authenticator_attestation_response.rb +84 -0
  33. data/lib/webauthn/authenticator_data/attested_credential_data.rb +94 -0
  34. data/lib/webauthn/authenticator_data.rb +130 -0
  35. data/lib/webauthn/authenticator_response.rb +137 -0
  36. data/lib/webauthn/cbor.rb +189 -0
  37. data/lib/webauthn/client_data.rb +67 -0
  38. data/lib/webauthn/configuration.rb +68 -0
  39. data/lib/webauthn/cose.rb +237 -0
  40. data/lib/webauthn/credential.rb +26 -0
  41. data/lib/webauthn/credential_creation_options.rb +97 -0
  42. data/lib/webauthn/credential_entity.rb +11 -0
  43. data/lib/webauthn/credential_options.rb +17 -0
  44. data/lib/webauthn/credential_request_options.rb +44 -0
  45. data/lib/webauthn/credential_rp_entity.rb +8 -0
  46. data/lib/webauthn/credential_user_entity.rb +16 -0
  47. data/lib/webauthn/encoder.rb +18 -0
  48. data/lib/webauthn/encoders.rb +62 -0
  49. data/lib/webauthn/error.rb +5 -0
  50. data/lib/webauthn/fake_authenticator/attestation_object.rb +90 -0
  51. data/lib/webauthn/fake_authenticator/authenticator_data.rb +156 -0
  52. data/lib/webauthn/fake_authenticator.rb +134 -0
  53. data/lib/webauthn/fake_client.rb +179 -0
  54. data/lib/webauthn/json_serializer.rb +45 -0
  55. data/lib/webauthn/public_key.rb +65 -0
  56. data/lib/webauthn/public_key_credential/creation_options.rb +93 -0
  57. data/lib/webauthn/public_key_credential/entity.rb +21 -0
  58. data/lib/webauthn/public_key_credential/options.rb +51 -0
  59. data/lib/webauthn/public_key_credential/request_options.rb +46 -0
  60. data/lib/webauthn/public_key_credential/rp_entity.rb +23 -0
  61. data/lib/webauthn/public_key_credential/user_entity.rb +24 -0
  62. data/lib/webauthn/public_key_credential.rb +94 -0
  63. data/lib/webauthn/public_key_credential_with_assertion.rb +49 -0
  64. data/lib/webauthn/public_key_credential_with_attestation.rb +30 -0
  65. data/lib/webauthn/relying_party.rb +150 -0
  66. data/lib/webauthn/u2f_migrator.rb +76 -0
  67. data/lib/webauthn/version.rb +5 -0
  68. data/lib/webauthn.rb +19 -0
  69. data/webauthn.gemspec +43 -0
  70. metadata +218 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 82be6f49bd7c36c0edcf769158f093ad70d79cea976a7a4288ab4958b4e11a55
4
+ data.tar.gz: c2c0ff7ad3ce12139498446a49223e77b4e73b975b4c2f080a809fdde78f8c5e
5
+ SHA512:
6
+ metadata.gz: 1f329a2dc155b8bb808b51aa64514af6b3687499bff419de6f0a4c8963c6ca42d5bdd11b04243375511ec70dc423448ea777004b6f6f2766f00f18ec162e9a24
7
+ data.tar.gz: a9ec318ed1cc2638321f39e643e7054715fb39ab55a52c5eecfdc1277ca386bbcbce6b5021230244abc971d477837a874dc376500f97427df09eafe4342cf74a
@@ -0,0 +1 @@
1
+ github: [cedarcode]
@@ -0,0 +1,35 @@
1
+ name: Install OpenSSL
2
+
3
+ inputs:
4
+ version:
5
+ description: 'The version of OpenSSL to install'
6
+ required: true
7
+
8
+ runs:
9
+ using: 'composite'
10
+ steps:
11
+ - name: Restore cached OpenSSL library
12
+ id: cache-openssl-restore
13
+ uses: actions/cache/restore@v4
14
+ with:
15
+ path: ~/openssl
16
+ key: openssl-${{ inputs.version }}
17
+
18
+ - name: Compile OpenSSL library
19
+ if: steps.cache-openssl-restore.outputs.cache-hit != 'true'
20
+ shell: bash
21
+ run: |
22
+ mkdir -p tmp/build-openssl && cd tmp/build-openssl
23
+ openssl_tag="openssl-${{ inputs.version }}"
24
+ git clone -b "$openssl_tag" --depth 1 https://github.com/openssl/openssl.git .
25
+ echo "Git commit: $(git rev-parse HEAD)"
26
+ ./Configure --prefix="$HOME/openssl" --libdir=lib enable-fips no-tests
27
+ make -j4 && make install_sw && make install_fips
28
+
29
+ - name: Save OpenSSL library cache
30
+ if: steps.cache-openssl-restore.outputs.cache-hit != 'true'
31
+ id: cache-openssl-save
32
+ uses: actions/cache/save@v4
33
+ with:
34
+ path: ~/openssl
35
+ key: ${{ steps.cache-openssl-restore.outputs.cache-primary-key }}
@@ -0,0 +1,76 @@
1
+ name: Install Ruby
2
+
3
+ inputs:
4
+ version:
5
+ description: 'The version of Ruby to install'
6
+ required: true
7
+ openssl-version:
8
+ description: 'The version of OpenSSL used'
9
+ required: true
10
+
11
+ runs:
12
+ using: 'composite'
13
+ steps:
14
+ - name: Restore cached Ruby installation
15
+ id: cache-ruby-restore
16
+ uses: actions/cache/restore@v4
17
+ with:
18
+ path: ~/rubies/ruby-${{ inputs.version }}
19
+ key: ruby-${{ inputs.version }}-with-openssl-${{ inputs.openssl-version }}
20
+
21
+ - name: Install Ruby
22
+ if: steps.cache-ruby-restore.outputs.cache-hit != 'true'
23
+ shell: bash
24
+ run: |
25
+ ruby_version="${{ inputs.version }}"
26
+ if [[ "$ruby_version" =~ ^[0-9]+\.[0-9]+$ ]]; then
27
+ ruby_series="$ruby_version"
28
+ latest_patch=$(curl -fsS "https://cache.ruby-lang.org/pub/ruby/$ruby_series/" \
29
+ | grep -oE "ruby-$ruby_series\.[0-9]+\.tar\.xz" \
30
+ | sed -E 's/.*\.([0-9]+)\.tar\.xz/\1/' \
31
+ | sort -n | tail -n 1)
32
+ ruby_version="$ruby_series.$latest_patch"
33
+ else
34
+ ruby_series="${ruby_version%.*}"
35
+ fi
36
+ wget "https://cache.ruby-lang.org/pub/ruby/$ruby_series/ruby-$ruby_version.tar.xz"
37
+ tar -xJvf "ruby-$ruby_version.tar.xz"
38
+ cd "ruby-$ruby_version"
39
+ ./configure --prefix=$HOME/rubies/ruby-${{ inputs.version }} --with-openssl-dir=$HOME/openssl
40
+ make
41
+ make install
42
+
43
+ - name: Update PATH
44
+ shell: bash
45
+ run: |
46
+ echo "$HOME/rubies/ruby-${{ inputs.version }}/bin" >> "$GITHUB_PATH"
47
+
48
+ - name: Save Ruby installation cache
49
+ if: steps.cache-ruby-restore.outputs.cache-hit != 'true'
50
+ id: cache-ruby-save
51
+ uses: actions/cache/save@v4
52
+ with:
53
+ path: ~/rubies/ruby-${{ inputs.version }}
54
+ key: ${{ steps.cache-ruby-restore.outputs.cache-primary-key }}
55
+
56
+ - name: Cache Bundler Install
57
+ id: cache-bundler-restore
58
+ uses: actions/cache/restore@v4
59
+ env:
60
+ GEMFILE: ${{ env.BUNDLE_GEMFILE || 'Gemfile' }}
61
+ with:
62
+ path: ~/bundler/cache
63
+ key: bundler-ruby-${{ inputs.version }}-${{ inputs.openssl-version }}-${{ hashFiles(env.Gemfile, 'webauthn.gemspec') }}
64
+
65
+ - name: Install dependencies
66
+ shell: bash
67
+ run: |
68
+ bundle config set --local path ~/bundler/cache
69
+ bundle install
70
+
71
+ - name: Save Bundler Install cache
72
+ id: cache-bundler-save
73
+ uses: actions/cache/save@v4
74
+ with:
75
+ path: ~/bundler/cache
76
+ key: ${{ steps.cache-bundler-restore.outputs.cache-primary-key }}
@@ -0,0 +1,6 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: "github-actions"
4
+ directory: "/"
5
+ schedule:
6
+ interval: "weekly"
@@ -0,0 +1,49 @@
1
+ name: build
2
+
3
+ on:
4
+ push:
5
+ branches: [master]
6
+ pull_request:
7
+ types: [opened, synchronize]
8
+
9
+ jobs:
10
+ test:
11
+ name: 'Test Ruby ${{ matrix.ruby }} with OpenSSL ${{ matrix.openssl }}'
12
+ runs-on: ubuntu-24.04
13
+ strategy:
14
+ fail-fast: false
15
+ matrix:
16
+ ruby:
17
+ - '4.0'
18
+ - '4.1.0-preview1'
19
+ openssl:
20
+ - '4.0.3'
21
+ - '3.6.5'
22
+ - '3.5.9'
23
+ - '3.4.8'
24
+
25
+ steps:
26
+ - uses: actions/checkout@v7
27
+
28
+ - name: Install OpenSSL
29
+ uses: ./.github/actions/install-openssl
30
+ with:
31
+ version: ${{ matrix.openssl }}
32
+
33
+ - name: Manually set up Ruby
34
+ uses: ./.github/actions/install-ruby
35
+ with:
36
+ version: ${{ matrix.ruby }}
37
+ openssl-version: ${{ matrix.openssl }}
38
+
39
+ - run: bundle exec rspec
40
+
41
+ lint:
42
+ runs-on: ubuntu-latest
43
+ steps:
44
+ - uses: actions/checkout@v7
45
+ - uses: ruby/setup-ruby@v1
46
+ with:
47
+ ruby-version: '4.0'
48
+ bundler-cache: true
49
+ - run: bundle exec rubocop -f github
@@ -0,0 +1,21 @@
1
+ # Syntax reference:
2
+ # https://help.github.com/en/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions
3
+ name: Git Checks
4
+
5
+ on:
6
+ pull_request:
7
+ types: [opened, synchronize]
8
+
9
+ jobs:
10
+ # Fixup commits are OK in pull requests, but should generally be squashed
11
+ # before merging to master, e.g. using `git rebase -i --autosquash master`.
12
+ # See https://github.com/marketplace/actions/block-autosquash-commits
13
+ block-fixup:
14
+ runs-on: ubuntu-latest
15
+
16
+ steps:
17
+ - uses: actions/checkout@v7
18
+ - name: Block autosquash commits
19
+ uses: xt0rted/block-autosquash-commits-action@v2
20
+ with:
21
+ repo-token: ${{ secrets.GITHUB_TOKEN }}
@@ -0,0 +1,28 @@
1
+ name: Release
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+
7
+ jobs:
8
+ release:
9
+ name: Publish to Rubygems
10
+
11
+ runs-on: ubuntu-latest
12
+
13
+ environment: release
14
+
15
+ permissions:
16
+ contents: write
17
+ id-token: write
18
+
19
+ steps:
20
+ - uses: actions/checkout@v7
21
+
22
+ - name: Setup Ruby
23
+ uses: ruby/setup-ruby@v1
24
+ with:
25
+ bundler-cache: true
26
+
27
+ - name: Publish to RubyGems
28
+ uses: rubygems/release-gem@v1
data/.gitignore ADDED
@@ -0,0 +1,16 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
12
+
13
+ /Gemfile.lock
14
+ /gemfiles/*.gemfile.lock
15
+ .byebug_history
16
+ /spec/conformance/metadata.zip
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --order rand
2
+ --color
data/.rubocop.yml ADDED
@@ -0,0 +1,306 @@
1
+ plugins:
2
+ - rubocop-rspec
3
+ - rubocop-rake
4
+
5
+ inherit_mode:
6
+ merge:
7
+ - AllowedNames
8
+
9
+ AllCops:
10
+ TargetRubyVersion: 4.0
11
+ DisabledByDefault: true
12
+ NewCops: disable
13
+ Exclude:
14
+ - "gemfiles/**/*"
15
+ - "vendor/**/*"
16
+
17
+ Bundler:
18
+ Enabled: true
19
+
20
+ Gemspec:
21
+ Enabled: true
22
+
23
+ Layout:
24
+ Enabled: true
25
+
26
+ Layout/ClassStructure:
27
+ Enabled: true
28
+
29
+ Layout/EmptyLineBetweenDefs:
30
+ AllowAdjacentOneLineDefs: true
31
+
32
+ Layout/EmptyLinesAroundAttributeAccessor:
33
+ Enabled: true
34
+
35
+ Layout/FirstMethodArgumentLineBreak:
36
+ Enabled: true
37
+
38
+ Layout/LineLength:
39
+ Max: 120
40
+ Exclude:
41
+ - spec/support/seeds.rb
42
+
43
+ Layout/MultilineAssignmentLayout:
44
+ Enabled: true
45
+
46
+ Layout/MultilineMethodArgumentLineBreaks:
47
+ Enabled: true
48
+
49
+ Layout/SpaceAroundMethodCallOperator:
50
+ Enabled: true
51
+
52
+ Lint:
53
+ Enabled: true
54
+
55
+ Lint/DeprecatedOpenSSLConstant:
56
+ Enabled: true
57
+
58
+ Lint/MixedRegexpCaptureTypes:
59
+ Enabled: true
60
+
61
+ Lint/RaiseException:
62
+ Enabled: true
63
+
64
+ Lint/StructNewOverride:
65
+ Enabled: true
66
+
67
+ Lint/BinaryOperatorWithIdenticalOperands:
68
+ Enabled: true
69
+
70
+ Lint/DuplicateElsifCondition:
71
+ Enabled: true
72
+
73
+ Lint/DuplicateRescueException:
74
+ Enabled: true
75
+
76
+ Lint/EmptyConditionalBody:
77
+ Enabled: true
78
+
79
+ Lint/FloatComparison:
80
+ Enabled: true
81
+
82
+ Lint/MissingSuper:
83
+ Enabled: true
84
+
85
+ Lint/OutOfRangeRegexpRef:
86
+ Enabled: true
87
+
88
+ Lint/SelfAssignment:
89
+ Enabled: true
90
+
91
+ Lint/TopLevelReturnWithArgument:
92
+ Enabled: true
93
+
94
+ Lint/UnreachableLoop:
95
+ Enabled: true
96
+
97
+ Naming:
98
+ Enabled: true
99
+
100
+ Naming/VariableNumber:
101
+ Enabled: false
102
+
103
+ RSpec/Be:
104
+ Enabled: true
105
+
106
+ RSpec/BeforeAfterAll:
107
+ Enabled: true
108
+
109
+ RSpec/EmptyExampleGroup:
110
+ Enabled: true
111
+
112
+ RSpec/EmptyLineAfterExample:
113
+ Enabled: true
114
+
115
+ RSpec/EmptyLineAfterExampleGroup:
116
+ Enabled: true
117
+
118
+ RSpec/EmptyLineAfterFinalLet:
119
+ Enabled: true
120
+
121
+ RSpec/EmptyLineAfterHook:
122
+ Enabled: true
123
+
124
+ RSpec/EmptyLineAfterSubject:
125
+ Enabled: true
126
+
127
+ RSpec/HookArgument:
128
+ Enabled: true
129
+
130
+ RSpec/LeadingSubject:
131
+ Enabled: true
132
+
133
+ RSpec/NamedSubject:
134
+ Enabled: true
135
+
136
+ RSpec/ScatteredLet:
137
+ Enabled: true
138
+
139
+ RSpec/ScatteredSetup:
140
+ Enabled: true
141
+
142
+ Naming/MethodParameterName:
143
+ AllowedNames:
144
+ - rp
145
+
146
+ Security:
147
+ Enabled: true
148
+
149
+ Style/BlockComments:
150
+ Enabled: true
151
+
152
+ Style/CaseEquality:
153
+ Enabled: true
154
+
155
+ Style/ClassAndModuleChildren:
156
+ Enabled: true
157
+
158
+ Style/ClassMethods:
159
+ Enabled: true
160
+
161
+ Style/ClassVars:
162
+ Enabled: true
163
+
164
+ Style/CommentAnnotation:
165
+ Enabled: true
166
+
167
+ Style/ConditionalAssignment:
168
+ Enabled: true
169
+
170
+ Style/DefWithParentheses:
171
+ Enabled: true
172
+
173
+ Style/Dir:
174
+ Enabled: true
175
+
176
+ Style/EachForSimpleLoop:
177
+ Enabled: true
178
+
179
+ Style/EachWithObject:
180
+ Enabled: true
181
+
182
+ Style/EmptyBlockParameter:
183
+ Enabled: true
184
+
185
+ Style/EmptyCaseCondition:
186
+ Enabled: true
187
+
188
+ Style/EmptyElse:
189
+ Enabled: true
190
+
191
+ Style/EmptyLambdaParameter:
192
+ Enabled: true
193
+
194
+ Style/EmptyLiteral:
195
+ Enabled: true
196
+
197
+ Style/EvenOdd:
198
+ Enabled: true
199
+
200
+ Style/ExpandPathArguments:
201
+ Enabled: true
202
+
203
+ Style/For:
204
+ Enabled: true
205
+
206
+ Style/FrozenStringLiteralComment:
207
+ Enabled: true
208
+
209
+ Style/GlobalVars:
210
+ Enabled: true
211
+
212
+ Style/HashSyntax:
213
+ Enabled: true
214
+
215
+ Style/IdenticalConditionalBranches:
216
+ Enabled: true
217
+
218
+ Style/IfInsideElse:
219
+ Enabled: true
220
+
221
+ Style/InverseMethods:
222
+ Enabled: true
223
+
224
+ Style/MethodCallWithoutArgsParentheses:
225
+ Enabled: true
226
+
227
+ Style/MethodDefParentheses:
228
+ Enabled: true
229
+
230
+ Style/MultilineMemoization:
231
+ Enabled: true
232
+
233
+ Style/MutableConstant:
234
+ Enabled: true
235
+
236
+ Style/NestedParenthesizedCalls:
237
+ Enabled: true
238
+
239
+ Style/OptionalArguments:
240
+ Enabled: true
241
+
242
+ Style/ParenthesesAroundCondition:
243
+ Enabled: true
244
+
245
+ Style/RedundantBegin:
246
+ Enabled: true
247
+
248
+ Style/RedundantConditional:
249
+ Enabled: true
250
+
251
+ Style/RedundantException:
252
+ Enabled: true
253
+
254
+ Style/RedundantFreeze:
255
+ Enabled: true
256
+
257
+ Style/RedundantInterpolation:
258
+ Enabled: true
259
+
260
+ Style/RedundantParentheses:
261
+ Enabled: true
262
+
263
+ Style/RedundantPercentQ:
264
+ Enabled: true
265
+
266
+ Style/RedundantReturn:
267
+ Enabled: true
268
+
269
+ Style/RedundantSelf:
270
+ Enabled: true
271
+
272
+ Style/Semicolon:
273
+ Enabled: true
274
+
275
+ Style/SingleLineMethods:
276
+ Enabled: true
277
+
278
+ Style/SpecialGlobalVars:
279
+ Enabled: true
280
+
281
+ Style/SymbolLiteral:
282
+ Enabled: true
283
+
284
+ Style/TrailingBodyOnClass:
285
+ Enabled: true
286
+
287
+ Style/TrailingBodyOnMethodDefinition:
288
+ Enabled: true
289
+
290
+ Style/TrailingBodyOnModule:
291
+ Enabled: true
292
+
293
+ Style/TrailingMethodEndStatement:
294
+ Enabled: true
295
+
296
+ Style/TrivialAccessors:
297
+ Enabled: true
298
+
299
+ Style/UnpackFirst:
300
+ Enabled: true
301
+
302
+ Style/YodaCondition:
303
+ Enabled: true
304
+
305
+ Style/ZeroLengthPredicate:
306
+ Enabled: true