didit-sdk 1.0.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 (234) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +25 -0
  3. data/LICENSE +21 -0
  4. data/README.md +277 -0
  5. data/lib/didit/authentication/base64_url.rb +34 -0
  6. data/lib/didit/authentication/cache.rb +201 -0
  7. data/lib/didit/authentication/http.rb +150 -0
  8. data/lib/didit/authentication/issuer.rb +115 -0
  9. data/lib/didit/authentication/jws.rb +231 -0
  10. data/lib/didit/authentication/key_set.rb +89 -0
  11. data/lib/didit/authentication/pkce.rb +64 -0
  12. data/lib/didit/authentication/types.rb +175 -0
  13. data/lib/didit/authentication.rb +546 -0
  14. data/lib/didit/client.rb +211 -0
  15. data/lib/didit/errors.rb +153 -0
  16. data/lib/didit/file_part.rb +85 -0
  17. data/lib/didit/internal/config.rb +94 -0
  18. data/lib/didit/internal/errors.rb +83 -0
  19. data/lib/didit/internal/log.rb +41 -0
  20. data/lib/didit/internal/multipart.rb +60 -0
  21. data/lib/didit/internal/request.rb +322 -0
  22. data/lib/didit/internal/transport.rb +198 -0
  23. data/lib/didit/internal/util.rb +76 -0
  24. data/lib/didit/internal.rb +15 -0
  25. data/lib/didit/model.rb +199 -0
  26. data/lib/didit/page.rb +130 -0
  27. data/lib/didit/raw_response.rb +57 -0
  28. data/lib/didit/resource.rb +15 -0
  29. data/lib/didit/resources/account.rb +309 -0
  30. data/lib/didit/resources/address_validation.rb +73 -0
  31. data/lib/didit/resources/age_estimation.rb +110 -0
  32. data/lib/didit/resources/aml.rb +166 -0
  33. data/lib/didit/resources/aml_monitoring.rb +30 -0
  34. data/lib/didit/resources/analytics.rb +87 -0
  35. data/lib/didit/resources/bank.rb +65 -0
  36. data/lib/didit/resources/billing.rb +61 -0
  37. data/lib/didit/resources/biometric_templates.rb +234 -0
  38. data/lib/didit/resources/blocklist.rb +130 -0
  39. data/lib/didit/resources/business_sessions.rb +29 -0
  40. data/lib/didit/resources/businesses.rb +471 -0
  41. data/lib/didit/resources/cases.rb +2116 -0
  42. data/lib/didit/resources/customization.rb +153 -0
  43. data/lib/didit/resources/database_validation.rb +327 -0
  44. data/lib/didit/resources/document_ai.rb +145 -0
  45. data/lib/didit/resources/email.rb +254 -0
  46. data/lib/didit/resources/face_match.rb +103 -0
  47. data/lib/didit/resources/face_search.rb +103 -0
  48. data/lib/didit/resources/fraud_checks.rb +130 -0
  49. data/lib/didit/resources/id_verification.rb +163 -0
  50. data/lib/didit/resources/id_wallets.rb +1468 -0
  51. data/lib/didit/resources/investigator.rb +419 -0
  52. data/lib/didit/resources/ip.rb +68 -0
  53. data/lib/didit/resources/kyb.rb +256 -0
  54. data/lib/didit/resources/lists.rb +332 -0
  55. data/lib/didit/resources/monitoring_events.rb +466 -0
  56. data/lib/didit/resources/networks.rb +427 -0
  57. data/lib/didit/resources/passive_liveness.rb +103 -0
  58. data/lib/didit/resources/phone.rb +271 -0
  59. data/lib/didit/resources/pricing.rb +40 -0
  60. data/lib/didit/resources/proof_of_address.rb +167 -0
  61. data/lib/didit/resources/questionnaires.rb +170 -0
  62. data/lib/didit/resources/regulatory_reports.rb +314 -0
  63. data/lib/didit/resources/report_templates.rb +146 -0
  64. data/lib/didit/resources/sessions.rb +2820 -0
  65. data/lib/didit/resources/transactions.rb +981 -0
  66. data/lib/didit/resources/travel_rule.rb +1202 -0
  67. data/lib/didit/resources/users.rb +521 -0
  68. data/lib/didit/resources/wallet_screening.rb +190 -0
  69. data/lib/didit/resources/webhooks.rb +396 -0
  70. data/lib/didit/resources/workflows.rb +214 -0
  71. data/lib/didit/resources.rb +263 -0
  72. data/lib/didit/types/account.rb +11 -0
  73. data/lib/didit/types/account_components.rb +105 -0
  74. data/lib/didit/types/address_validation.rb +8 -0
  75. data/lib/didit/types/age_estimation.rb +89 -0
  76. data/lib/didit/types/aml.rb +193 -0
  77. data/lib/didit/types/aml_monitoring.rb +73 -0
  78. data/lib/didit/types/analytics.rb +62 -0
  79. data/lib/didit/types/bank.rb +8 -0
  80. data/lib/didit/types/billing.rb +18 -0
  81. data/lib/didit/types/biometric_templates.rb +292 -0
  82. data/lib/didit/types/blocklist.rb +31 -0
  83. data/lib/didit/types/businesses.rb +45 -0
  84. data/lib/didit/types/cases.rb +368 -0
  85. data/lib/didit/types/components.rb +12206 -0
  86. data/lib/didit/types/customization.rb +8 -0
  87. data/lib/didit/types/database_validation.rb +177 -0
  88. data/lib/didit/types/document_ai.rb +135 -0
  89. data/lib/didit/types/email.rb +116 -0
  90. data/lib/didit/types/face_match.rb +93 -0
  91. data/lib/didit/types/face_search.rb +129 -0
  92. data/lib/didit/types/fraud_checks.rb +8 -0
  93. data/lib/didit/types/id_verification.rb +231 -0
  94. data/lib/didit/types/id_wallets.rb +8 -0
  95. data/lib/didit/types/investigator.rb +221 -0
  96. data/lib/didit/types/ip.rb +8 -0
  97. data/lib/didit/types/kyb.rb +1391 -0
  98. data/lib/didit/types/lists.rb +111 -0
  99. data/lib/didit/types/monitoring_events.rb +235 -0
  100. data/lib/didit/types/networks.rb +120 -0
  101. data/lib/didit/types/passive_liveness.rb +95 -0
  102. data/lib/didit/types/phone.rb +69 -0
  103. data/lib/didit/types/proof_of_address.rb +166 -0
  104. data/lib/didit/types/questionnaires.rb +29 -0
  105. data/lib/didit/types/regulatory_reports.rb +100 -0
  106. data/lib/didit/types/report_templates.rb +41 -0
  107. data/lib/didit/types/sessions.rb +1441 -0
  108. data/lib/didit/types/transactions.rb +245 -0
  109. data/lib/didit/types/travel_rule.rb +168 -0
  110. data/lib/didit/types/users.rb +180 -0
  111. data/lib/didit/types/wallet_screening.rb +49 -0
  112. data/lib/didit/types/webhooks.rb +355 -0
  113. data/lib/didit/types/workflows.rb +32 -0
  114. data/lib/didit/types.rb +1681 -0
  115. data/lib/didit/version.rb +5 -0
  116. data/lib/didit/webhooks/canonical_json.rb +187 -0
  117. data/lib/didit/webhooks/client_methods.rb +23 -0
  118. data/lib/didit/webhooks/events.rb +221 -0
  119. data/lib/didit/webhooks/headers.rb +83 -0
  120. data/lib/didit/webhooks/verifier.rb +260 -0
  121. data/lib/didit/webhooks.rb +99 -0
  122. data/lib/didit-sdk.rb +4 -0
  123. data/lib/didit.rb +31 -0
  124. data/sig/didit/authentication/base64_url.rbs +10 -0
  125. data/sig/didit/authentication/cache.rbs +60 -0
  126. data/sig/didit/authentication/http.rbs +37 -0
  127. data/sig/didit/authentication/issuer.rbs +17 -0
  128. data/sig/didit/authentication/jws.rbs +41 -0
  129. data/sig/didit/authentication/jwt.rbs +14 -0
  130. data/sig/didit/authentication/key_set.rbs +25 -0
  131. data/sig/didit/authentication/pkce.rbs +20 -0
  132. data/sig/didit/authentication/types.rbs +114 -0
  133. data/sig/didit/authentication.rbs +81 -0
  134. data/sig/didit/client.rbs +61 -0
  135. data/sig/didit/errors.rbs +80 -0
  136. data/sig/didit/file_part.rbs +19 -0
  137. data/sig/didit/internal.rbs +199 -0
  138. data/sig/didit/model.rbs +42 -0
  139. data/sig/didit/page.rbs +34 -0
  140. data/sig/didit/raw_response.rbs +20 -0
  141. data/sig/didit/resource.rbs +8 -0
  142. data/sig/didit/resources/account.rbs +23 -0
  143. data/sig/didit/resources/address_validation.rbs +9 -0
  144. data/sig/didit/resources/age_estimation.rbs +9 -0
  145. data/sig/didit/resources/aml.rbs +10 -0
  146. data/sig/didit/resources/aml_monitoring.rbs +9 -0
  147. data/sig/didit/resources/analytics.rbs +9 -0
  148. data/sig/didit/resources/bank.rbs +9 -0
  149. data/sig/didit/resources/billing.rbs +10 -0
  150. data/sig/didit/resources/biometric_templates.rbs +13 -0
  151. data/sig/didit/resources/blocklist.rbs +11 -0
  152. data/sig/didit/resources/business_sessions.rbs +9 -0
  153. data/sig/didit/resources/businesses.rbs +22 -0
  154. data/sig/didit/resources/cases.rbs +103 -0
  155. data/sig/didit/resources/customization.rbs +10 -0
  156. data/sig/didit/resources/database_validation.rbs +9 -0
  157. data/sig/didit/resources/document_ai.rbs +9 -0
  158. data/sig/didit/resources/email.rbs +11 -0
  159. data/sig/didit/resources/face_match.rbs +9 -0
  160. data/sig/didit/resources/face_search.rbs +9 -0
  161. data/sig/didit/resources/fraud_checks.rbs +11 -0
  162. data/sig/didit/resources/id_verification.rbs +9 -0
  163. data/sig/didit/resources/id_wallets.rbs +37 -0
  164. data/sig/didit/resources/investigator.rbs +23 -0
  165. data/sig/didit/resources/ip.rbs +9 -0
  166. data/sig/didit/resources/kyb.rbs +12 -0
  167. data/sig/didit/resources/lists.rbs +20 -0
  168. data/sig/didit/resources/monitoring_events.rbs +16 -0
  169. data/sig/didit/resources/networks.rbs +25 -0
  170. data/sig/didit/resources/passive_liveness.rbs +9 -0
  171. data/sig/didit/resources/phone.rbs +11 -0
  172. data/sig/didit/resources/pricing.rbs +9 -0
  173. data/sig/didit/resources/proof_of_address.rbs +9 -0
  174. data/sig/didit/resources/questionnaires.rbs +13 -0
  175. data/sig/didit/resources/regulatory_reports.rbs +16 -0
  176. data/sig/didit/resources/report_templates.rbs +13 -0
  177. data/sig/didit/resources/sessions.rbs +78 -0
  178. data/sig/didit/resources/transactions.rbs +43 -0
  179. data/sig/didit/resources/travel_rule.rbs +62 -0
  180. data/sig/didit/resources/users.rbs +21 -0
  181. data/sig/didit/resources/wallet_screening.rbs +11 -0
  182. data/sig/didit/resources/webhooks.rbs +23 -0
  183. data/sig/didit/resources/workflows.rbs +13 -0
  184. data/sig/didit/resources.rbs +50 -0
  185. data/sig/didit/types/account.rbs +22 -0
  186. data/sig/didit/types/account_components.rbs +94 -0
  187. data/sig/didit/types/address_validation.rbs +7 -0
  188. data/sig/didit/types/age_estimation.rbs +80 -0
  189. data/sig/didit/types/aml.rbs +174 -0
  190. data/sig/didit/types/aml_monitoring.rbs +67 -0
  191. data/sig/didit/types/analytics.rbs +57 -0
  192. data/sig/didit/types/bank.rbs +9 -0
  193. data/sig/didit/types/billing.rbs +19 -0
  194. data/sig/didit/types/biometric_templates.rbs +268 -0
  195. data/sig/didit/types/blocklist.rbs +33 -0
  196. data/sig/didit/types/businesses.rbs +54 -0
  197. data/sig/didit/types/cases.rbs +414 -0
  198. data/sig/didit/types/components.rbs +10920 -0
  199. data/sig/didit/types/customization.rbs +7 -0
  200. data/sig/didit/types/database_validation.rbs +152 -0
  201. data/sig/didit/types/document_ai.rbs +123 -0
  202. data/sig/didit/types/email.rbs +112 -0
  203. data/sig/didit/types/face_match.rbs +86 -0
  204. data/sig/didit/types/face_search.rbs +112 -0
  205. data/sig/didit/types/fraud_checks.rbs +9 -0
  206. data/sig/didit/types/id_verification.rbs +196 -0
  207. data/sig/didit/types/id_wallets.rbs +55 -0
  208. data/sig/didit/types/investigator.rbs +212 -0
  209. data/sig/didit/types/ip.rbs +7 -0
  210. data/sig/didit/types/kyb.rbs +1254 -0
  211. data/sig/didit/types/lists.rbs +106 -0
  212. data/sig/didit/types/monitoring_events.rbs +234 -0
  213. data/sig/didit/types/networks.rbs +113 -0
  214. data/sig/didit/types/passive_liveness.rbs +87 -0
  215. data/sig/didit/types/phone.rbs +65 -0
  216. data/sig/didit/types/proof_of_address.rbs +144 -0
  217. data/sig/didit/types/questionnaires.rbs +30 -0
  218. data/sig/didit/types/regulatory_reports.rbs +101 -0
  219. data/sig/didit/types/report_templates.rbs +42 -0
  220. data/sig/didit/types/sessions.rbs +1349 -0
  221. data/sig/didit/types/transactions.rbs +273 -0
  222. data/sig/didit/types/travel_rule.rbs +188 -0
  223. data/sig/didit/types/users.rbs +181 -0
  224. data/sig/didit/types/wallet_screening.rbs +40 -0
  225. data/sig/didit/types/webhooks.rbs +311 -0
  226. data/sig/didit/types/workflows.rbs +30 -0
  227. data/sig/didit/webhooks/canonical_json.rbs +25 -0
  228. data/sig/didit/webhooks/client_methods.rbs +11 -0
  229. data/sig/didit/webhooks/events.rbs +125 -0
  230. data/sig/didit/webhooks/headers.rbs +22 -0
  231. data/sig/didit/webhooks/verifier.rbs +54 -0
  232. data/sig/didit/webhooks.rbs +37 -0
  233. data/sig/didit.rbs +20 -0
  234. metadata +300 -0
