passageidentity 0.2.3 → 0.3.0

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 (104) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +21 -0
  3. data/README.md +18 -61
  4. data/docs/custom/AuthApi.md +141 -0
  5. data/docs/custom/ClientApi.md +107 -0
  6. data/docs/custom/UserApi.md +419 -0
  7. data/docs/generated/AppInfo.md +94 -0
  8. data/docs/generated/AppResponse.md +18 -0
  9. data/docs/generated/AppsApi.md +77 -0
  10. data/docs/generated/AuthMethods.md +22 -0
  11. data/docs/generated/CreateMagicLinkRequest.md +36 -0
  12. data/docs/generated/CreateUserRequest.md +22 -0
  13. data/docs/generated/ElementCustomization.md +56 -0
  14. data/docs/generated/FontFamily.md +15 -0
  15. data/docs/generated/LayoutConfig.md +26 -0
  16. data/docs/generated/Layouts.md +20 -0
  17. data/docs/generated/ListDevicesResponse.md +18 -0
  18. data/docs/generated/MagicLink.md +36 -0
  19. data/docs/generated/MagicLinkAuthMethod.md +22 -0
  20. data/docs/generated/MagicLinkChannel.md +15 -0
  21. data/docs/generated/MagicLinkResponse.md +18 -0
  22. data/docs/generated/MagicLinkType.md +15 -0
  23. data/docs/generated/MagicLinksApi.md +79 -0
  24. data/docs/generated/Model400Error.md +20 -0
  25. data/docs/generated/Model401Error.md +20 -0
  26. data/docs/generated/Model404Error.md +20 -0
  27. data/docs/generated/Model500Error.md +20 -0
  28. data/docs/generated/OtpAuthMethod.md +22 -0
  29. data/docs/generated/PasskeysAuthMethod.md +18 -0
  30. data/docs/generated/Technologies.md +15 -0
  31. data/docs/generated/TokensApi.md +78 -0
  32. data/docs/generated/TtlDisplayUnit.md +15 -0
  33. data/docs/generated/UpdateMagicLinkAuthMethod.md +22 -0
  34. data/docs/generated/UpdateOtpAuthMethod.md +22 -0
  35. data/docs/generated/UpdatePasskeysAuthMethod.md +18 -0
  36. data/docs/generated/UpdateUserRequest.md +22 -0
  37. data/docs/generated/UserDevicesApi.md +152 -0
  38. data/docs/generated/UserEventInfo.md +26 -0
  39. data/docs/generated/UserInfo.md +46 -0
  40. data/docs/generated/UserMetadataField.md +28 -0
  41. data/docs/generated/UserMetadataFieldType.md +15 -0
  42. data/docs/generated/UserResponse.md +18 -0
  43. data/docs/generated/UserStatus.md +15 -0
  44. data/docs/generated/UsersApi.md +440 -0
  45. data/docs/generated/WebAuthnDevices.md +34 -0
  46. data/docs/generated/WebAuthnIcons.md +20 -0
  47. data/docs/generated/WebAuthnType.md +15 -0
  48. data/generate.sh +31 -0
  49. data/lib/openapi_client/api/apps_api.rb +85 -0
  50. data/lib/openapi_client/api/magic_links_api.rb +96 -0
  51. data/lib/openapi_client/api/tokens_api.rb +91 -0
  52. data/lib/openapi_client/api/user_devices_api.rb +166 -0
  53. data/lib/openapi_client/api/users_api.rb +452 -0
  54. data/lib/openapi_client/api_client.rb +431 -0
  55. data/lib/openapi_client/api_error.rb +58 -0
  56. data/lib/openapi_client/configuration.rb +383 -0
  57. data/lib/openapi_client/models/app_info.rb +853 -0
  58. data/lib/openapi_client/models/app_response.rb +221 -0
  59. data/lib/openapi_client/models/auth_methods.rb +254 -0
  60. data/lib/openapi_client/models/create_magic_link_request.rb +374 -0
  61. data/lib/openapi_client/models/create_user_request.rb +234 -0
  62. data/lib/openapi_client/models/element_customization.rb +457 -0
  63. data/lib/openapi_client/models/font_family.rb +58 -0
  64. data/lib/openapi_client/models/layout_config.rb +285 -0
  65. data/lib/openapi_client/models/layouts.rb +241 -0
  66. data/lib/openapi_client/models/list_devices_response.rb +223 -0
  67. data/lib/openapi_client/models/magic_link.rb +387 -0
  68. data/lib/openapi_client/models/magic_link_auth_method.rb +302 -0
  69. data/lib/openapi_client/models/magic_link_channel.rb +40 -0
  70. data/lib/openapi_client/models/magic_link_response.rb +221 -0
  71. data/lib/openapi_client/models/magic_link_type.rb +40 -0
  72. data/lib/openapi_client/models/model400_error.rb +271 -0
  73. data/lib/openapi_client/models/model401_error.rb +271 -0
  74. data/lib/openapi_client/models/model404_error.rb +271 -0
  75. data/lib/openapi_client/models/model500_error.rb +271 -0
  76. data/lib/openapi_client/models/otp_auth_method.rb +302 -0
  77. data/lib/openapi_client/models/passkeys_auth_method.rb +228 -0
  78. data/lib/openapi_client/models/technologies.rb +46 -0
  79. data/lib/openapi_client/models/ttl_display_unit.rb +42 -0
  80. data/lib/openapi_client/models/update_magic_link_auth_method.rb +276 -0
  81. data/lib/openapi_client/models/update_otp_auth_method.rb +276 -0
  82. data/lib/openapi_client/models/update_passkeys_auth_method.rb +216 -0
  83. data/lib/openapi_client/models/update_user_request.rb +232 -0
  84. data/lib/openapi_client/models/user_event_info.rb +285 -0
  85. data/lib/openapi_client/models/user_info.rb +470 -0
  86. data/lib/openapi_client/models/user_metadata_field.rb +323 -0
  87. data/lib/openapi_client/models/user_metadata_field_type.rb +44 -0
  88. data/lib/openapi_client/models/user_response.rb +221 -0
  89. data/lib/openapi_client/models/user_status.rb +41 -0
  90. data/lib/openapi_client/models/web_authn_devices.rb +378 -0
  91. data/lib/openapi_client/models/web_authn_icons.rb +230 -0
  92. data/lib/openapi_client/models/web_authn_type.rb +41 -0
  93. data/lib/openapi_client/version.rb +15 -0
  94. data/lib/openapi_client.rb +74 -0
  95. data/lib/passageidentity/auth.rb +32 -5
  96. data/lib/passageidentity/client.rb +17 -121
  97. data/lib/passageidentity/user_api.rb +29 -131
  98. data/lib/passageidentity/version.rb +5 -0
  99. data/openapitools.json +7 -0
  100. data/passageidentity.gemspec +3 -1
  101. data/tests/auth_test.rb +6 -1
  102. data/tests/magic_link_test.rb +5 -4
  103. data/tests/user_api_test.rb +2 -2
  104. metadata +96 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0f38ac4af6f724f0c6a1a627dc2b0f03cf6ab7bb444eedccf31f34088913e892
