passkeys-rails 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/app/models/concerns/passkeys_rails/authenticatable.rb +1 -0
- data/lib/passkeys-rails.rb +12 -1
- data/lib/passkeys_rails/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 666859b1227428b580202f3c2f9822cf937db0ecaf26381dddefd45b6d8e9b3e
|
4
|
+
data.tar.gz: 7cbce30a6f2efb7eb15aa4a747156da1e355c795ca346fdc8af2ecad6af837d6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d0bff5cc099209252fa1853c9e75e8f23edce8de4ac910f2e958e9279ec81a4452074fa6611d42424e4809fc010a129072e7d719e9de8b4e0a3e40e7619ad7f9
|
7
|
+
data.tar.gz: 98e62cd971c37781aecadc0dbe09b1c32d6aa2e0837f24c816971c660d8d00c19c738a339a43f021a4a27e843b79b04b3128f65f7ff21b971289fa232dd0df75
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
[![Gem Version](https://badge.fury.io/rb/passkeys-rails.svg?cachebust=
|
1
|
+
[![Gem Version](https://badge.fury.io/rb/passkeys-rails.svg?cachebust=0.2.1)](https://badge.fury.io/rb/passkeys-rails)
|
2
2
|
[![Build Status](https://app.travis-ci.com/alliedcode/passkeys-rails.svg?branch=main)](https://travis-ci.org/alliedcode/passkeys-rails)
|
3
3
|
[![codecov](https://codecov.io/gh/alliedcode/passkeys-rails/branch/main/graph/badge.svg?token=UHSNJDUL21)](https://codecov.io/gh/alliedcode/passkeys-rails)
|
4
4
|
|
data/lib/passkeys-rails.rb
CHANGED
@@ -53,6 +53,8 @@ module PasskeysRails
|
|
53
53
|
|
54
54
|
# Returns an Interactor::Context that indicates if the request is authentic.
|
55
55
|
#
|
56
|
+
# `request` can be a String on an Http Request
|
57
|
+
#
|
56
58
|
# .success? is true if authentic
|
57
59
|
# .agent is the Passkey::Agent on success
|
58
60
|
#
|
@@ -60,10 +62,19 @@ module PasskeysRails
|
|
60
62
|
# .code is the error code on failure
|
61
63
|
# .message is the human readable error message on failure
|
62
64
|
def self.authenticate(request)
|
63
|
-
|
65
|
+
auth_token = if request.is_a?(String)
|
66
|
+
request
|
67
|
+
elsif request.respond_to?(:headers)
|
68
|
+
request.headers['X-Auth']
|
69
|
+
else
|
70
|
+
""
|
71
|
+
end
|
72
|
+
|
73
|
+
PasskeysRails::ValidateAuthToken.call(auth_token:)
|
64
74
|
end
|
65
75
|
|
66
76
|
# Raises a PasskeysRails::Error exception if the request is not authentic.
|
77
|
+
# `request` can be a String on an Http Request
|
67
78
|
def self.authenticate!(request)
|
68
79
|
auth = authenticate(request)
|
69
80
|
return if auth.success?
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: passkeys-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Troy Anderson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-07-
|
11
|
+
date: 2023-07-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|