@@ -0,0 +1,190 @@
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 +wallet_screening+ resource.
7
+ class WalletScreening < Didit::Resource
8
+ # Screen a wallet address
9
+ #
10
+ # Run on-demand AML screening for a single crypto wallet/address without creating a transaction. Resolves your
11
+ # application's configured blockchain analytics provider, screens the address synchronously, and returns the
12
+ # normalised risk result. LIGHTNING is available only with an Elliptic or Chainalysis BYOK connection added
13
+ # through Marketplace. Nothing is written to the transactions table. One AML monitoring usage is billed per
14
+ # successful screening (sandbox applications are not billed).
15
+ #
16
+ # +POST /v3/wallet-screening/+
17
+ #
18
+ # @param wallet_address [String] The crypto address or network identifier to screen. Must match the selected
19
+ # network (e.g. a `0x`-prefixed 40-hex-char address for EVM chains). Alias: `address`.
20
+ # @param blockchain [String] Network identifier. Managed screening supports BTC, ETH, LTC, XRP, BCH, DOGE, TRX,
21
+ # SOL, MATIC, BNB, BASE (Base), OP (Optimism), and ARB (Arbitrum One). USDT and USDC are legacy Ethereum
22
+ # aliases, not multi-network searches. Connected-provider coverage varies. LIGHTNING requires a supported
23
+ # connected provider. CELO (Celo), MODE (Mode) and PLUME (Plume) are screened through a connected TRM Labs
24
+ # acco...
25
+ # @param direction [String] Optional. Whether the address is being screened as an inbound (deposit) or outbound
26
+ # (withdrawal) counterparty. Accepts `inbound`, `outbound`, `deposit`, or `withdrawal`. Defaults to a neutral
27
+ # pre-transfer screen when omitted. This is passed to the provider as context only; it does not change the
28
+ # returned `risk_score`, `severity`, or the `source_of_funds`/`destination_of_funds` breakdowns, which a...
29
+ # @param request_options [Hash, nil] :timeout, :max_retries, :extra_headers, :extra_query, :extra_body
30
+ # @return [Didit::Types::WalletScreeningResult]
31
+ def screen(wallet_address:, blockchain:, direction: OMIT, request_options: nil)
32
+ @client.request(
33
+ :post,
34
+ "/v3/wallet-screening/",
35
+ body: {
36
+ "wallet_address" => wallet_address,
37
+ "blockchain" => blockchain,
38
+ "direction" => direction
39
+ },
40
+ response: Types::WalletScreeningResult,
41
+ request_options: request_options
42
+ )
43
+ end
44
+
45
+ # Render a wallet-screening result as a PDF
46
+ #
47
+ # Stateless companion to `POST /v3/wallet-screening/`: repost the exact JSON body that endpoint returned -
48
+ # including the `report_signature` it added - and get back a Didit-branded PDF of the same result. No provider
49
+ # is called and nothing is billed or persisted; this only re-renders a result Didit already produced. The
50
+ # signature ties the PDF to an unmodified result: editing `risk_score`, `severity`, `sanctions_hit`, or any
51
+ # other signed field before reposting fails with `400`.
52
+ #
53
+ # +POST /v3/wallet-screening/pdf/+
54
+ #
55
+ # @param provider [String] Provider that performed the screening (e.g. `merklescience`, `crystal`).
56
+ # @param screening_type [String] Always `WALLET_SCREENING` for this endpoint.
57
+ # @param risk_score [Integer] Normalised 0-100 risk score. Higher means greater exposure to risky entities.
58
+ # Merkle Science grades an address 0-5, which maps to 0, 15, 35, 55, 75 or 95.
59
+ # @param severity [String] Risk bucket derived from `risk_score`: `0-9` UNKNOWN, `10-39` LOW, `40-69` MEDIUM,
60
+ # `70-89` HIGH, `90-100` CRITICAL. `UNKNOWN` is the lowest band, not a separate no-data state: `risk_score` 0
61
+ # (the common clean-address case) means no adverse assessment, while a non-zero score in the 1-9 range is a real
62
+ # but sub-LOW signal - read the `risk_score`, not just the band. Never treat `UNKNOWN` as an affirm...
63
+ # @param status [String] Screening outcome status.
64
+ # @param summary [String] Human-readable summary of the screening result.
65
+ # @param wallet_address [String] The screened address, echoed back.
66
+ # @param blockchain [String] The blockchain that was screened.
67
+ # @param source_of_funds [Array<Hash>] Where the address received funds from, attributed by entity. Each entry
68
+ # is an exposure breakdown.
69
+ # @param destination_of_funds [Array<Hash>] Where the address sent funds to, attributed by entity. Same item
70
+ # shape as `source_of_funds` with `exposure_direction` = `outgoing`.
71
+ # @param counterparty_connections [Array<Hash>] Entities the provider attributes the screened address to. For
72
+ # Merkle Science these come from the address's own owner and user tags, so the same entity can appear twice, and
73
+ # they carry no fund flows: `received_usd`, `sent_usd`, `received_hops` and `sent_hops` are `null` and
74
+ # `percentage` is 0. Do not route on `risk_level` or `is_direct` here: use `sanctions_hit`,
75
+ # `dominant_risk_category` and `risk_...
76
+ # @param sanctions_hit [Boolean] True if the address has direct or indirect sanctions exposure.
77
+ # @param dominant_risk_category [String, nil] Highest-weighted high-risk category, or `null` when none is
78
+ # dominant (e.g. `sanctioned`, `mixer`, `stolen_funds`).
79
+ # @param report_signature [String] Opaque HMAC-SHA256 signature over this exact result, scoped to your
80
+ # application. Not meaningful on its own - repost the full response body, unmodified and including this field,
81
+ # to `POST /v3/wallet-screening/pdf/` to render it as a PDF. The PDF endpoint rejects the request with `400` if
82
+ # `report_signature` is missing or if any signed field (e.g. `risk_score`, `severity`, `sanctions_hit`) was
83
+ # edited...
84
+ # @param transaction_hash [String, nil] Transaction screening field, shared with the result shape. Always `null`
85
+ # on a wallet screening result.
86
+ # @param block_timestamp [String, nil] Transaction screening field, shared with the result shape. Always `null`
87
+ # on a wallet screening result.
88
+ # @param total_value_usd [Numeric, nil] Transaction screening field, shared with the result shape. Always `null`
89
+ # on a wallet screening result.
90
+ # @param fee_usd [Numeric, nil] Transaction screening field, shared with the result shape. Always `null` on a
91
+ # wallet screening result.
92
+ # @param sender_rows [Array<Hash>] Transaction screening field, shared with the result shape. Always empty on a
93
+ # wallet screening result.
94
+ # @param receiver_rows [Array<Hash>] Transaction screening field, shared with the result shape. Always empty on
95
+ # a wallet screening result.
96
+ # @param transaction_flows [Array<Hash>] Transaction screening field, shared with the result shape. Always empty
97
+ # on a wallet screening result.
98
+ # @param transaction_flows_status [String, nil] Transaction screening field, shared with the result shape.
99
+ # Always `null` on a wallet screening result.
100
+ # @param transaction_flows_error [String, nil] Transaction screening field, shared with the result shape. Always
101
+ # `null` on a wallet screening result.
102
+ # @param network_nodes [Array<Hash>] Exposure graph nodes for transaction screening. Empty on a wallet screening
103
+ # result.
104
+ # @param network_edges [Array<Hash>] Exposure graph edges for transaction screening. Empty on a wallet screening
105
+ # result.
106
+ # @param pep_counterparty [Boolean, nil] Politically exposed person exposure. `null` when no PEP finding is
107
+ # available, which is every result today because no provider reports one; `false` only for an explicit negative
108
+ # screening result. Do not read `null` as a completed PEP check.
109
+ # @param risk_factors [Array<Hash>] Ranked explanation of `risk_score`: what produced this verdict. Providers
110
+ # grade an address on their own model and return only a verdict (Merkle Science returns an integer 0-5), so the
111
+ # score alone is not actionable. Ordered high-risk first, then by the value that moved through each driver,
112
+ # capped at the five strongest; `source_of_funds` and `destination_of_funds` always carry the complete
113
+ # breakdow...
114
+ # @param raw_response [Hash] The provider's own payload. Its shape is provider-specific and can change without
115
+ # notice: read the normalised fields instead of parsing it.
116
+ # @param request_options [Hash, nil] :timeout, :max_retries, :extra_headers, :extra_query, :extra_body
117
+ # @return [String, nil] the body bytes, or nil when a block receives the chunks
118
+ def screen_pdf(
119
+ provider:,
120
+ screening_type:,
121
+ risk_score:,
122
+ severity:,
123
+ status:,
124
+ summary:,
125
+ wallet_address:,
126
+ blockchain:,
127
+ source_of_funds:,
128
+ destination_of_funds:,
129
+ counterparty_connections:,
130
+ sanctions_hit:,
131
+ dominant_risk_category:,
132
+ report_signature:,
133
+ transaction_hash: OMIT,
134
+ block_timestamp: OMIT,
135
+ total_value_usd: OMIT,
136
+ fee_usd: OMIT,
137
+ sender_rows: OMIT,
138
+ receiver_rows: OMIT,
139
+ transaction_flows: OMIT,
140
+ transaction_flows_status: OMIT,
141
+ transaction_flows_error: OMIT,
142
+ network_nodes: OMIT,
143
+ network_edges: OMIT,
144
+ pep_counterparty: OMIT,
145
+ risk_factors: OMIT,
146
+ raw_response: OMIT,
147
+ request_options: nil,
148
+ &block
149
+ )
150
+ @client.request(
151
+ :post,
152
+ "/v3/wallet-screening/pdf/",
153
+ body: {
154
+ "provider" => provider,
155
+ "screening_type" => screening_type,
156
+ "risk_score" => risk_score,
157
+ "severity" => severity,
158
+ "status" => status,
159
+ "summary" => summary,
160
+ "wallet_address" => wallet_address,
161
+ "blockchain" => blockchain,
162
+ "source_of_funds" => source_of_funds,
163
+ "destination_of_funds" => destination_of_funds,
164
+ "counterparty_connections" => counterparty_connections,
165
+ "sanctions_hit" => sanctions_hit,
166
+ "dominant_risk_category" => dominant_risk_category,
167
+ "report_signature" => report_signature,
168
+ "transaction_hash" => transaction_hash,
169
+ "block_timestamp" => block_timestamp,
170
+ "total_value_usd" => total_value_usd,
171
+ "fee_usd" => fee_usd,
172
+ "sender_rows" => sender_rows,
173
+ "receiver_rows" => receiver_rows,
174
+ "transaction_flows" => transaction_flows,
175
+ "transaction_flows_status" => transaction_flows_status,
176
+ "transaction_flows_error" => transaction_flows_error,
177
+ "network_nodes" => network_nodes,
178
+ "network_edges" => network_edges,
179
+ "pep_counterparty" => pep_counterparty,
180
+ "risk_factors" => risk_factors,
181
+ "raw_response" => raw_response
182
+ },
183
+ response: :binary,
184
+ accept: "application/pdf, application/json",
185
+ request_options: request_options, &block
186
+ )
187
+ end
188
+ end
189
+ end
190
+ end
@@ -0,0 +1,396 @@
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 +webhooks+ resource.
7
+ class Webhooks < Didit::Resource
8
+ include ::Didit::Webhooks::ClientMethods
9
+
10
+ # @return [Didit::Resources::Webhooks::Destinations]
11
+ def destinations
12
+ @destinations ||= Destinations.new(@client)
13
+ end
14
+
15
+ # Get webhook configuration
16
+ #
17
+ # Return the application's webhook settings in one call: every [webhook
18
+ # destination](https://docs.didit.me/management-api/webhook/list-destinations) with its signing secret, the
19
+ # event types a destination can subscribe to, the application-level (legacy) webhook URL, version and secret,
20
+ # the data and biometric-template retention policy, and the Digital ID wallet return hosts. Didit delivers
21
+ # webhooks to destinations, each signed with its own `secret_shared_key`; the top-level `webhook_url`,
22
+ # `webhook_version` and `secret_shared_key` are used only while no destination is enabled, and then only for
23
+ # `status.updated` and `data.updated`. The response contains signing secrets, so keep it out of logs and
24
+ # client-side code. A scoped API key needs `webhooks: read`.
25
+ #
26
+ # +GET /v3/webhook/+
27
+ #
28
+ # @param request_options [Hash, nil] :timeout, :max_retries, :extra_headers, :extra_query, :extra_body
29
+ # @return [Didit::Types::WebhookConfig]
30
+ def retrieve_config(request_options: nil)
31
+ @client.request(
32
+ :get,
33
+ "/v3/webhook/",
34
+ response: Types::WebhookConfig,
35
+ request_options: request_options
36
+ )
37
+ end
38
+
39
+ # Update webhook configuration
40
+ #
41
+ # Partially update application-level settings: the legacy webhook URL, version and secret, the data and
42
+ # biometric-template retention policy, and the Digital ID wallet return hosts. Send only the fields to change;
43
+ # the response is the full configuration, the same shape as `GET /v3/webhook/`. Destinations are not managed
44
+ # here: create, update and delete them with the `/v3/webhook/destinations/` endpoints, and do not send an
45
+ # `endpoints` field to this endpoint. A `data_retention_months` change also applies to existing sessions, and
46
+ # sessions it deletes cannot be restored; read [Data retention](https://docs.didit.me/console/data-retention)
47
+ # first. A scoped API key needs `webhooks: write`.
48
+ #
49
+ # +PATCH /v3/webhook/+
50
+ #
51
+ # @param webhook_url [String, nil] Legacy application-level webhook URL. Didit uses it only while the
52
+ # application has no enabled destination, and then only for `status.updated` and `data.updated`. It does not
53
+ # create a destination, and the next create, update or delete of a destination replaces it. To receive webhooks,
54
+ # create a destination with `POST /v3/webhook/destinations/` instead.
55
+ # @param webhook_version [String] Payload version of the legacy `webhook_url`.
56
+ # @param rotate_secret_key [Boolean] `true` replaces the application-level `secret_shared_key` with a new random
57
+ # value at once; the new value is in the response. Destination secrets are not changed. Every call with `true`
58
+ # generates a new secret, so it is not idempotent.
59
+ # @param capture_method [String] Legacy application setting. The verification flow does not read it.
60
+ # @param data_retention_months [Integer, nil] Automatic deletion window in months (a month counts as 30 days),
61
+ # or `null` for no automatic deletion. A change applies to existing sessions too: every user verification
62
+ # session older than the new window is deleted automatically, and that deletion is irreversible.
63
+ # @param face_retention_policy [String] What happens to a session's face embedding when the session is deleted.
64
+ # `retain_until_user_deleted` needs `face_retention_days` in the same request or already set. A change applies
65
+ # to session deletions from then on; it creates or purges no existing biometric template.
66
+ # @param face_retention_days [Integer, nil] Retention period, in days, of biometric templates under
67
+ # `retain_until_user_deleted`.
68
+ # @param biometric_consent_mode [String] When the hosted flow and the native SDKs ask the person for explicit
69
+ # biometric consent before a face capture. `auto` (default) asks only where a trigger applies: a declared state,
70
+ # the person's IP, or the identity document's issuer is in Illinois, Texas or Colorado, or the person looks to
71
+ # be in the US without a known state. `always` asks every person whose workflow captures a face. `never` never
72
+ # s...
73
+ # @param allowed_return_hosts [Array<String>] Replaces the whole list of Digital ID wallet return hosts. Bare
74
+ # hostnames only, such as `shop.example.com`: no scheme, port, path or wildcard. Values are lowercased and
75
+ # duplicates are dropped. Send `[]` to clear the list.
76
+ # @param request_options [Hash, nil] :timeout, :max_retries, :extra_headers, :extra_query, :extra_body
77
+ # @return [Didit::Types::WebhookConfig]
78
+ def update_config(
79
+ webhook_url: OMIT,
80
+ webhook_version: OMIT,
81
+ rotate_secret_key: OMIT,
82
+ capture_method: OMIT,
83
+ data_retention_months: OMIT,
84
+ face_retention_policy: OMIT,
85
+ face_retention_days: OMIT,
86
+ biometric_consent_mode: OMIT,
87
+ allowed_return_hosts: OMIT,
88
+ request_options: nil
89
+ )
90
+ @client.request(
91
+ :patch,
92
+ "/v3/webhook/",
93
+ body: {
94
+ "webhook_url" => webhook_url,
95
+ "webhook_version" => webhook_version,
96
+ "rotate_secret_key" => rotate_secret_key,
97
+ "capture_method" => capture_method,
98
+ "data_retention_months" => data_retention_months,
99
+ "face_retention_policy" => face_retention_policy,
100
+ "face_retention_days" => face_retention_days,
101
+ "biometric_consent_mode" => biometric_consent_mode,
102
+ "allowed_return_hosts" => allowed_return_hosts
103
+ },
104
+ response: Types::WebhookConfig,
105
+ request_options: request_options
106
+ )
107
+ end
108
+
109
+ # The +webhooks.destinations+ resource.
110
+ class Destinations < Didit::Resource
111
+ # Create webhook destination
112
+ #
113
+ # Create a webhook destination. The response includes the auto-generated `secret_shared_key` HMAC signing
114
+ # secret (also readable later via `GET /v3/webhook/destinations/{destination_uuid}/`). Always send
115
+ # `subscribed_events` with at least one event (no wildcards): an explicit empty list is rejected with 400, and
116
+ # omitting the field creates a destination subscribed to nothing, which never receives a webhook. The
117
+ # `(application, url)` pair must be unique among the application's destinations.
118
+ #
119
+ # +POST /v3/webhook/destinations/+
120
+ #
121
+ # @param label [String] Human-readable name displayed in Console → Webhooks. Helps distinguish destinations
122
+ # when you have several (e.g. "Prod", "Staging mirror").
123
+ # @param url [String] HTTPS URL that will receive `POST` requests. Must be unique among the application's
124
+ # destinations. Use a stable, hardened endpoint: Didit retries failed deliveries on a backoff schedule.
125
+ # @param enabled [Boolean] When `false`, the destination is saved but Didit will not push any webhooks to it.
126
+ # Useful for staging configs you want to keep parked.
127
+ # @param webhook_version [String] Payload schema version Didit will send. `v3` is the current/recommended
128
+ # format; older versions are kept for backward compatibility with legacy integrations.
129
+ # @param subscribed_events [Array<String>] Events to deliver. Effectively required: an explicit `[]` is
130
+ # rejected with 400, and omitting the field creates a destination with no subscriptions that receives nothing.
131
+ # @param request_options [Hash, nil] :timeout, :max_retries, :extra_headers, :extra_query, :extra_body
132
+ # @return [Didit::Types::WebhooksDestinationsCreateResponse]
133
+ def create(label:, url:, enabled: OMIT, webhook_version: OMIT, subscribed_events: OMIT, request_options: nil)
134
+ @client.request(
135
+ :post,
136
+ "/v3/webhook/destinations/",
137
+ body: {
138
+ "label" => label,
139
+ "url" => url,
140
+ "enabled" => enabled,
141
+ "webhook_version" => webhook_version,
142
+ "subscribed_events" => subscribed_events
143
+ },
144
+ response: Types::WebhooksDestinationsCreateResponse,
145
+ request_options: request_options
146
+ )
147
+ end
148
+
149
+ # Delete webhook destination
150
+ #
151
+ # Permanently delete a webhook destination, its signing secret and its entire delivery log. This cannot be
152
+ # undone. No new webhook is sent to the destination's URL; other destinations subscribed to the same events
153
+ # keep receiving them. Afterwards the destination no longer appears in `GET /v3/webhook/destinations/`, and
154
+ # every route under `/v3/webhook/destinations/{destination_uuid}/`, including its deliveries, a delivery's
155
+ # detail and its resend, answers 404. The application's legacy `webhook_url` is set to the URL of the oldest
156
+ # remaining enabled destination, or cleared when no enabled destination is left. Calling DELETE again returns
157
+ # 404.
158
+ #
159
+ # +DELETE /v3/webhook/destinations/{destination_uuid}/+
160
+ #
161
+ # @param destination_uuid [String] UUID of the destination to delete.
162
+ # @param request_options [Hash, nil] :timeout, :max_retries, :extra_headers, :extra_query, :extra_body
163
+ # @return [nil]
164
+ def delete(destination_uuid, request_options: nil)
165
+ @client.request(
166
+ :delete,
167
+ "/v3/webhook/destinations/{destination_uuid}/",
168
+ path_params: { "destination_uuid" => destination_uuid },
169
+ request_options: request_options
170
+ )
171
+ end
172
+
173
+ # List webhook destinations
174
+ #
175
+ # List all webhook destinations (unpaginated array, oldest first). Each item carries the destination's
176
+ # configuration, its delivery metrics for the last 30 days (`metrics_window_days`) with one `daily_points`
177
+ # entry per day, and its health (`health_status`, `failing_streak`, `failing_since`, `last_success_at`). The
178
+ # list has no `summary` object and never includes the signing secret: each item shows only `secret_last4`.
179
+ # Fetch a single destination (`GET /v3/webhook/destinations/{destination_uuid}/`) to read `secret_shared_key`.
180
+ #
181
+ # +GET /v3/webhook/destinations/+
182
+ #
183
+ # @param request_options [Hash, nil] :timeout, :max_retries, :extra_headers, :extra_query, :extra_body
184
+ # @return [Array<Didit::Types::WebhooksDestinationsListResponseItem>]
185
+ def list(request_options: nil)
186
+ @client.request(
187
+ :get,
188
+ "/v3/webhook/destinations/",
189
+ response: [:array, Types::WebhooksDestinationsListResponseItem],
190
+ request_options: request_options
191
+ )
192
+ end
193
+
194
+ # List webhook destination deliveries
195
+ #
196
+ # Page through every delivery attempt to one webhook destination, newest first. The first send of each event,
197
+ # each automatic [retry](https://docs.didit.me/integration/webhooks#retry-policy) and each resend are separate
198
+ # entries. Entries carry the HTTP status and response time but not the payload: fetch one delivery to read its
199
+ # headers and body. `count` is exact up to 100 and reads 100 above that, so follow `next` until it is `null`.
200
+ # Delivery records are available for about 30 days. A scoped API key needs `webhooks: read` and `decisions:
201
+ # read`; a key limited to some workflows or to approved sessions cannot use this endpoint.
202
+ #
203
+ # +GET /v3/webhook/destinations/{destination_uuid}/deliveries/+
204
+ #
205
+ # @param destination_uuid [String] UUID of the destination (the `uuid` returned by `GET
206
+ # /v3/webhook/destinations/`).
207
+ # @param limit [Integer] Maximum number of deliveries per page. Defaults to 50. A value that is not a positive
208
+ # integer falls back to 50; a value above 1000000 returns `400`.
209
+ # @param offset [Integer] Number of deliveries to skip. Defaults to 0. Prefer following the `next` and
210
+ # `previous` URLs from the response.
211
+ # @param date_from [Date, String] First UTC day to include, as `YYYY-MM-DD` (inclusive). Omit to start from
212
+ # the oldest delivery available. `dateFrom` is accepted as an alias.
213
+ # @param date_to [Date, String] Last UTC day to include, as `YYYY-MM-DD` (inclusive). Must not be earlier than
214
+ # `date_from`. `dateTo` is accepted as an alias.
215
+ # @param request_options [Hash, nil] :timeout, :max_retries, :extra_headers, :extra_query, :extra_body
216
+ # @return [Didit::Page<Didit::Types::WebhookDestinationDelivery>]
217
+ def list_deliveries(
218
+ destination_uuid,
219
+ limit: OMIT,
220
+ offset: OMIT,
221
+ date_from: OMIT,
222
+ date_to: OMIT,
223
+ request_options: nil
224
+ )
225
+ @client.request(
226
+ :get,
227
+ "/v3/webhook/destinations/{destination_uuid}/deliveries/",
228
+ path_params: { "destination_uuid" => destination_uuid },
229
+ query: {
230
+ "limit" => limit,
231
+ "offset" => offset,
232
+ "date_from" => date_from,
233
+ "date_to" => date_to
234
+ },
235
+ page: Types::WebhookDestinationDelivery,
236
+ request_options: request_options
237
+ )
238
+ end
239
+
240
+ # Resend webhook destination delivery
241
+ #
242
+ # Send a past delivery again, for example after your endpoint was down. Didit takes the stored payload, sets a
243
+ # fresh `timestamp`, signs it again with the destination's current `secret_shared_key` (`X-Signature`,
244
+ # `X-Signature-V2`, `X-Signature-Simple` and `X-Timestamp`) and posts it to the delivery's `request_url`, even
245
+ # if the destination's URL has changed since or the destination is disabled. `event_id` and the rest of the
246
+ # payload are unchanged, so deduplicate on `event_id`. The call waits up to 5 seconds for your endpoint and
247
+ # returns the new delivery with `200` whatever your endpoint answered: read `response_status`. A resend is not
248
+ # retried automatically, every call sends again and creates a new delivery, and the request has no body. A
249
+ # scoped API key needs `webhooks: write` and `decisions: read`; a key limited to some workflows or to approved
250
+ # sessions cannot use this endpoint.
251
+ #
252
+ # +POST /v3/webhook/destinations/{destination_uuid}/deliveries/{delivery_uuid}/resend/+
253
+ #
254
+ # @param destination_uuid [String] UUID of the destination the delivery was sent to.
255
+ # @param delivery_uuid [String] UUID of the delivery to resend: the `uuid` of an entry returned by `GET
256
+ # /v3/webhook/destinations/{destination_uuid}/deliveries/`.
257
+ # @param request_options [Hash, nil] :timeout, :max_retries, :extra_headers, :extra_query, :extra_body
258
+ # @return [Didit::Types::WebhookDestinationDeliveryDetail]
259
+ def resend_delivery(destination_uuid, delivery_uuid, request_options: nil)
260
+ @client.request(
261
+ :post,
262
+ "/v3/webhook/destinations/{destination_uuid}/deliveries/{delivery_uuid}/resend/",
263
+ path_params: { "destination_uuid" => destination_uuid, "delivery_uuid" => delivery_uuid },
264
+ response: Types::WebhookDestinationDeliveryDetail,
265
+ request_options: request_options
266
+ )
267
+ end
268
+
269
+ # Get webhook destination
270
+ #
271
+ # Retrieve one webhook destination with its `secret_shared_key` signing secret, its health (`health_status`,
272
+ # `failing_streak`, `failing_since`, `last_success_at`) and a delivery `summary` for the last 30 days. API-key
273
+ # callers always receive the secret in full; Console users without `read:webhooks` see an empty string.
274
+ #
275
+ # +GET /v3/webhook/destinations/{destination_uuid}/+
276
+ #
277
+ # @param destination_uuid [String] UUID of the destination (the `uuid` returned from create / list).
278
+ # @param request_options [Hash, nil] :timeout, :max_retries, :extra_headers, :extra_query, :extra_body
279
+ # @return [Didit::Types::WebhooksDestinationsRetrieveResponse]
280
+ def retrieve(destination_uuid, request_options: nil)
281
+ @client.request(
282
+ :get,
283
+ "/v3/webhook/destinations/{destination_uuid}/",
284
+ path_params: { "destination_uuid" => destination_uuid },
285
+ response: Types::WebhooksDestinationsRetrieveResponse,
286
+ request_options: request_options
287
+ )
288
+ end
289
+
290
+ # Get webhook destination analytics
291
+ #
292
+ # Delivery totals, failure rate and response times for one webhook destination, over the whole range
293
+ # (`summary`) and per UTC day (`points`). Every attempt counts as a delivery: the first send of an event, each
294
+ # automatic [retry](https://docs.didit.me/integration/webhooks#retry-policy) and each resend. A delivery is
295
+ # failed when its recorded HTTP status is 400 or above, so timeouts (recorded as `504`) and connection
296
+ # failures (`503`) count as failed; a delivery still queued counts in `total_deliveries` only. Delivery
297
+ # records are available for about 30 days. A scoped API key needs `webhooks: read`.
298
+ #
299
+ # +GET /v3/webhook/destinations/{destination_uuid}/analytics/+
300
+ #
301
+ # @param destination_uuid [String] UUID of the destination (the `uuid` returned by `GET
302
+ # /v3/webhook/destinations/`).
303
+ # @param date_from [Date, String] First UTC day to include, as `YYYY-MM-DD` (inclusive). Omit to start from
304
+ # the oldest delivery available. `dateFrom` is accepted as an alias.
305
+ # @param date_to [Date, String] Last UTC day to include, as `YYYY-MM-DD` (inclusive). Must not be earlier than
306
+ # `date_from`. `dateTo` is accepted as an alias.
307
+ # @param request_options [Hash, nil] :timeout, :max_retries, :extra_headers, :extra_query, :extra_body
308
+ # @return [Didit::Types::WebhooksDestinationsRetrieveAnalyticsResponse]
309
+ def retrieve_analytics(destination_uuid, date_from: OMIT, date_to: OMIT, request_options: nil)
310
+ @client.request(
311
+ :get,
312
+ "/v3/webhook/destinations/{destination_uuid}/analytics/",
313
+ path_params: { "destination_uuid" => destination_uuid },
314
+ query: {
315
+ "date_from" => date_from,
316
+ "date_to" => date_to
317
+ },
318
+ response: Types::WebhooksDestinationsRetrieveAnalyticsResponse,
319
+ request_options: request_options
320
+ )
321
+ end
322
+
323
+ # Get webhook destination delivery
324
+ #
325
+ # Retrieve one delivery attempt to a webhook destination with the exact request headers and JSON body Didit
326
+ # sent, the HTTP status your endpoint returned and the response time. `request_header` and `request_body` are
327
+ # JSON text: parse them to read the signature headers and the payload, for example to check your [signature
328
+ # verification](https://docs.didit.me/integration/webhooks#signature-verification) against the destination's
329
+ # `secret_shared_key`. A delivery never contains the signing secret, and Didit does not record your endpoint's
330
+ # response body. A scoped API key needs `webhooks: read` and `decisions: read`; a key limited to some
331
+ # workflows or to approved sessions cannot use this endpoint.
332
+ #
333
+ # +GET /v3/webhook/destinations/{destination_uuid}/deliveries/{delivery_uuid}/+
334
+ #
335
+ # @param destination_uuid [String] UUID of the destination the delivery was sent to.
336
+ # @param delivery_uuid [String] UUID of the delivery: the `uuid` of an entry returned by `GET
337
+ # /v3/webhook/destinations/{destination_uuid}/deliveries/`.
338
+ # @param request_options [Hash, nil] :timeout, :max_retries, :extra_headers, :extra_query, :extra_body
339
+ # @return [Didit::Types::WebhookDestinationDeliveryDetail]
340
+ def retrieve_delivery(destination_uuid, delivery_uuid, request_options: nil)
341
+ @client.request(
342
+ :get,
343
+ "/v3/webhook/destinations/{destination_uuid}/deliveries/{delivery_uuid}/",
344
+ path_params: { "destination_uuid" => destination_uuid, "delivery_uuid" => delivery_uuid },
345
+ response: Types::WebhookDestinationDeliveryDetail,
346
+ request_options: request_options
347
+ )
348
+ end
349
+
350
+ # Update webhook destination
351
+ #
352
+ # Update a webhook destination. **`subscribed_events` is REPLACED wholesale, not merged**: fetch first,
353
+ # append, resend. Secret is not rotated. A `uuid` in the body is ignored: the path names the destination.
354
+ #
355
+ # +PATCH /v3/webhook/destinations/{destination_uuid}/+
356
+ #
357
+ # @param destination_uuid [String] UUID of the destination to update.
358
+ # @param label [String] New human-readable name.
359
+ # @param url [String] New target URL. Must be unique within the application.
360
+ # @param enabled [Boolean] Set to `false` to pause deliveries to this destination without deleting it.
361
+ # @param webhook_version [String] New payload schema version for future deliveries.
362
+ # @param subscribed_events [Array<String>] Event filter for this webhook destination. Didit delivers only
363
+ # webhooks whose event type exactly matches one of these values - there is no wildcard subscription. When
364
+ # sent, the list must contain at least one valid event (an explicit `[]` is rejected with 400); a destination
365
+ # whose list is empty (field omitted at create) receives nothing. On update the list is replaced wholesale,
366
+ # never merged.
367
+ # @param request_options [Hash, nil] :timeout, :max_retries, :extra_headers, :extra_query, :extra_body
368
+ # @return [Didit::Types::WebhooksDestinationsUpdateResponse]
369
+ def update(
370
+ destination_uuid,
371
+ label: OMIT,
372
+ url: OMIT,
373
+ enabled: OMIT,
374
+ webhook_version: OMIT,
375
+ subscribed_events: OMIT,
376
+ request_options: nil
377
+ )
378
+ @client.request(
379
+ :patch,
380
+ "/v3/webhook/destinations/{destination_uuid}/",
381
+ path_params: { "destination_uuid" => destination_uuid },
382
+ body: {
383
+ "label" => label,
384
+ "url" => url,
385
+ "enabled" => enabled,
386
+ "webhook_version" => webhook_version,
387
+ "subscribed_events" => subscribed_events
388
+ },
389
+ response: Types::WebhooksDestinationsUpdateResponse,
390
+ request_options: request_options
391
+ )
392
+ end
393
+ end
394
+ end
395
+ end
396
+ end