4
- data.tar.gz: 671196153c6d5d8e91f9524e5e2766e81b9ba1fb34611949911d1b32852f276e
3
+ metadata.gz: f5fad890a1b4da5a9bda57cf0441dbfb76e7b5275c6e63b97ea001897f146847
4
+ data.tar.gz: f5008109d3d726a62312ee8ff85b008ecce5fc993b5f89d963cb44d0f7d21775
5
5
  SHA512:
6
- metadata.gz: 061e2fe45361d9b498ab76a3945ce88960fc78d1b465b6cc4a87e94ab954ec2e6abd8ad803941a38f62787e5cda9ff464d9b2b709455a846fa398942be728cef
7
- data.tar.gz: 92ed644ed4a7eeea9eca3219e8121c2ebd2ff16376603cc0daf15475223093cf36eae4f349297a51a668a3606e275018d6de0f74bd01cf4e78e595a8b5631f57
6
+ metadata.gz: 1beabd989e6a3357f42326c974cf61a118d8cc076be7ba2df4adccbcd0d90877c1052b03d331b3d20d6defc2d74c285ed38664943810358960dcfe02064431e3
7
+ data.tar.gz: 60811539a0ae157adcb4f4f4fcbab795bbd3041cbee5c80710a4793a95dae1d0485e9b68f58b24f3a02f1e6ccf8bd6a237d673d03305c65f43031fdac7cfc76e
data/CHANGELOG.md ADDED
@@ -0,0 +1,21 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ ## [0.3.0] - 2023-12-06
6
+
7
+ ### Added
8
+
9
+ - Generate types and api calls with openapi generator.
10
+ - Version constant instead of parsing gemspec.
11
+
12
+
13
+ ### Deprecate
14
+
15
+ - `user.signout()` -> `auth.revoke_user_refresh_tokens()`
16
+ - `auth.authenticate_request()` -> `auth.validate_jwt()`
17
+
18
+
19
+ ### Possible Breaking Changes
20
+
21
+ - Types are now generated. Previous type names may have changed. [See documentation](https://github.com/passageidentity/passage-ruby/tree/main/docs/generated) for model definitions.
data/README.md CHANGED
@@ -64,23 +64,6 @@ app_info = PassageClient.get_app()
64
64
 
65
65
  ```
66
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
- :require_identifier_verification,
78
- :session_timeout_length,
79
- :user_metadata_schema,
80
- :layouts,
81
- :auth_fallback_method,
82
- :auth_fallback_method_ttl
83
- ```
84
67
 
85
68
  ## Retrieve User Info
86
69
 
@@ -104,24 +87,6 @@ class ApplicationController < ActionController::Base
104
87
  end
105
88
  ```
106
89
 
107
- The information available in the Passage User struct returned by PassageClient.user.get(user_id:):
108
-
109
- ```ruby
110
- Struct.new :id,
111
- :status,
112
- :email,
113
- :phone,
114
- :email_verified,
115
- :phone_verified,
116
- :created_at,
117
- :updated_at,
118
- :last_login_at,
119
- :login_count,
120
- :recent_events,
121
- :webauthn,
122
- :webauthn_devices,
123
- :user_metadata,
124
- ```
125
90
 
126
91
  ## Activate/Deactivate User
127
92
 
@@ -179,18 +144,6 @@ PassageClient =
179
144
  devices = PassageClient.user.list_devices(user_id: user_id)
180
145
  ```
181
146
 
182
- The information available in the array of Passage Device struct returned by PassageClient.user.list_devices(user_id:):
183
-
184
- ```ruby
185
- Struct.new :id,
186
- :cred_id,
187
- :friendly_name,
188
- :usage_count,
189
- :updated_at,
190
- :created_at,
191
- :last_login_at,
192
-
193
- ```
194
147
 
195
148
  ## List User Devices
196
149
 
@@ -227,17 +180,21 @@ magic_link =
227
180
  )
