didit-sdk 2.10.0 → 2.12.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +18 -0
- data/README.md +6 -1
- data/lib/didit/authentication/agent_consent_request.rb +76 -0
- data/lib/didit/authentication/types.rb +58 -0
- data/lib/didit/authentication.rb +49 -3
- data/lib/didit/resources/account.rb +26 -2
- data/lib/didit/resources/sandbox.rb +33 -0
- data/lib/didit/resources/sessions.rb +31 -5
- data/lib/didit/resources/travel_rule.rb +16 -3
- data/lib/didit/resources/wallet_screening.rb +16 -1
- data/lib/didit/resources.rb +6 -0
- data/lib/didit/types/account_components.rb +1 -0
- data/lib/didit/types/components.rb +270 -0
- data/lib/didit/types.rb +26 -0
- data/lib/didit/version.rb +1 -1
- data/sig/didit/authentication/agent_consent_request.rbs +19 -0
- data/sig/didit/authentication/types.rbs +26 -0
- data/sig/didit/authentication.rbs +7 -1
- data/sig/didit/resources/account.rbs +2 -2
- data/sig/didit/resources/sandbox.rbs +9 -0
- data/sig/didit/resources/sessions.rbs +1 -1
- data/sig/didit/resources/travel_rule.rbs +2 -2
- data/sig/didit/resources/wallet_screening.rbs +2 -2
- data/sig/didit/resources.rbs +1 -0
- data/sig/didit/types/account.rbs +2 -2
- data/sig/didit/types/account_components.rbs +1 -0
- data/sig/didit/types/components.rbs +253 -1
- data/sig/didit/types/sessions.rbs +1 -1
- data/sig/didit/types/travel_rule.rbs +2 -2
- metadata +5 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d237908b8d26f01a2c1b1f240404560f0840a60580942d4541504485c5e89d80
|
|
4
|
+
data.tar.gz: 6ec80811d16ada1ca9e3dea375c23d30424bbf133cc56c195d241304b49031b5
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d446e8d8b357ace21eec7c8787ae8e779209a221bd568ac06afdb5963e112fcf915b5c59940ae96fe3ff289662af30fda2934a00b961f3e148faeefcc0dbd017
|
|
7
|
+
data.tar.gz: '0905abc26c9270edae21957afd9eb9854c976e070894c072148159e8cfbd66760177c85f395233ddf3436bbcecfb0a0aab42eb5f78ba6f022bc77bd158002288'
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [2.12.0](https://github.com/didit-protocol/sdk-ruby/compare/v2.11.0...v2.12.0) (2026-11-11)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* **spec:** sync API spec 2026-11-11 ([99ec1de](https://github.com/didit-protocol/sdk-ruby/commit/99ec1de70b9b7741f5c3fce5e423b55d8e34d86e))
|
|
9
|
+
|
|
10
|
+
## [2.11.0](https://github.com/didit-protocol/sdk-ruby/compare/v2.10.0...v2.11.0) (2026-11-11)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Features
|
|
14
|
+
|
|
15
|
+
* **spec:** sync API spec 2026-11-11 ([8583597](https://github.com/didit-protocol/sdk-ruby/commit/85835972757c41b3b5064740c5b70d8da5633404))
|
|
16
|
+
* **spec:** sync API spec 2026-11-11 ([cc2310f](https://github.com/didit-protocol/sdk-ruby/commit/cc2310fc48ddd062481703c4760227fe31105105))
|
|
17
|
+
* **spec:** sync API spec 2026-11-11 ([dd254dc](https://github.com/didit-protocol/sdk-ruby/commit/dd254dc3c4d46b601b6e64669f452216fc3a1115))
|
|
18
|
+
* **spec:** sync API spec 2026-11-11 ([7c675d5](https://github.com/didit-protocol/sdk-ruby/commit/7c675d5ed4adbdb6443bb765bdd2fb164004a907))
|
|
19
|
+
* **spec:** sync API spec 2026-11-11 ([4e1b076](https://github.com/didit-protocol/sdk-ruby/commit/4e1b07650dfc74f5ad69dfb7668051e76af0c31d))
|
|
20
|
+
|
|
3
21
|
## [2.10.0](https://github.com/didit-protocol/sdk-ruby/compare/v2.9.0...v2.10.0) (2026-11-11)
|
|
4
22
|
|
|
5
23
|
|
data/README.md
CHANGED
|
@@ -199,7 +199,7 @@ Webhooks `transaction.created`, `transaction.status.updated` and `travel_rule.st
|
|
|
199
199
|
|
|
200
200
|
## Authentication
|
|
201
201
|
|
|
202
|
-
Didit Authentication gives your application an OpenID Connect issuer for your users. The `Didit::Authentication` module is for your backend: it verifies the tokens your frontend sends, exchanges codes, refreshes tokens, checks sessions
|
|
202
|
+
Didit Authentication gives your application an OpenID Connect issuer for your users. The `Didit::Authentication` module is for your backend: it verifies the tokens your frontend sends, exchanges codes, refreshes tokens, checks sessions, creates step-up verifications and approves or denies agent access requests. It never uses the API key.
|
|
203
203
|
|
|
204
204
|
```ruby
|
|
205
205
|
auth = Didit::Authentication.new("https://acme.auth.didit.me", client_id: ENV["DIDIT_APPLICATION_ID"])
|
|
@@ -218,6 +218,11 @@ auth.get_session(access_token) # instant revocation c
|
|
|
218
218
|
auth.revoke_session(access_token)
|
|
219
219
|
step_up = auth.create_step_up(access_token, action: "payout", amount: "250.00", currency: "EUR", return_to: url)
|
|
220
220
|
auth.retrieve_step_up(access_token, step_up.id).approved? # act only on status "approved"
|
|
221
|
+
|
|
222
|
+
options = auth.create_agent_approval_options(access_token, challenge: agent_challenge).options # WebAuthn options for the browser
|
|
223
|
+
consent = auth.submit_agent_consent(access_token, challenge: agent_challenge, decision: "approve", assertion: assertion,
|
|
224
|
+
scopes: ["read"], organization_ids: [org_id], lifetime: 86_400)
|
|
225
|
+
consent.approved? ? consent.code : consent.denied? # the agent request secret (challenge) is never logged
|
|
221
226
|
```
|
|
222
227
|
|
|
223
228
|
Discovery and keys are fetched on first use and cached as the issuer's `Cache-Control` says; an unknown key id triggers at most one refetch per minute.
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Didit
|
|
4
|
+
class Authentication
|
|
5
|
+
# Builds and checks the body of +POST agents/consent/+, and names the strings of it that
|
|
6
|
+
# must never reach an error message: the challenge and the assertion's response members.
|
|
7
|
+
#
|
|
8
|
+
# @api private
|
|
9
|
+
module AgentConsentRequest
|
|
10
|
+
CONSENT_PATH = "/agents/consent/"
|
|
11
|
+
OPTIONS_PATH = "/agents/consent/passkey/"
|
|
12
|
+
UUID = /\A[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\z/i
|
|
13
|
+
LIFETIMES = [86_400, 604_800, 2_592_000].freeze
|
|
14
|
+
DECISIONS = %w[approve deny].freeze
|
|
15
|
+
# The assertion members that are secrets.
|
|
16
|
+
ASSERTION_SECRETS = %w[clientDataJSON authenticatorData signature userHandle].freeze
|
|
17
|
+
|
|
18
|
+
# @return [Array(Hash, Array<String>)] the JSON body and its secret strings
|
|
19
|
+
# @raise [Didit::ConfigurationError]
|
|
20
|
+
def self.build(challenge, decision, assertion, scopes, extras = {})
|
|
21
|
+
decision = decision.to_s
|
|
22
|
+
unless DECISIONS.include?(decision)
|
|
23
|
+
raise ConfigurationError, "decision must be \"approve\" or \"deny\", got #{decision.inspect}."
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
# @type var body: Hash[String, untyped]
|
|
27
|
+
body = { "challenge" => challenge, "decision" => decision }
|
|
28
|
+
secrets = [challenge]
|
|
29
|
+
unless assertion.nil?
|
|
30
|
+
body["assertion"] = checked_assertion(assertion)
|
|
31
|
+
secrets.concat(assertion_secrets(assertion))
|
|
32
|
+
end
|
|
33
|
+
body["scopes"] = checked_scopes(scopes) unless scopes.nil?
|
|
34
|
+
organization_ids = extras[:organization_ids]
|
|
35
|
+
lifetime = extras[:lifetime]
|
|
36
|
+
body["organization_ids"] = checked_organization_ids(organization_ids) unless organization_ids.nil?
|
|
37
|
+
body["lifetime"] = checked_lifetime(lifetime) unless lifetime.nil?
|
|
38
|
+
[body, secrets]
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def self.checked_organization_ids(ids)
|
|
42
|
+
valid = ids.is_a?(Array) && ids.size <= 100 && ids.all? { |id| id.is_a?(String) && UUID.match?(id) }
|
|
43
|
+
return ids if valid
|
|
44
|
+
|
|
45
|
+
raise ConfigurationError, "organization_ids must be an array of at most 100 UUID strings."
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def self.checked_lifetime(lifetime)
|
|
49
|
+
return lifetime if LIFETIMES.include?(lifetime)
|
|
50
|
+
|
|
51
|
+
raise ConfigurationError, "lifetime must be one of #{LIFETIMES.join(", ")} (seconds), got #{lifetime.inspect}."
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
def self.checked_assertion(assertion)
|
|
55
|
+
return assertion if assertion.is_a?(Hash)
|
|
56
|
+
|
|
57
|
+
raise ConfigurationError, "assertion must be a Hash (the JSON-serialised WebAuthn assertion)."
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
def self.checked_scopes(scopes)
|
|
61
|
+
return scopes if scopes.is_a?(Array) && !scopes.empty? && scopes.all? { |s| s.is_a?(String) && !s.empty? }
|
|
62
|
+
|
|
63
|
+
raise ConfigurationError, "scopes must be a non-empty array of strings such as [\"read\", \"act\"]."
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
def self.assertion_secrets(assertion)
|
|
67
|
+
response = assertion["response"] || assertion[:response]
|
|
68
|
+
return [] unless response.is_a?(Hash)
|
|
69
|
+
|
|
70
|
+
response.filter_map do |key, value|
|
|
71
|
+
value if ASSERTION_SECRETS.include?(key.to_s) && value.is_a?(String) && !value.empty?
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
end
|
|
@@ -171,5 +171,63 @@ module Didit
|
|
|
171
171
|
status == "approved"
|
|
172
172
|
end
|
|
173
173
|
end
|
|
174
|
+
|
|
175
|
+
# +POST agents/consent/+: the outcome of an approval or a denial. The API's answer
|
|
176
|
+
# has no shared discriminator: an approval carries +code+, +redirect_uri+ and +state+,
|
|
177
|
+
# a denial only +status+ "denied". It never carries an access or refresh token.
|
|
178
|
+
# {#inspect} leaves the code out; never log it.
|
|
179
|
+
class AgentConsent < Model
|
|
180
|
+
# The single-use agent authorization code (valid 60 seconds), on approval.
|
|
181
|
+
field :code, "code", :string
|
|
182
|
+
# The registered redirect URI of the agent request, on approval.
|
|
183
|
+
field :redirect_uri, "redirect_uri", :string
|
|
184
|
+
# The state of the agent request, on approval.
|
|
185
|
+
field :state, "state", :string
|
|
186
|
+
# "denied", on denial.
|
|
187
|
+
field :status, "status", :string
|
|
188
|
+
|
|
189
|
+
# True when the person approved: the response carries a code.
|
|
190
|
+
def approved?
|
|
191
|
+
!code.nil?
|
|
192
|
+
end
|
|
193
|
+
|
|
194
|
+
# True when the person denied: status "denied".
|
|
195
|
+
def denied?
|
|
196
|
+
status == "denied"
|
|
197
|
+
end
|
|
198
|
+
|
|
199
|
+
def inspect
|
|
200
|
+
shown = raw_data.to_h { |key, value| [key, key == "code" && value ? "[redacted]" : value] }
|
|
201
|
+
"#<#{self.class.name} #{shown.inspect}>"
|
|
202
|
+
end
|
|
203
|
+
alias to_s inspect
|
|
204
|
+
end
|
|
205
|
+
|
|
206
|
+
# One passkey the approving person may use, in {AgentWebAuthnOptions#allow_credentials}.
|
|
207
|
+
class AgentCredentialDescriptor < Model
|
|
208
|
+
# Base64url credential id.
|
|
209
|
+
field :id, "id", :string
|
|
210
|
+
# "public-key"
|
|
211
|
+
field :type, "type", :string
|
|
212
|
+
end
|
|
213
|
+
|
|
214
|
+
# WebAuthn request options: pass them as +publicKey+ to +navigator.credentials.get()+
|
|
215
|
+
# after decoding the binary fields.
|
|
216
|
+
class AgentWebAuthnOptions < Model
|
|
217
|
+
# Base64url challenge, bound to this approval and valid for less than 300 seconds.
|
|
218
|
+
field :challenge, "challenge", :string
|
|
219
|
+
# Sent by the API as +rpId+.
|
|
220
|
+
field :rp_id, "rpId", :string
|
|
221
|
+
# Browser timeout in milliseconds.
|
|
222
|
+
field :timeout, "timeout", :integer
|
|
223
|
+
# "required"
|
|
224
|
+
field :user_verification, "userVerification", :string
|
|
225
|
+
field :allow_credentials, "allowCredentials", [:array, AgentCredentialDescriptor]
|
|
226
|
+
end
|
|
227
|
+
|
|
228
|
+
# +POST agents/consent/passkey/+: the WebAuthn options for approving with a passkey.
|
|
229
|
+
class AgentApprovalOptions < Model
|
|
230
|
+
field :options, "options", AgentWebAuthnOptions
|
|
231
|
+
end
|
|
174
232
|
end
|
|
175
233
|
end
|
data/lib/didit/authentication.rb
CHANGED
|
@@ -13,6 +13,7 @@ require_relative "authentication/jws"
|
|
|
13
13
|
require_relative "authentication/key_set"
|
|
14
14
|
require_relative "authentication/cache"
|
|
15
15
|
require_relative "authentication/http"
|
|
16
|
+
require_relative "authentication/agent_consent_request"
|
|
16
17
|
|
|
17
18
|
module Didit
|
|
18
19
|
# Didit Authentication for your backend (docs/DESIGN.md section 10): verify the
|
|
@@ -31,7 +32,7 @@ module Didit
|
|
|
31
32
|
# sends your Didit API key. The discovery document and the issuer's keys are
|
|
32
33
|
# fetched on first use and cached; one instance per process is the intended use
|
|
33
34
|
# and it is thread safe. Requests are never retried.
|
|
34
|
-
class Authentication
|
|
35
|
+
class Authentication # rubocop:disable Metrics/ClassLength -- one class holds the whole public surface (DESIGN.md 10)
|
|
35
36
|
DEFAULT_TIMEOUT = 10
|
|
36
37
|
DEFAULT_LEEWAY = 60
|
|
37
38
|
DISCOVERY_PATH = "/.well-known/openid-configuration"
|
|
@@ -258,6 +259,47 @@ module Didit
|
|
|
258
259
|
StepUp.new(send_object(bearer_call("GET", issuer_uri(path), access_token)))
|
|
259
260
|
end
|
|
260
261
|
|
|
262
|
+
# Approves or denies a pending agent request for the signed-in person (+POST agents/consent/+).
|
|
263
|
+
#
|
|
264
|
+
# +challenge+ is the pending agent request secret: never log it. +decision+ is
|
|
265
|
+
# "approve" or "deny". When the application requires a human, an approval needs a fresh
|
|
266
|
+
# +assertion+: the JSON-serialised result of +navigator.credentials.get()+ made with the
|
|
267
|
+
# options of {#create_agent_approval_options} (a Hash; binary fields base64url encoded),
|
|
268
|
+
# otherwise the issuer answers HTTP 403 +passkey_required+. A denial needs none.
|
|
269
|
+
# +scopes+ narrows the requested scopes ("read", "act"); omitted means all of them.
|
|
270
|
+
# +organization_ids+ (up to 100 UUID strings) are the organizations the person grants; omitted means
|
|
271
|
+
# none. +lifetime+ is the grant lifetime in seconds (86400, 604800 or 2592000), limited by the
|
|
272
|
+
# application policy; omitted means the policy lifetime.
|
|
273
|
+
# Never retried. Neither outcome carries an access or refresh token.
|
|
274
|
+
#
|
|
275
|
+
# @param decision [String, Symbol] "approve" or "deny"
|
|
276
|
+
# @param assertion [Hash, nil]
|
|
277
|
+
# @param scopes [Array<String>, nil]
|
|
278
|
+
# @return [AgentConsent] {AgentConsent#approved?} carries +code+, +redirect_uri+ and +state+;
|
|
279
|
+
# {AgentConsent#denied?} carries +status+ "denied"
|
|
280
|
+
# @raise [Didit::BadRequestError] +invalid_grant+ for an unknown or expired challenge
|
|
281
|
+
# @raise [Didit::PermissionDeniedError] +passkey_required+ for an approval without a valid assertion
|
|
282
|
+
def submit_agent_consent(access_token, challenge:, decision:, assertion: nil, scopes: nil, organization_ids: nil,
|
|
283
|
+
lifetime: nil)
|
|
284
|
+
body, secrets = AgentConsentRequest.build(required_text(challenge, "challenge"), decision, assertion, scopes,
|
|
285
|
+
{ organization_ids: organization_ids, lifetime: lifetime })
|
|
286
|
+
AgentConsent.new(agent_request(AgentConsentRequest::CONSENT_PATH, access_token, body, secrets))
|
|
287
|
+
end
|
|
288
|
+
|
|
289
|
+
# The WebAuthn request options for approving a pending agent request with a passkey
|
|
290
|
+
# (+POST agents/consent/passkey/+). Hand +options+ to +navigator.credentials.get()+ in
|
|
291
|
+
# the person's browser, then pass the JSON-serialised result to {#submit_agent_consent}.
|
|
292
|
+
# +challenge+ is the pending agent request secret, not the WebAuthn challenge: never
|
|
293
|
+
# log it. Never retried.
|
|
294
|
+
#
|
|
295
|
+
# @return [AgentApprovalOptions]
|
|
296
|
+
def create_agent_approval_options(access_token, challenge:)
|
|
297
|
+
challenge = required_text(challenge, "challenge")
|
|
298
|
+
AgentApprovalOptions.new(
|
|
299
|
+
agent_request(AgentConsentRequest::OPTIONS_PATH, access_token, { "challenge" => challenge }, [challenge])
|
|
300
|
+
)
|
|
301
|
+
end
|
|
302
|
+
|
|
261
303
|
# The issuer's discovery document, fetched and cached like the keys. For debugging.
|
|
262
304
|
#
|
|
263
305
|
# @return [Hash] frozen
|
|
@@ -446,12 +488,16 @@ module Didit
|
|
|
446
488
|
TokenResponse.new(send_object(call))
|
|
447
489
|
end
|
|
448
490
|
|
|
449
|
-
def bearer_call(http_method, uri, access_token, json: nil)
|
|
491
|
+
def bearer_call(http_method, uri, access_token, json: nil, secrets: [])
|
|
450
492
|
token = required_text(access_token, "access_token")
|
|
451
493
|
# Sent in a header: printable ASCII only, so it can never split or extend the request.
|
|
452
494
|
raise ConfigurationError, "access_token contains invalid characters." if token.b.match?(/[^\x21-\x7e]/n)
|
|
453
495
|
|
|
454
|
-
Http::Call.new(http_method, uri, bearer: token, json: json, secrets: [token])
|
|
496
|
+
Http::Call.new(http_method, uri, bearer: token, json: json, secrets: [token, *secrets])
|
|
497
|
+
end
|
|
498
|
+
|
|
499
|
+
def agent_request(path, access_token, body, secrets)
|
|
500
|
+
send_object(bearer_call("POST", issuer_uri(path), access_token, json: body, secrets: secrets))
|
|
455
501
|
end
|
|
456
502
|
|
|
457
503
|
def send_object(call)
|
|
@@ -139,6 +139,11 @@ module Didit
|
|
|
139
139
|
# Union by default; it can't be changed afterwards). The response includes `api_key`; persist it now
|
|
140
140
|
# (recoverable via GET). Requires owner/admin JWT.
|
|
141
141
|
#
|
|
142
|
+
# Set initiate_login_uri to your HTTPS sign-in page on the exact website_url hostname, or an empty string to
|
|
143
|
+
# disable admin-sent sign-in links. Changing website_url also revalidates the saved sign-in URI. Invalid
|
|
144
|
+
# values return 400 with an initiate_login_uri field error; hostname and URI policy failures use
|
|
145
|
+
# https_url_on_registered_website_required.
|
|
146
|
+
#
|
|
142
147
|
# +POST /organizations/me/{org_id}/applications/+
|
|
143
148
|
#
|
|
144
149
|
# @param org_id [String] UUID of the organization. Look it up with `GET /organizations/me/`.
|
|
@@ -152,6 +157,11 @@ module Didit
|
|
|
152
157
|
# the application is created. `eu` is the European Union (Ireland), the default. `au` (Australia, Sydney),
|
|
153
158
|
# `mx` (Mexico) and `ae` (United Arab Emirates) are coming soon: a request that names them answers 400 `This
|
|
154
159
|
# data location is not available yet.` An organization's Sandbox application is always in the European Union.
|
|
160
|
+
# @param initiate_login_uri [String] Application sign-in URL for an admin-sent sign-in link. Optional; an
|
|
161
|
+
# empty string disables sending. A nonempty value must use HTTPS and the exact hostname of website_url
|
|
162
|
+
# (subdomains must match), with no userinfo, query, fragment or whitespace and no port other than 443. The
|
|
163
|
+
# server also revalidates the saved URI when website_url changes; update or clear initiate_login_uri in the
|
|
164
|
+
# same PATCH if need...
|
|
155
165
|
# @param request_options [Hash, nil] :timeout, :max_retries, :extra_headers, :extra_query, :extra_body
|
|
156
166
|
# @return [Didit::Types::Application]
|
|
157
167
|
def create(
|
|
@@ -163,6 +173,7 @@ module Didit
|
|
|
163
173
|
privacy_url: OMIT,
|
|
164
174
|
description: OMIT,
|
|
165
175
|
data_location: OMIT,
|
|
176
|
+
initiate_login_uri: OMIT,
|
|
166
177
|
request_options: nil
|
|
167
178
|
)
|
|
168
179
|
@client.request(
|
|
@@ -176,7 +187,8 @@ module Didit
|
|
|
176
187
|
"terms_url" => terms_url,
|
|
177
188
|
"privacy_url" => privacy_url,
|
|
178
189
|
"description" => description,
|
|
179
|
-
"data_location" => data_location
|
|
190
|
+
"data_location" => data_location,
|
|
191
|
+
"initiate_login_uri" => initiate_login_uri
|
|
180
192
|
},
|
|
181
193
|
auth: :account_token,
|
|
182
194
|
api: :account,
|
|
@@ -244,6 +256,11 @@ module Didit
|
|
|
244
256
|
# application is created, except once on the live application created with your organization, while it is
|
|
245
257
|
# unused (see the request body). Requires owner/admin JWT.
|
|
246
258
|
#
|
|
259
|
+
# Set initiate_login_uri to your HTTPS sign-in page on the exact website_url hostname, or an empty string to
|
|
260
|
+
# disable admin-sent sign-in links. Changing website_url also revalidates the saved sign-in URI. Invalid
|
|
261
|
+
# values return 400 with an initiate_login_uri field error; hostname and URI policy failures use
|
|
262
|
+
# https_url_on_registered_website_required.
|
|
263
|
+
#
|
|
247
264
|
# +PATCH /organizations/me/{org_id}/applications/{app_id}/+
|
|
248
265
|
#
|
|
249
266
|
# @param org_id [String] UUID of the organization that owns the application.
|
|
@@ -258,6 +275,11 @@ module Didit
|
|
|
258
275
|
# the application is created. `eu` is the European Union (Ireland), the default. `au` (Australia, Sydney),
|
|
259
276
|
# `mx` (Mexico) and `ae` (United Arab Emirates) are coming soon: a request that names them answers 400 `This
|
|
260
277
|
# data location is not available yet.` An organization's Sandbox application is always in the European Union.
|
|
278
|
+
# @param initiate_login_uri [String] Application sign-in URL for an admin-sent sign-in link. Optional; an
|
|
279
|
+
# empty string disables sending. A nonempty value must use HTTPS and the exact hostname of website_url
|
|
280
|
+
# (subdomains must match), with no userinfo, query, fragment or whitespace and no port other than 443. The
|
|
281
|
+
# server also revalidates the saved URI when website_url changes; update or clear initiate_login_uri in the
|
|
282
|
+
# same PATCH if need...
|
|
261
283
|
# @param request_options [Hash, nil] :timeout, :max_retries, :extra_headers, :extra_query, :extra_body
|
|
262
284
|
# @return [Didit::Types::Application]
|
|
263
285
|
def update(
|
|
@@ -270,6 +292,7 @@ module Didit
|
|
|
270
292
|
privacy_url: OMIT,
|
|
271
293
|
description: OMIT,
|
|
272
294
|
data_location: OMIT,
|
|
295
|
+
initiate_login_uri: OMIT,
|
|
273
296
|
request_options: nil
|
|
274
297
|
)
|
|
275
298
|
@client.request(
|
|
@@ -283,7 +306,8 @@ module Didit
|
|
|
283
306
|
"terms_url" => terms_url,
|
|
284
307
|
"privacy_url" => privacy_url,
|
|
285
308
|
"description" => description,
|
|
286
|
-
"data_location" => data_location
|
|
309
|
+
"data_location" => data_location,
|
|
310
|
+
"initiate_login_uri" => initiate_login_uri
|
|
287
311
|
},
|
|
288
312
|
auth: :account_token,
|
|
289
313
|
api: :account,
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# Code generated by codegen from openapi/*.json. DO NOT EDIT.
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
module Didit
|
|
5
|
+
module Resources
|
|
6
|
+
# The +sandbox+ resource.
|
|
7
|
+
class Sandbox < Didit::Resource
|
|
8
|
+
# List sandbox scenarios and Test VASP metadata
|
|
9
|
+
#
|
|
10
|
+
# Read the sandbox catalog Didit serves for testing. Authenticate with your application's API key or access
|
|
11
|
+
# token; a sandbox session's `Session-Token` also reads it, narrowed to the scenarios that session's workflow
|
|
12
|
+
# can produce. `scenarios`, `magic_values`, `risk_cases`, `sample_identity` and `delivery_conventions` describe
|
|
13
|
+
# the mocked session outcomes and the values that trigger them. `travel_rule` is the Didit Test VASP: its
|
|
14
|
+
# identity, the `routes` it answers over, and each scenario's own `route`. Every Test VASP exchange runs in
|
|
15
|
+
# process inside Didit, so `TEST_VASP` is not a live network or email transport and no real VASP is contacted.
|
|
16
|
+
# Pick a Travel Rule scenario by its beneficiary wallet address or by a beneficiary name of the form `Didit Test
|
|
17
|
+
# VASP <suffix>`. See [Travel Rule sandbox testing](/transaction-monitoring/travel-rule-sandbox).
|
|
18
|
+
#
|
|
19
|
+
# +GET /v1/sandbox/scenarios/+
|
|
20
|
+
#
|
|
21
|
+
# @param request_options [Hash, nil] :timeout, :max_retries, :extra_headers, :extra_query, :extra_body
|
|
22
|
+
# @return [Didit::Types::SandboxScenarioCatalog]
|
|
23
|
+
def list_scenarios(request_options: nil)
|
|
24
|
+
@client.request(
|
|
25
|
+
:get,
|
|
26
|
+
"/v1/sandbox/scenarios/",
|
|
27
|
+
response: Types::SandboxScenarioCatalog,
|
|
28
|
+
request_options: request_options
|
|
29
|
+
)
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
@@ -2460,10 +2460,25 @@ module Didit
|
|
|
2460
2460
|
# `email_preview_token`: the update then sends exactly the previewed email, or returns `409` before changing
|
|
2461
2461
|
# anything when the email or the session changed since the preview or the receipt is older than 15 minutes.
|
|
2462
2462
|
#
|
|
2463
|
-
# Repeating `Approved` or `Declined` on a session that already has that status
|
|
2464
|
-
#
|
|
2465
|
-
#
|
|
2466
|
-
# expired scoped API key returns `401`.
|
|
2463
|
+
# Repeating `Approved` or `Declined` on a session that already has that status returns `200` without a status
|
|
2464
|
+
# webhook, status activity entry or email. An `Approved` request can still create a same-person link as
|
|
2465
|
+
# described below. Repeating `Resubmitted` returns `400` (`The new status is the same as the current status.`).
|
|
2466
|
+
# Missing or invalid credentials and missing permissions return `403`; an expired scoped API key returns `401`.
|
|
2467
|
+
#
|
|
2468
|
+
# To record a reviewer decision that two verifications belong to the same person, send `new_status: "Approved"`,
|
|
2469
|
+
# `link_to_session_id` and `link_reason`. Both sessions must be distinct, live KYC verifications in the same
|
|
2470
|
+
# application. The target need not be approved or have a person profile. `link_reason` is separate from
|
|
2471
|
+
# `comment`, must be nonblank after trimming and accepts at most 2000 characters. A reason without a target,
|
|
2472
|
+
# linking with another status, an invalid or unavailable target, a self-link, or a KYB participant returns
|
|
2473
|
+
# `400`. Approval and linking succeed together or neither changes. If either session already belongs to a group,
|
|
2474
|
+
# their groups are joined. An already-approved source can be linked for the first time without another status
|
|
2475
|
+
# event or email. A retry within the same group creates no additional link audit. Concurrent group edits return
|
|
2476
|
+
# `409`; retry the request.
|
|
2477
|
+
#
|
|
2478
|
+
# Grouping does not merge person profiles, profile fields or biometric data. Each verification keeps its
|
|
2479
|
+
# original profile association and deletion ownership. Deleting a verification removes it from the group. Link
|
|
2480
|
+
# actions have a separate audit recording the actor, time and `link_reason`; they are not status-review entries.
|
|
2481
|
+
# Group navigation and unlinking are console-only, with no public read or unlink endpoint.
|
|
2467
2482
|
#
|
|
2468
2483
|
# +PATCH /v3/session/{sessionId}/update-status/+
|
|
2469
2484
|
#
|
|
@@ -2491,6 +2506,13 @@ module Didit
|
|
|
2491
2506
|
# Email](/sessions-api/preview-resubmission) (for `Resubmitted`): its `preview_token`. Valid only with
|
|
2492
2507
|
# `send_email: true`; without it the request returns `400`. The recipient, language, session status, sender and
|
|
2493
2508
|
# email (and, for a resubmission, the selected s...
|
|
2509
|
+
# @param link_to_session_id [String] Optional UUID of another live KYC verification in the same application.
|
|
2510
|
+
# Requires new_status=Approved and link_reason. Both participants must be KYC; self-links, deleted, missing and
|
|
2511
|
+
# foreign-application targets return 400. The target need not be approved or have a person profile. Existing
|
|
2512
|
+
# groups are joined.
|
|
2513
|
+
# @param link_reason [String] Reviewer reason for the same-person link, required with link_to_session_id and
|
|
2514
|
+
# rejected without it. Leading and trailing whitespace is trimmed; the result must be nonblank and at most 2000
|
|
2515
|
+
# characters. Recorded in the separate link audit. comment does not substitute for this field.
|
|
2494
2516
|
# @param request_options [Hash, nil] :timeout, :max_retries, :extra_headers, :extra_query, :extra_body
|
|
2495
2517
|
# @return [Didit::Types::SessionsUpdateStatusResponse]
|
|
2496
2518
|
def update_status(
|
|
@@ -2502,6 +2524,8 @@ module Didit
|
|
|
2502
2524
|
email_address: OMIT,
|
|
2503
2525
|
email_language: OMIT,
|
|
2504
2526
|
email_preview_token: OMIT,
|
|
2527
|
+
link_to_session_id: OMIT,
|
|
2528
|
+
link_reason: OMIT,
|
|
2505
2529
|
request_options: nil
|
|
2506
2530
|
)
|
|
2507
2531
|
@client.request(
|
|
@@ -2515,7 +2539,9 @@ module Didit
|
|
|
2515
2539
|
"send_email" => send_email,
|
|
2516
2540
|
"email_address" => email_address,
|
|
2517
2541
|
"email_language" => email_language,
|
|
2518
|
-
"email_preview_token" => email_preview_token
|
|
2542
|
+
"email_preview_token" => email_preview_token,
|
|
2543
|
+
"link_to_session_id" => link_to_session_id,
|
|
2544
|
+
"link_reason" => link_reason
|
|
2519
2545
|
},
|
|
2520
2546
|
response: Types::SessionsUpdateStatusResponse,
|
|
2521
2547
|
request_options: request_options
|
|
@@ -430,6 +430,10 @@ module Didit
|
|
|
430
430
|
# @param legal_name [String]
|
|
431
431
|
# @param lei [String]
|
|
432
432
|
# @param jurisdiction [String]
|
|
433
|
+
# @param vasp_jurisdiction [String] Your VASP profile's own jurisdiction, up to 3 characters (for example `GB`
|
|
434
|
+
# or `USA`), shown to other Didit customers in the VASP directory. Independent of `jurisdiction`, which sets the
|
|
435
|
+
# regulatory regime Didit stamps on your transfers. Send an empty string to clear it; the directory then shows
|
|
436
|
+
# `jurisdiction`.
|
|
433
437
|
# @param name_matching_strictness [String] `CONTAINS` accepts one name whose words all appear in the other.
|
|
434
438
|
# @param confirmation_timeout_hours [Integer]
|
|
435
439
|
# @param timeout_outcome [String]
|
|
@@ -465,6 +469,7 @@ module Didit
|
|
|
465
469
|
# response field of the same name.
|
|
466
470
|
# @param disabled_networks [Array<String>] Networks opted out of platform membership. Does not disable your
|
|
467
471
|
# connected own memberships or provision unavailable networks.
|
|
472
|
+
# @param licence [String] VASP licence or registration reference. Empty when not supplied.
|
|
468
473
|
# @param request_options [Hash, nil] :timeout, :max_retries, :extra_headers, :extra_query, :extra_body
|
|
469
474
|
# @return [Didit::Types::TravelRuleSettingsDetail]
|
|
470
475
|
def update_settings(
|
|
@@ -472,6 +477,7 @@ module Didit
|
|
|
472
477
|
legal_name: OMIT,
|
|
473
478
|
lei: OMIT,
|
|
474
479
|
jurisdiction: OMIT,
|
|
480
|
+
vasp_jurisdiction: OMIT,
|
|
475
481
|
name_matching_strictness: OMIT,
|
|
476
482
|
confirmation_timeout_hours: OMIT,
|
|
477
483
|
timeout_outcome: OMIT,
|
|
@@ -491,6 +497,7 @@ module Didit
|
|
|
491
497
|
sunrise_policy: OMIT,
|
|
492
498
|
non_responsive_policy: OMIT,
|
|
493
499
|
disabled_networks: OMIT,
|
|
500
|
+
licence: OMIT,
|
|
494
501
|
request_options: nil
|
|
495
502
|
)
|
|
496
503
|
@client.request(
|
|
@@ -501,6 +508,7 @@ module Didit
|
|
|
501
508
|
"legal_name" => legal_name,
|
|
502
509
|
"lei" => lei,
|
|
503
510
|
"jurisdiction" => jurisdiction,
|
|
511
|
+
"vasp_jurisdiction" => vasp_jurisdiction,
|
|
504
512
|
"name_matching_strictness" => name_matching_strictness,
|
|
505
513
|
"confirmation_timeout_hours" => confirmation_timeout_hours,
|
|
506
514
|
"timeout_outcome" => timeout_outcome,
|
|
@@ -519,7 +527,8 @@ module Didit
|
|
|
519
527
|
"counterparty_screening_enabled" => counterparty_screening_enabled,
|
|
520
528
|
"sunrise_policy" => sunrise_policy,
|
|
521
529
|
"non_responsive_policy" => non_responsive_policy,
|
|
522
|
-
"disabled_networks" => disabled_networks
|
|
530
|
+
"disabled_networks" => disabled_networks,
|
|
531
|
+
"licence" => licence
|
|
523
532
|
},
|
|
524
533
|
response: Types::TravelRuleSettingsDetail,
|
|
525
534
|
request_options: request_options
|
|
@@ -1180,14 +1189,18 @@ module Didit
|
|
|
1180
1189
|
# +POST /v3/travel-rule/workspace/claim/+
|
|
1181
1190
|
#
|
|
1182
1191
|
# @param vasp_id [String] The directory entry this workspace is. Read ids from `GET /v3/travel-rule/vasps/`.
|
|
1192
|
+
# @param licence [String] Optional licence or registration reference, up to 255 characters; empty clears it.
|
|
1193
|
+
# Omission preserves it for the same directory entry and clears it when claiming a different entry. Applied to
|
|
1194
|
+
# the VASP profile only when the claim is granted.
|
|
1183
1195
|
# @param request_options [Hash, nil] :timeout, :max_retries, :extra_headers, :extra_query, :extra_body
|
|
1184
1196
|
# @return [Didit::Types::TravelRuleWorkspace]
|
|
1185
|
-
def claim(vasp_id:, request_options: nil)
|
|
1197
|
+
def claim(vasp_id:, licence: OMIT, request_options: nil)
|
|
1186
1198
|
@client.request(
|
|
1187
1199
|
:post,
|
|
1188
1200
|
"/v3/travel-rule/workspace/claim/",
|
|
1189
1201
|
body: {
|
|
1190
|
-
"vasp_id" => vasp_id
|
|
1202
|
+
"vasp_id" => vasp_id,
|
|
1203
|
+
"licence" => licence
|
|
1191
1204
|
},
|
|
1192
1205
|
response: Types::TravelRuleWorkspace,
|
|
1193
1206
|
request_options: request_options
|
|
@@ -51,7 +51,10 @@ module Didit
|
|
|
51
51
|
#
|
|
52
52
|
# +POST /v3/wallet-screening/pdf/+
|
|
53
53
|
#
|
|
54
|
-
# @param provider [String] Provider that performed the screening (e.g. `merklescience`, `crystal`).
|
|
54
|
+
# @param provider [String] Provider that performed the screening (e.g. `merklescience`, `crystal`). When the
|
|
55
|
+
# provider you connected in the Marketplace rejected or failed the screening and that connection's fallback to
|
|
56
|
+
# Didit is on, this names Didit's managed screening, not the provider you connected, and
|
|
57
|
+
# `fallback_from_provider` names the provider that failed.
|
|
55
58
|
# @param screening_type [String] Always `WALLET_SCREENING` for this endpoint.
|
|
56
59
|
# @param risk_score [Integer] Normalised 0-100 risk score. Higher means greater exposure to risky entities.
|
|
57
60
|
# Merkle Science grades an address 0-5, which maps to 0, 15, 35, 55, 75 or 95.
|
|
@@ -110,6 +113,14 @@ module Didit
|
|
|
110
113
|
# score alone is not actionable. Ordered high-risk first, then by the value that moved through each driver,
|
|
111
114
|
# capped at the five strongest; `source_of_funds` and `destination_of_funds` always carry the complete
|
|
112
115
|
# breakdow...
|
|
116
|
+
# @param fallback_from_provider [String, nil] Set when the provider you connected in the Marketplace rejected or
|
|
117
|
+
# failed this screening and it ran on Didit's managed provider instead, because that connection's **Fall back to
|
|
118
|
+
# Didit** setting is on: the key of the provider that failed (`crystal`, `chainalysis`, `elliptic` or
|
|
119
|
+
# `trmlabs`). The screening is billed at the managed rate and the failed call is not billed. `null` on every
|
|
120
|
+
# other screenin...
|
|
121
|
+
# @param fallback_reason [String, nil] Why the provider you connected failed, when `fallback_from_provider` is
|
|
122
|
+
# set, for example `Your Crystal account has reached its call limit. Raise the limit with Crystal to screen with
|
|
123
|
+
# it again.` `null` on every other screening.
|
|
113
124
|
# @param raw_response [Hash] The provider's own payload. Its shape is provider-specific and can change without
|
|
114
125
|
# notice: read the normalised fields instead of parsing it.
|
|
115
126
|
# @param request_options [Hash, nil] :timeout, :max_retries, :extra_headers, :extra_query, :extra_body
|
|
@@ -142,6 +153,8 @@ module Didit
|
|
|
142
153
|
network_edges: OMIT,
|
|
143
154
|
pep_counterparty: OMIT,
|
|
144
155
|
risk_factors: OMIT,
|
|
156
|
+
fallback_from_provider: OMIT,
|
|
157
|
+
fallback_reason: OMIT,
|
|
145
158
|
raw_response: OMIT,
|
|
146
159
|
request_options: nil,
|
|
147
160
|
&block
|
|
@@ -177,6 +190,8 @@ module Didit
|
|
|
177
190
|
"network_edges" => network_edges,
|
|
178
191
|
"pep_counterparty" => pep_counterparty,
|
|
179
192
|
"risk_factors" => risk_factors,
|
|
193
|
+
"fallback_from_provider" => fallback_from_provider,
|
|
194
|
+
"fallback_reason" => fallback_reason,
|
|
180
195
|
"raw_response" => raw_response
|
|
181
196
|
},
|
|
182
197
|
response: :binary,
|
data/lib/didit/resources.rb
CHANGED
|
@@ -39,6 +39,7 @@ module Didit
|
|
|
39
39
|
autoload :Questionnaires, "didit/resources/questionnaires"
|
|
40
40
|
autoload :RegulatoryReports, "didit/resources/regulatory_reports"
|
|
41
41
|
autoload :ReportTemplates, "didit/resources/report_templates"
|
|
42
|
+
autoload :Sandbox, "didit/resources/sandbox"
|
|
42
43
|
autoload :Sessions, "didit/resources/sessions"
|
|
43
44
|
autoload :Transactions, "didit/resources/transactions"
|
|
44
45
|
autoload :TravelRule, "didit/resources/travel_rule"
|
|
@@ -224,6 +225,11 @@ module Didit
|
|
|
224
225
|
@report_templates ||= Resources::ReportTemplates.new(self)
|
|
225
226
|
end
|
|
226
227
|
|
|
228
|
+
# @return [Didit::Resources::Sandbox]
|
|
229
|
+
def sandbox
|
|
230
|
+
@sandbox ||= Resources::Sandbox.new(self)
|
|
231
|
+
end
|
|
232
|
+
|
|
227
233
|
# @return [Didit::Resources::Sessions]
|
|
228
234
|
def sessions
|
|
229
235
|
@sessions ||= Resources::Sessions.new(self)
|
|
@@ -75,6 +75,7 @@ module Didit
|
|
|
75
75
|
field :data_location, "data_location", :string
|
|
76
76
|
field :products, "products", [:array, "ApplicationProduct"]
|
|
77
77
|
field :mode, "mode", :string
|
|
78
|
+
field :initiate_login_uri, "initiate_login_uri", :string
|
|
78
79
|
end
|
|
79
80
|
|
|
80
81
|
# Minimal application shape returned inline by `POST /programmatic/verify-email/`. Persist the `api_key`
|