passageidentity 0.0.5 → 0.0.8
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/CONTRIBUTING.md +1 -1
- data/README.md +34 -2
- data/lib/passageidentity/auth.rb +0 -2
- data/lib/passageidentity/client.rb +41 -1
- data/lib/passageidentity/user_api.rb +3 -1
- data/passageidentity.gemspec +1 -1
- data/tests/app_test.rb +15 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 28dadc05eb922f886ce714f7cdeea5500441e1b218527b5c0876938a13745555
|
4
|
+
data.tar.gz: cfca8d3aa6ffd7b11896c7c4ad01fbeea19e5e8eb9d4338bf74f99a599c36fb0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b94421e84f5249bb7a04d3b1d0faf7a034a02a8608210a9c2457e9f62c960ff9cf898405ab8819433cbdcf868f07c7180e57d0e9d4d8c5afb3a1d71e8311548b
|
7
|
+
data.tar.gz: 76948a35ec51da50061f2e3fbef13f8df68f99994635d60bcb3d301d5bd9c89b07f50739b0e056a9b61ce0606a56394009a5924b936af4c9a137979674f70859
|
data/CONTRIBUTING.md
CHANGED
data/README.md
CHANGED
@@ -51,6 +51,36 @@ class ApplicationController < ActionController::Base
|
|
51
51
|
end
|
52
52
|
```
|
53
53
|
|
54
|
+
## Retrieve App Info
|
55
|
+
|
56
|
+
To retrieve information about an app , you should use the `get_app` method.
|
57
|
+
|
58
|
+
```ruby
|
59
|
+
require 'passageidentity'
|
60
|
+
|
61
|
+
PassageClient =
|
62
|
+
Passage::Client.new(app_id: PASSAGE_APP_ID)
|
63
|
+
app_info = PassageClient.get_app()
|
64
|
+
|
65
|
+
```
|
66
|
+
|
67
|
+
The information available in the Passage App struct returned by PassageClient.get_app():
|
68
|
+
|
69
|
+
```ruby
|
70
|
+
Struct.new :name,
|
71
|
+
:id,
|
72
|
+
:auth_origin,
|
73
|
+
:redirect_url,
|
74
|
+
:login_url,
|
75
|
+
:rsa_public_key,
|
76
|
+
:allowed_identifer,
|
77
|
+
:required_identifier,
|
78
|
+
:require_email_verification,
|
79
|
+
:session_timeout_length,
|
80
|
+
:user_metadata_schema,
|
81
|
+
:layouts,
|
82
|
+
```
|
83
|
+
|
54
84
|
## Retrieve User Info
|
55
85
|
|
56
86
|
To retrieve information about a user, you should use the `get` method. You will need to use a Passage API key, which can be created in the Passage Console under your Application Settings. This API key grants your web server access to the Passage management APIs to get and update information about users. This API key must be protected and stored in an appropriate secure storage location. It should never be hard-coded in the repository.
|
@@ -154,7 +184,9 @@ The information available in the array of Passage Device struct returned by Pass
|
|
154
184
|
:cred_id,
|
155
185
|
:friendly_name,
|
156
186
|
:usage_count,
|
157
|
-
:
|
187
|
+
:updated_at,
|
188
|
+
:created_at,
|
189
|
+
:last_login_at,
|
158
190
|
|
159
191
|
```
|
160
192
|
|
@@ -175,7 +207,7 @@ end
|
|
175
207
|
|
176
208
|
## Create an Embeddable Magic Link
|
177
209
|
|
178
|
-
To create a magic link, you should use the `create_magic_link` method. You can check out our guide on embeddable magic links in our [docs](https://docs.passage.id/
|
210
|
+
To create a magic link, you should use the `create_magic_link` method. You can check out our guide on embeddable magic links in our [docs](https://docs.passage.id/guides/embedded-links).
|
179
211
|
|
180
212
|
```ruby
|
181
213
|
require 'passageidentity'
|
data/lib/passageidentity/auth.rb
CHANGED
@@ -5,6 +5,20 @@ require_relative "user_api"
|
|
5
5
|
require_relative "error"
|
6
6
|
|
7
7
|
module Passage
|
8
|
+
App =
|
9
|
+
Struct.new :name,
|
10
|
+
:id,
|
11
|
+
:auth_origin,
|
12
|
+
:redirect_url,
|
13
|
+
:login_url,
|
14
|
+
:rsa_public_key,
|
15
|
+
:allowed_identifer,
|
16
|
+
:required_identifier,
|
17
|
+
:require_email_verification,
|
18
|
+
:session_timeout_length,
|
19
|
+
:user_metadata_schema,
|
20
|
+
:layouts,
|
21
|
+
keyword_init: true
|
8
22
|
User =
|
9
23
|
Struct.new :id,
|
10
24
|
:status,
|
@@ -37,7 +51,9 @@ module Passage
|
|
37
51
|
:cred_id,
|
38
52
|
:friendly_name,
|
39
53
|
:usage_count,
|
40
|
-
:
|
54
|
+
:updated_at,
|
55
|
+
:created_at,
|
56
|
+
:last_login_at,
|
41
57
|
keyword_init: true
|
42
58
|
|
43
59
|
COOKIE_STRATEGY = 0
|
@@ -98,6 +114,30 @@ module Passage
|
|
98
114
|
end
|
99
115
|
end
|
100
116
|
|
117
|
+
def get_app()
|
118
|
+
begin
|
119
|
+
app_info = @auth.fetch_app()
|
120
|
+
return(
|
121
|
+
Passage::App.new(
|
122
|
+
name: app_info["name"],
|
123
|
+
id: app_info["id"],
|
124
|
+
auth_origin: app_info["auth_origin"],
|
125
|
+
redirect_url: app_info["redirect_url"],
|
126
|
+
login_url: app_info["login_url"],
|
127
|
+
rsa_public_key: app_info["rsa_public_key"],
|
128
|
+
allowed_identifer: app_info["allowed_identifer"],
|
129
|
+
required_identifier: app_info["required_identifier"],
|
130
|
+
require_email_verification: app_info["require_email_verification"],
|
131
|
+
session_timeout_length: app_info["session_timeout_length"],
|
132
|
+
user_metadata_schema: app_info["user_metadata_schema"],
|
133
|
+
layouts: app_info["layouts"]
|
134
|
+
)
|
135
|
+
)
|
136
|
+
rescue => e
|
137
|
+
raise e
|
138
|
+
end
|
139
|
+
end
|
140
|
+
|
101
141
|
def create_magic_link(
|
102
142
|
user_id: "",
|
103
143
|
email: "",
|
@@ -227,7 +227,9 @@ module Passage
|
|
227
227
|
cred_id: device["cred_id"],
|
228
228
|
friendly_name: device["friendly_name"],
|
229
229
|
usage_count: device["usage_count"],
|
230
|
-
|
230
|
+
updated_at: device["updated_at"],
|
231
|
+
created_at: device["created_at"],
|
232
|
+
last_login_at: device["last_login_at"]
|
231
233
|
)
|
232
234
|
)
|
233
235
|
end
|
data/passageidentity.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'passageidentity'
|
3
|
-
s.version = '0.0.
|
3
|
+
s.version = '0.0.8'
|
4
4
|
s.summary = 'Passage SDK for biometric authentication'
|
5
5
|
s.description =
|
6
6
|
'Enables verification of server-side authentication and user management for applications using Passage'
|
data/tests/app_test.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
require_relative "../lib/passageidentity/client"
|
2
|
+
require "dotenv"
|
3
|
+
require "faraday"
|
4
|
+
require "test/unit"
|
5
|
+
|
6
|
+
Dotenv.load(".env")
|
7
|
+
class TestAppAPI < Test::Unit::TestCase
|
8
|
+
PassageClient =
|
9
|
+
Passage::Client.new(app_id: ENV["APP_ID"], api_key: ENV["API_KEY"])
|
10
|
+
|
11
|
+
def test_get_app()
|
12
|
+
app = PassageClient.get_app()
|
13
|
+
assert_equal ENV["APP_ID"], app.id
|
14
|
+
end
|
15
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: passageidentity
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Passage Identity
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-07-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -92,6 +92,7 @@ files:
|
|
92
92
|
- lib/passageidentity/user_api.rb
|
93
93
|
- passageidentity.gemspec
|
94
94
|
- tests/all.rb
|
95
|
+
- tests/app_test.rb
|
95
96
|
- tests/auth_test.rb
|
96
97
|
- tests/magic_link_test.rb
|
97
98
|
- tests/user_api_test.rb
|