228
181
  ```
229
182
 
230
- The information available in the Passage Magic Link struct returned this method is below:
231
-
232
- ```ruby
233
- Struct.new :id,
234
- :secret,
235
- :activated,
236
- :user_id,
237
- :app_id,
238
- :identifier,
239
- :type,
240
- :redirect_url,
241
- :ttl,
242
- :url
243
- ```
183
+ ## Available Functions
184
+
185
+
186
+ Class | Method | Description
187
+ ------------ | ------------- | -------------
188
+ *ClientApi* | [**get_app**](docs/custom/ClientApi.md#get_app) | Get App
189
+ *ClientApi* | [**create_magic_link**](docs/custom/Passage/ClientApi.md#create_magic_link) | Create Embeddable Magic Link
190
+ *AuthApi* | [**auth.authenticate_request**](docs/custom/AuthApi.md#authenticate_request) | Validates user jwt token
191
+ *AuthApi* | [**auth.validate_jwt**](docs/custom/AuthApi.md#validate_jwt) | Validates user jwt token
192
+ *UserAPI* | [**user.delete_device**](docs/custom/UserApi.md#delete_device) | Delete a device for a user
193
+ *UserAPI* | [**user.list_devices**](docs/custom/UserApi.md#list_devices) | List User Devices
194
+ *UserAPI* | [**user.activate**](docs/custom/UserApi.md#activate) | Activate User
195
+ *UserAPI* | [**user.create**](docs/custom/UserApi.md#create) | Create User
196
+ *UserAPI* | [**user.deactivate**](docs/custom/UserApi.md#deactivate) | Deactivate User
197
+ *UserAPI* | [**user.delete**](docs/custom/UserApi.md#delete) | Delete User
198
+ *UserAPI* | [**user.get**](docs/custom/UserApi.md#get) | Get User
199
+ *UserAPI* | [**user.update**](docs/custom/UserApi.md#update) | Update User
200
+ *UserAPI* | [**user.signout**](docs/custom/UserApi.md#signout) | Signout User
@@ -0,0 +1,141 @@
1
+ # Passage::AuthApi
2
+
3
+ All URIs are relative to *https://api.passage.id/v1*
4
+
5
+ | Method | Description |
6
+ | ------ | ----------- |
7
+ | [**authenticate_request**](AuthApi.md#authenticate_request) | **Deprecated:** Revokes refresh tokens |
8
+ | [**revoke_user_refresh_tokens**](AuthApi.md#revoke_user_refresh_tokens) | Revokes user tokens |
9
+ | [**validate_jwt**](AuthApi.md#validate_jwt) | Validates jwt token
10
+
11
+
12
+ ---
13
+
14
+ ## authenticate_request (deprecated)
15
+
16
+ > authenticate_request(request)
17
+
18
+ Validates that request has the correct jwt token
19
+
20
+
21
+ ### Examples
22
+
23
+ ```ruby
24
+ require 'passageidentity'
25
+
26
+ class ApplicationController < ActionController::Base
27
+ PassageClient = Passage::Client.new(app_id: PASSAGE_APP_ID, api_key: PASSAGE_API_KEY)
28
+
29
+ def authorize!
30
+ begin
31
+ request.to_hash()
32
+ @user_id = Passage.auth.authenticate_request(request)
33
+ session[:psg_user_id] = @user_id
34
+ rescue Exception => e
35
+ # unauthorized
36
+ redirect_to "/unauthorized"
37
+ end
38
+ end
39
+ end
40
+ ```
41
+
42
+ ### Parameters
43
+
44
+ | Name | Type | Description | Notes |
45
+ | ---- | ---- | ----------- | ----- |
46
+ | **request** | **RequestObject** | request | |
47
+
48
+ ### Return type
49
+
50
+ [**UserInfo**](UserInfo.md)
51
+
52
+ ### Authorization
53
+
54
+ [bearerAuth](../README.md#bearerAuth)
55
+
56
+
57
+ ---
58
+
59
+ ## revoke_user_refresh_tokens()
60
+
61
+ > revoke_user_refresh_tokens(user_id)
62
+
63
+ Revokes user tokens
64
+
65
+ ### Examples
66
+
67
+ ```ruby
68
+ require 'passageidentity'
69
+
70
+ class ApplicationController < ActionController::Base
71
+ PassageClient = Passage::Client.new(app_id: PASSAGE_APP_ID, api_key: PASSAGE_API_KEY)
72
+
73
+ def authorize!
74
+ begin
75
+ revoke = PassageClient.auth.revoke_user_refresh_tokens(USER_ID)
76
+ rescue Exception => e
77
+ # handle exception (user is not authorized)
78
+ # unauthorized
79
+ redirect_to "/unauthorized"
80
+ end
81
+ end
82
+ end
83
+ ```
84
+
85
+ ### Parameters
86
+
87
+ | Name | Type | Description | Notes |
88
+ | ---- | ---- | ----------- | ----- |
89
+ | **user_id** | **string** | user id | |
90
+
91
+ ### Return type
92
+
93
+ boolean
94
+
95
+ ### Authorization
96
+
97
+ [bearerAuth](../README.md#bearerAuth)
98
+
99
+
100
+
101
+ ---
102
+
103
+ ## validate_jwt
104
+
105
+ > validate_jwt(token)
106
+
107
+ Validates jwt token for a user
108
+
109
+ ### Examples
110
+
111
+ ```ruby
112
+ require 'passageidentity'
113
+
114
+ class ApplicationController < ActionController::Base
115
+ PassageClient = Passage::Client.new(app_id: PASSAGE_APP_ID, api_key: PASSAGE_API_KEY)
116
+
117
+ def validate_passage_user!
118
+ begin
119
+ # tokens are revoked
120
+ revoke = PassageClient.auth.validate_jwt(token)
121
+ rescue Exception => e
122
+ # handle exception (user is not authorized)
123
+ end
124
+ end
125
+ end
126
+ ```
127
+
128
+ ### Parameters
129
+
130
+ | Name | Type | Description | Notes |
131
+ | ---- | ---- | ----------- | ----- |
132
+ | **token** | **String** | jwt token | |
133
+
134
+ ### Return type
135
+
136
+ [**UserInfo**](UserInfo.md)
137
+
138
+ ### Authorization
139
+
140
+ [bearerAuth](../README.md#bearerAuth)
141
+
@@ -0,0 +1,107 @@
1
+ # Passage::ClientApi
2
+
3
+ All URIs are relative to *https://api.passage.id/v1*
4
+
5
+ | Method | HTTP request | Description |
6
+ | ------ | ------------ | ----------- |
7
+ | [**get_app**](ClientApi.md#get_app) | **GET** /apps/{app_id} | Get App |
8
+ | [**create_magic_link**](ClientApi.md#create_magic_link) | **POST** /apps/{app_id}/magic-links | Create Embeddable Magic Link |
9
+
10
+
11
+ ## get_app
12
+
13
+ > <AppResponse> get_app()
14
+
15
+ Get App
16
+
17
+ Get app information.
18
+
19
+ ### Examples
20
+
21
+ ```ruby
22
+ PassageClient = Passage::Client.new(app_id: PASSAGE_APP_ID, api_key: PASSAGE_API_KEY)
23
+
24
+ begin
25
+ # Get App
26
+ result = PassageClient.get_app()
27
+ p result
28
+ rescue OpenapiClient::ApiError => e
29
+ puts "Error when calling AppsApi->get_app: #{e}"
30
+ end
31
+ ```
32
+
33
+
34
+ ### Parameters
35
+
36
+ | Name | Type | Description | Notes |
37
+ | ---- | ---- | ----------- | ----- |
38
+ | **app_id** | **String** | App ID | |
39
+
40
+ ### Return type
41
+
42
+ [**AppResponse**](AppResponse.md)
43
+
44
+ ### Authorization
45
+
46
+ [bearerAuth](../README.md#bearerAuth)
47
+
48
+ ### HTTP request headers
49
+
50
+ - **Content-Type**: Not defined
51
+ - **Accept**: application/json
52
+
53
+ ---
54
+
55
+
56
+ ## create_magic_link
57
+
58
+ > <MagicLinkResponse> create_magic_link(create_magic_link_request)
59
+
60
+ Create Embeddable Magic Link
61
+
62
+ Create magic link for a user.
63
+
64
+ ### Examples
65
+
66
+ ```ruby
67
+ PassageClient = Passage::Client.new(app_id: PASSAGE_APP_ID, api_key: PASSAGE_API_KEY)
68
+
69
+ api_instance = PassageClient.create_magic_link()
70
+
71
+ create_magic_link_request = OpenapiClient::create_magic_link({channel: OpenapiClient::MagicLinkChannel::EMAIL, email: 'email_example', magic_link_path: 'magic_link_path_example', phone: 'phone_example', redirect_url: 'redirect_url_example', _send: false, ttl: 37, user_id: 'user_id_example'}) # CreateMagicLinkRequest | magic link request
72
+
73
+ begin
74
+ # Create Embeddable Magic Link
75
+ result = PassageClient.create_magic_link.create_magic_link(create_magic_link_request)
76
+ p result
77
+ rescue OpenapiClient::ApiError => e
78
+ puts "Error when calling MagicLinksApi->create_magic_link: #{e}"
79
+ end
80
+ ```
81
+
82
+ #### Using the create_magic_link_with_http_info variant
83
+
84
+ This returns an Array which contains the response data, status code and headers.
85
+
86
+ > <Array(<MagicLinkResponse>, Integer, Hash)> create_magic_link_with_http_info(app_id, create_magic_link_request)
87
+
88
+
89
+ ### Parameters
90
+
91
+ | Name | Type | Description | Notes |
92
+ | ---- | ---- | ----------- | ----- |
93
+ | **create_magic_link_request** | [**CreateMagicLinkRequest**](CreateMagicLinkRequest.md) | magic link request | |
94
+
95
+ ### Return type
96
+
97
+ [**MagicLinkResponse**](MagicLinkResponse.md)
98
+
99
+ ### Authorization
100
+
101
+ [bearerAuth](../README.md#bearerAuth)
102
+
103
+ ### HTTP request headers
104
+
105
+ - **Content-Type**: application/json
106
+ - **Accept**: application/json
107
+