verisec 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.
- checksums.yaml +7 -0
- data/README.md +211 -0
- data/examples/quickstart.rb +32 -0
- data/lib/verisec/auth.rb +89 -0
- data/lib/verisec/client.rb +76 -0
- data/lib/verisec/errors.rb +125 -0
- data/lib/verisec/file_input.rb +125 -0
- data/lib/verisec/generated/resources.rb +1800 -0
- data/lib/verisec/generated/types.rb +4695 -0
- data/lib/verisec/image.rb +160 -0
- data/lib/verisec/multipart.rb +36 -0
- data/lib/verisec/resource.rb +66 -0
- data/lib/verisec/response_info.rb +34 -0
- data/lib/verisec/transport.rb +322 -0
- data/lib/verisec/util.rb +171 -0
- data/lib/verisec/verisec_object.rb +187 -0
- data/lib/verisec/version.rb +6 -0
- data/lib/verisec/webhook.rb +136 -0
- data/lib/verisec.rb +43 -0
- data/sig/generated/verisec.rbs +2212 -0
- data/sig/verisec.rbs +213 -0
- metadata +68 -0
data/sig/verisec.rbs
ADDED
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
# RBS signatures for the hand-written core. The resources, the answer types
|
|
2
|
+
# and the request types are in generated/verisec.rbs.
|
|
3
|
+
|
|
4
|
+
module VeriSec
|
|
5
|
+
VERSION: String
|
|
6
|
+
DEFAULT_BASE_URL: String
|
|
7
|
+
|
|
8
|
+
# What every call takes as `request_options:`: `timeout:` (Numeric seconds),
|
|
9
|
+
# `max_retries:` (Integer), `headers:` (Hash). A Hash rather than a record,
|
|
10
|
+
# since records with optional keys need RBS 3.5 and Ruby 3.3 bundles RBS 3.4.
|
|
11
|
+
type request_options = Hash[Symbol | String, untyped]
|
|
12
|
+
|
|
13
|
+
interface _Reader
|
|
14
|
+
def read: () -> String?
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
# A KYC image: a path, an IO, VeriSec::Image.bytes(…), a data: URI or base64 (or raw bytes in a binary String).
|
|
18
|
+
type image_input = String | Pathname | Image | FileInput | _Reader
|
|
19
|
+
|
|
20
|
+
# A Financial upload: a path, an IO, a FileInput (or raw bytes in a binary String).
|
|
21
|
+
type file_input = String | Pathname | FileInput | Image | _Reader
|
|
22
|
+
|
|
23
|
+
class Client
|
|
24
|
+
def initialize: (?api_key: String?, ?client_id: String?, ?client_secret: String?, ?base_url: String?,
|
|
25
|
+
?timeout: Numeric?, ?max_retries: Integer?) -> void
|
|
26
|
+
def webhooks: () -> singleton(Webhook)
|
|
27
|
+
def base_url: () -> String
|
|
28
|
+
def timeout: () -> Numeric
|
|
29
|
+
def max_retries: () -> Integer
|
|
30
|
+
def inspect: () -> String
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
class VeriSecError < StandardError
|
|
34
|
+
attr_reader status: Integer?
|
|
35
|
+
attr_reader code: String?
|
|
36
|
+
attr_reader param: String?
|
|
37
|
+
attr_reader request_id: String?
|
|
38
|
+
def headers: () -> Hash[String, String]
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
Error: singleton(VeriSecError)
|
|
42
|
+
|
|
43
|
+
class APIError < VeriSecError
|
|
44
|
+
def initialize: (?String? message, ?status: Integer?, ?code: String?, ?param: String?, ?request_id: String?,
|
|
45
|
+
?headers: Hash[String, String]) -> void
|
|
46
|
+
def self.from: (Integer status, Hash[Symbol, String?] body, Hash[String, String] headers, String? request_id) -> APIError
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
class InvalidRequestError < APIError
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
class AuthenticationError < APIError
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
class InsufficientCreditsError < APIError
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
class PermissionError < APIError
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
class NotFoundError < APIError
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
class RateLimitError < APIError
|
|
65
|
+
def retry_after: () -> (Integer | Float)?
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
class APIServerError < APIError
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
class APIConnectionError < VeriSecError
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
class APITimeoutError < APIConnectionError
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
class SignatureVerificationError < VeriSecError
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
class ResponseInfo < Struct[untyped]
|
|
81
|
+
attr_accessor status: Integer
|
|
82
|
+
attr_accessor headers: Hash[String, String]
|
|
83
|
+
attr_accessor request_id: String?
|
|
84
|
+
attr_accessor warnings: Array[String]
|
|
85
|
+
attr_accessor latency_ms: Numeric?
|
|
86
|
+
|
|
87
|
+
def initialize: (?status: Integer, ?headers: Hash[String, String], ?request_id: String?, ?warnings: Array[String],
|
|
88
|
+
?latency_ms: Numeric?) -> void
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
class VeriSecObject
|
|
92
|
+
FIELDS: Hash[String, String?]
|
|
93
|
+
|
|
94
|
+
attr_reader last_response: ResponseInfo?
|
|
95
|
+
|
|
96
|
+
def self.construct: (untyped value, ?ResponseInfo? last_response) -> untyped
|
|
97
|
+
def self.fields: () -> Hash[String, String?]
|
|
98
|
+
def self.field_type: (String key) -> singleton(VeriSecObject)
|
|
99
|
+
def initialize: (?Hash[String | Symbol, untyped]? values, ?last_response: ResponseInfo?) -> void
|
|
100
|
+
def []: (String | Symbol key) -> untyped
|
|
101
|
+
def dig: (String | Symbol key, *(String | Symbol | Integer) rest) -> untyped
|
|
102
|
+
def fetch: (String | Symbol key, *untyped default) ?{ (String key) -> untyped } -> untyped
|
|
103
|
+
def key?: (String | Symbol key) -> bool
|
|
104
|
+
def keys: () -> Array[String]
|
|
105
|
+
def to_h: () -> Hash[String, untyped]
|
|
106
|
+
def to_json: (*untyped) -> String
|
|
107
|
+
def as_json: (*untyped) -> Hash[String, untyped]
|
|
108
|
+
def ==: (untyped other) -> bool
|
|
109
|
+
def deconstruct_keys: (Array[Symbol]? keys) -> Hash[Symbol, untyped]
|
|
110
|
+
def to_s: () -> String
|
|
111
|
+
def inspect: () -> String
|
|
112
|
+
|
|
113
|
+
private
|
|
114
|
+
|
|
115
|
+
def method_missing: (Symbol name, *untyped args) ?{ (*untyped) -> untyped } -> untyped
|
|
116
|
+
def respond_to_missing?: (Symbol name, ?bool include_private) -> bool
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
class Image
|
|
120
|
+
BASE64: Regexp
|
|
121
|
+
DATA_URI: Regexp
|
|
122
|
+
|
|
123
|
+
def self.bytes: (String data) -> Image
|
|
124
|
+
def self.base64_of: (untyped value, String field) -> String
|
|
125
|
+
def self.prepare: (Hash[String, untyped] body, Hash[Symbol, untyped] plan) -> Hash[String, untyped]
|
|
126
|
+
|
|
127
|
+
attr_reader data: String
|
|
128
|
+
def initialize: (String data) -> void
|
|
129
|
+
def base64: () -> String
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
class FileInput
|
|
133
|
+
DEFAULT_FILENAME: String
|
|
134
|
+
EXTENSION_TYPES: Hash[String, String]
|
|
135
|
+
|
|
136
|
+
def self.sniff: (String bytes) -> String?
|
|
137
|
+
def self.from_path: (String | Pathname path, ?content_type: String?, ?field: String) -> FileInput
|
|
138
|
+
def self.wrap: (file_input value, ?String field) -> FileInput
|
|
139
|
+
|
|
140
|
+
def initialize: (String | _Reader data, ?filename: String?, ?content_type: String?) -> void
|
|
141
|
+
def filename: () -> String
|
|
142
|
+
def bytes: () -> String
|
|
143
|
+
def content_type: () -> String
|
|
144
|
+
end
|
|
145
|
+
|
|
146
|
+
module Webhook
|
|
147
|
+
DEFAULT_TOLERANCE: Integer
|
|
148
|
+
|
|
149
|
+
type headers = Hash[String | Symbol, String | Array[String]] | _EachPair
|
|
150
|
+
|
|
151
|
+
interface _EachPair
|
|
152
|
+
def each: () { ([untyped, untyped]) -> void } -> untyped
|
|
153
|
+
end
|
|
154
|
+
|
|
155
|
+
class Event < VeriSecObject
|
|
156
|
+
def `type`: () -> String
|
|
157
|
+
def timestamp: () -> String
|
|
158
|
+
def environment: () -> String
|
|
159
|
+
def data: () -> VeriSecObject
|
|
160
|
+
end
|
|
161
|
+
|
|
162
|
+
def self.construct_event: (String payload, headers? headers, String secret, ?tolerance: Integer) -> Event
|
|
163
|
+
def self.verify_signature: (String payload, headers? headers, String secret, ?tolerance: Integer) -> bool
|
|
164
|
+
def self.verify_signature!: (String payload, headers? headers, String secret, ?tolerance: Integer) -> true
|
|
165
|
+
def self.generate_test_headers: (String payload, String secret, ?id: String?, ?timestamp: Integer) -> Hash[String, String]
|
|
166
|
+
end
|
|
167
|
+
|
|
168
|
+
module Auth
|
|
169
|
+
class SecretKey
|
|
170
|
+
def initialize: (String key) -> void
|
|
171
|
+
def token: () -> String
|
|
172
|
+
def invalidate: (String? token) -> bool
|
|
173
|
+
end
|
|
174
|
+
|
|
175
|
+
class ClientCredentials
|
|
176
|
+
REFRESH_MARGIN: Integer
|
|
177
|
+
DEFAULT_LIFETIME: Integer
|
|
178
|
+
|
|
179
|
+
def initialize: (?clock: ^() -> Numeric) { () -> Hash[String, untyped] } -> void
|
|
180
|
+
def token: () -> String
|
|
181
|
+
def invalidate: (String? rejected) -> bool
|
|
182
|
+
end
|
|
183
|
+
end
|
|
184
|
+
|
|
185
|
+
# @api private
|
|
186
|
+
class Transport
|
|
187
|
+
DEFAULT_TIMEOUT: Integer
|
|
188
|
+
DEFAULT_MAX_RETRIES: Integer
|
|
189
|
+
MAX_RETRY_WAIT: Integer
|
|
190
|
+
REQUEST_OPTIONS: Array[Symbol]
|
|
191
|
+
USER_AGENT: String
|
|
192
|
+
TOKEN_PATH: String
|
|
193
|
+
|
|
194
|
+
attr_reader base_url: String
|
|
195
|
+
attr_reader timeout: Numeric
|
|
196
|
+
attr_reader max_retries: Integer
|
|
197
|
+
|
|
198
|
+
def initialize: (?api_key: String?, ?client_id: String?, ?client_secret: String?, ?base_url: String?,
|
|
199
|
+
?timeout: Numeric?, ?max_retries: Integer?) -> void
|
|
200
|
+
def request: (Symbol method, String path, ?query: Hash[String, untyped]?, ?body: Hash[String, untyped]?,
|
|
201
|
+
?multipart: [Array[[String, String]], Array[[String, FileInput]]]?, ?envelope: :data | :object | :raw,
|
|
202
|
+
?request_options: request_options?, ?headers: Hash[String, String]?, ?anonymous: bool) -> [untyped, ResponseInfo]
|
|
203
|
+
def retry_delay: (Integer attempt, String? retry_after) -> Numeric
|
|
204
|
+
end
|
|
205
|
+
|
|
206
|
+
module Resources
|
|
207
|
+
class Resource
|
|
208
|
+
SOURCE_HEADER: Hash[String, String]
|
|
209
|
+
|
|
210
|
+
def initialize: (Transport transport) -> void
|
|
211
|
+
end
|
|
212
|
+
end
|
|
213
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: verisec
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 1.0.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- VeriSec Labs
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2026-10-18 00:00:00.000000000 Z
|
|
12
|
+
dependencies: []
|
|
13
|
+
description: 'Every VeriSec API as a method: faces, liveness, documents, MRZ, contact
|
|
14
|
+
and risk screening, cheques, cards, banks and BIN lookups. Images from files, safe
|
|
15
|
+
retries that never run a charged call twice, live-key OAuth, and Standard Webhooks
|
|
16
|
+
verification. Standard library only.'
|
|
17
|
+
email:
|
|
18
|
+
executables: []
|
|
19
|
+
extensions: []
|
|
20
|
+
extra_rdoc_files: []
|
|
21
|
+
files:
|
|
22
|
+
- README.md
|
|
23
|
+
- examples/quickstart.rb
|
|
24
|
+
- lib/verisec.rb
|
|
25
|
+
- lib/verisec/auth.rb
|
|
26
|
+
- lib/verisec/client.rb
|
|
27
|
+
- lib/verisec/errors.rb
|
|
28
|
+
- lib/verisec/file_input.rb
|
|
29
|
+
- lib/verisec/generated/resources.rb
|
|
30
|
+
- lib/verisec/generated/types.rb
|
|
31
|
+
- lib/verisec/image.rb
|
|
32
|
+
- lib/verisec/multipart.rb
|
|
33
|
+
- lib/verisec/resource.rb
|
|
34
|
+
- lib/verisec/response_info.rb
|
|
35
|
+
- lib/verisec/transport.rb
|
|
36
|
+
- lib/verisec/util.rb
|
|
37
|
+
- lib/verisec/verisec_object.rb
|
|
38
|
+
- lib/verisec/version.rb
|
|
39
|
+
- lib/verisec/webhook.rb
|
|
40
|
+
- sig/generated/verisec.rbs
|
|
41
|
+
- sig/verisec.rbs
|
|
42
|
+
homepage: https://verisec.mmose.me
|
|
43
|
+
licenses:
|
|
44
|
+
- MIT
|
|
45
|
+
metadata:
|
|
46
|
+
homepage_uri: https://verisec.mmose.me
|
|
47
|
+
documentation_uri: https://verisec.mmose.me
|
|
48
|
+
post_install_message:
|
|
49
|
+
rdoc_options: []
|
|
50
|
+
require_paths:
|
|
51
|
+
- lib
|
|
52
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
53
|
+
requirements:
|
|
54
|
+
- - ">="
|
|
55
|
+
- !ruby/object:Gem::Version
|
|
56
|
+
version: '3.0'
|
|
57
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
58
|
+
requirements:
|
|
59
|
+
- - ">="
|
|
60
|
+
- !ruby/object:Gem::Version
|
|
61
|
+
version: '0'
|
|
62
|
+
requirements: []
|
|
63
|
+
rubygems_version: 3.5.16
|
|
64
|
+
signing_key:
|
|
65
|
+
specification_version: 4
|
|
66
|
+
summary: 'The official Ruby library for the VeriSec API: identity (KYC) and Financial
|
|
67
|
+
checks.'
|
|
68
|
+
test_files: []
|