signingflow 0.1.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/CHANGELOG.md +9 -0
- data/LICENSE +21 -0
- data/README.md +96 -0
- data/lib/signingflow/allowlist.rb +13 -0
- data/lib/signingflow/client.rb +17 -0
- data/lib/signingflow/config.rb +82 -0
- data/lib/signingflow/errors.rb +39 -0
- data/lib/signingflow/jail.rb +46 -0
- data/lib/signingflow/object.rb +95 -0
- data/lib/signingflow/path.rb +110 -0
- data/lib/signingflow/redact.rb +31 -0
- data/lib/signingflow/requestor.rb +246 -0
- data/lib/signingflow/resources.rb +624 -0
- data/lib/signingflow/status.rb +82 -0
- data/lib/signingflow/version.rb +6 -0
- data/lib/signingflow/webhook.rb +46 -0
- data/lib/signingflow.rb +25 -0
- data/resources/allowlist.json +110 -0
- metadata +121 -0
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "json"
|
|
4
|
+
require "openssl"
|
|
5
|
+
|
|
6
|
+
module Signingflow
|
|
7
|
+
module Webhook
|
|
8
|
+
Result = Data.define(:payload, :body_sha256)
|
|
9
|
+
|
|
10
|
+
module_function
|
|
11
|
+
|
|
12
|
+
def construct_event(payload, signature, secret, previous_secret: nil, previous_signature: nil)
|
|
13
|
+
body = raw_bytes(payload)
|
|
14
|
+
raise SignatureVerificationError, "Webhook secret is required." if secret.to_s.empty?
|
|
15
|
+
|
|
16
|
+
current = !signature.to_s.empty? && safe_equal?(signature, mac(secret, body))
|
|
17
|
+
previous = !previous_secret.to_s.empty? && !previous_signature.to_s.empty? &&
|
|
18
|
+
safe_equal?(previous_signature, mac(previous_secret, body))
|
|
19
|
+
raise SignatureVerificationError, "Webhook signature did not match." unless current || previous
|
|
20
|
+
|
|
21
|
+
parsed = JSON.parse(body)
|
|
22
|
+
Result.new(payload: parsed, body_sha256: OpenSSL::Digest::SHA256.hexdigest(body))
|
|
23
|
+
rescue JSON::ParserError
|
|
24
|
+
raise InvalidRequestError, "The webhook body is not JSON."
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def raw_bytes(payload)
|
|
28
|
+
return payload.b if payload.is_a?(String)
|
|
29
|
+
raise SignatureVerificationError, "Pass the raw request body."
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def mac(secret, body)
|
|
33
|
+
OpenSSL::HMAC.hexdigest("SHA256", secret.to_s, body)
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def safe_equal?(left, right)
|
|
37
|
+
a = left.to_s.downcase.b
|
|
38
|
+
b = right.to_s.downcase.b
|
|
39
|
+
if a.bytesize != b.bytesize
|
|
40
|
+
OpenSSL.fixed_length_secure_compare(a, a)
|
|
41
|
+
return false
|
|
42
|
+
end
|
|
43
|
+
OpenSSL.fixed_length_secure_compare(a, b)
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
data/lib/signingflow.rb
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "signingflow/version"
|
|
4
|
+
require_relative "signingflow/errors"
|
|
5
|
+
require_relative "signingflow/allowlist"
|
|
6
|
+
require_relative "signingflow/config"
|
|
7
|
+
require_relative "signingflow/redact"
|
|
8
|
+
require_relative "signingflow/status"
|
|
9
|
+
require_relative "signingflow/path"
|
|
10
|
+
require_relative "signingflow/jail"
|
|
11
|
+
require_relative "signingflow/object"
|
|
12
|
+
require_relative "signingflow/requestor"
|
|
13
|
+
require_relative "signingflow/webhook"
|
|
14
|
+
require_relative "signingflow/resources"
|
|
15
|
+
require_relative "signingflow/client"
|
|
16
|
+
|
|
17
|
+
module Signingflow
|
|
18
|
+
def self.construct_event(payload, signature, secret, previous_secret: nil, previous_signature: nil)
|
|
19
|
+
Webhook.construct_event(payload, signature, secret, previous_secret: previous_secret, previous_signature: previous_signature)
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def self.signing_secret_of(body)
|
|
23
|
+
Resources.signing_secret_of(body)
|
|
24
|
+
end
|
|
25
|
+
end
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
{
|
|
2
|
+
"catalog": "mcp",
|
|
3
|
+
"operations": [
|
|
4
|
+
{
|
|
5
|
+
"operationId": "StorageService_BatchAddStorage",
|
|
6
|
+
"http": "POST",
|
|
7
|
+
"path": "/v1/storages:batchAddStorage",
|
|
8
|
+
"idempotent": true,
|
|
9
|
+
"capability": "storage:write"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"operationId": "StorageService_BatchAcknowledgeUpload",
|
|
13
|
+
"http": "POST",
|
|
14
|
+
"path": "/v1/storages:batchAcknowledgeUpload",
|
|
15
|
+
"idempotent": true,
|
|
16
|
+
"capability": "storage:write"
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"operationId": "EnvelopeService_AddEnvelope",
|
|
20
|
+
"http": "POST",
|
|
21
|
+
"path": "/v1/envelopes:addEnvelope",
|
|
22
|
+
"idempotent": true,
|
|
23
|
+
"capability": "envelope:write"
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"operationId": "EnvelopeService_ViewEnvelope",
|
|
27
|
+
"http": "GET",
|
|
28
|
+
"path": "/v1/{name_1}:view",
|
|
29
|
+
"idempotent": false,
|
|
30
|
+
"capability": "envelope:read"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"operationId": "EnvelopeService_UpdateEnvelope",
|
|
34
|
+
"http": "PATCH",
|
|
35
|
+
"path": "/v1/{envelope.name}",
|
|
36
|
+
"idempotent": false,
|
|
37
|
+
"capability": "envelope:write"
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"operationId": "EnvelopeService_SendEnvelope",
|
|
41
|
+
"http": "POST",
|
|
42
|
+
"path": "/v1/{name}:send",
|
|
43
|
+
"idempotent": true,
|
|
44
|
+
"capability": "envelope:send"
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"operationId": "EnvelopeService_ListEnvelopes",
|
|
48
|
+
"http": "GET",
|
|
49
|
+
"path": "/v1/{parent}",
|
|
50
|
+
"idempotent": false,
|
|
51
|
+
"capability": "envelope:read"
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"operationId": "EnvelopeService_RemindEnvelopeSigners",
|
|
55
|
+
"http": "POST",
|
|
56
|
+
"path": "/v1/{name}:remind",
|
|
57
|
+
"idempotent": false,
|
|
58
|
+
"capability": "envelope:send"
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
"operationId": "EnvelopeService_DownloadEnvelope",
|
|
62
|
+
"http": "GET",
|
|
63
|
+
"path": "/v1/{name}:download",
|
|
64
|
+
"idempotent": false,
|
|
65
|
+
"capability": "envelope:read"
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
"operationId": "TemplateService_UseTemplate",
|
|
69
|
+
"http": "POST",
|
|
70
|
+
"path": "/v1/{name}:use",
|
|
71
|
+
"idempotent": true,
|
|
72
|
+
"capability": "template:write"
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
"operationId": "WebhookUrlService_AddWebhookUrl",
|
|
76
|
+
"http": "POST",
|
|
77
|
+
"path": "/v1/webhookUrls:add",
|
|
78
|
+
"idempotent": true,
|
|
79
|
+
"capability": "webhook:write"
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
"operationId": "WebhookUrlService_ViewWebhookUrl",
|
|
83
|
+
"http": "GET",
|
|
84
|
+
"path": "/v1/{name}:view",
|
|
85
|
+
"idempotent": false,
|
|
86
|
+
"capability": "webhook:read"
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
"operationId": "WebhookUrlService_TestWebhookUrl",
|
|
90
|
+
"http": "POST",
|
|
91
|
+
"path": "/v1/{name}:test",
|
|
92
|
+
"idempotent": false,
|
|
93
|
+
"capability": "webhook:write"
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
"operationId": "WebhookService_ListWebhooks",
|
|
97
|
+
"http": "GET",
|
|
98
|
+
"path": "/v1/{parent}",
|
|
99
|
+
"idempotent": false,
|
|
100
|
+
"capability": "webhook:read"
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
"operationId": "WebhookService_ViewWebhook",
|
|
104
|
+
"http": "GET",
|
|
105
|
+
"path": "/v1/{name}:view",
|
|
106
|
+
"idempotent": false,
|
|
107
|
+
"capability": "webhook:read"
|
|
108
|
+
}
|
|
109
|
+
]
|
|
110
|
+
}
|
metadata
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: signingflow
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Signingflow
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2026-11-08 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: minitest
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - "~>"
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '5.25'
|
|
20
|
+
type: :development
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - "~>"
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: '5.25'
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: rake
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - "~>"
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '13.2'
|
|
34
|
+
type: :development
|
|
35
|
+
prerelease: false
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - "~>"
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: '13.2'
|
|
41
|
+
- !ruby/object:Gem::Dependency
|
|
42
|
+
name: simplecov
|
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
|
44
|
+
requirements:
|
|
45
|
+
- - "~>"
|
|
46
|
+
- !ruby/object:Gem::Version
|
|
47
|
+
version: '0.22'
|
|
48
|
+
type: :development
|
|
49
|
+
prerelease: false
|
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
+
requirements:
|
|
52
|
+
- - "~>"
|
|
53
|
+
- !ruby/object:Gem::Version
|
|
54
|
+
version: '0.22'
|
|
55
|
+
- !ruby/object:Gem::Dependency
|
|
56
|
+
name: webmock
|
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
|
58
|
+
requirements:
|
|
59
|
+
- - "~>"
|
|
60
|
+
- !ruby/object:Gem::Version
|
|
61
|
+
version: '3.24'
|
|
62
|
+
type: :development
|
|
63
|
+
prerelease: false
|
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
65
|
+
requirements:
|
|
66
|
+
- - "~>"
|
|
67
|
+
- !ruby/object:Gem::Version
|
|
68
|
+
version: '3.24'
|
|
69
|
+
description: Send a document, read envelope status, and verify webhook signatures
|
|
70
|
+
with the Signingflow API.
|
|
71
|
+
email:
|
|
72
|
+
executables: []
|
|
73
|
+
extensions: []
|
|
74
|
+
extra_rdoc_files: []
|
|
75
|
+
files:
|
|
76
|
+
- CHANGELOG.md
|
|
77
|
+
- LICENSE
|
|
78
|
+
- README.md
|
|
79
|
+
- lib/signingflow.rb
|
|
80
|
+
- lib/signingflow/allowlist.rb
|
|
81
|
+
- lib/signingflow/client.rb
|
|
82
|
+
- lib/signingflow/config.rb
|
|
83
|
+
- lib/signingflow/errors.rb
|
|
84
|
+
- lib/signingflow/jail.rb
|
|
85
|
+
- lib/signingflow/object.rb
|
|
86
|
+
- lib/signingflow/path.rb
|
|
87
|
+
- lib/signingflow/redact.rb
|
|
88
|
+
- lib/signingflow/requestor.rb
|
|
89
|
+
- lib/signingflow/resources.rb
|
|
90
|
+
- lib/signingflow/status.rb
|
|
91
|
+
- lib/signingflow/version.rb
|
|
92
|
+
- lib/signingflow/webhook.rb
|
|
93
|
+
- resources/allowlist.json
|
|
94
|
+
homepage: https://github.com/Signingflow/signingflow-ruby
|
|
95
|
+
licenses:
|
|
96
|
+
- MIT
|
|
97
|
+
metadata:
|
|
98
|
+
homepage_uri: https://github.com/Signingflow/signingflow-ruby
|
|
99
|
+
source_code_uri: https://github.com/Signingflow/signingflow-ruby
|
|
100
|
+
changelog_uri: https://github.com/Signingflow/signingflow-ruby/blob/main/CHANGELOG.md
|
|
101
|
+
rubygems_mfa_required: 'true'
|
|
102
|
+
post_install_message:
|
|
103
|
+
rdoc_options: []
|
|
104
|
+
require_paths:
|
|
105
|
+
- lib
|
|
106
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
107
|
+
requirements:
|
|
108
|
+
- - ">="
|
|
109
|
+
- !ruby/object:Gem::Version
|
|
110
|
+
version: '3.2'
|
|
111
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
112
|
+
requirements:
|
|
113
|
+
- - ">="
|
|
114
|
+
- !ruby/object:Gem::Version
|
|
115
|
+
version: '0'
|
|
116
|
+
requirements: []
|
|
117
|
+
rubygems_version: 3.4.19
|
|
118
|
+
signing_key:
|
|
119
|
+
specification_version: 4
|
|
120
|
+
summary: Official Ruby SDK for the Signingflow API.
|
|
121
|
+
test_files: []
|