patchwork-rb 0.1.9 → 0.1.10
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/README.md +1 -1
- data/lib/patchwork/signature.rb +4 -2
- data/lib/patchwork/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2b8480ba1384033ccd3526de52d98c4e6767742ab5193d7b6c86ddf4e4e4ccba
|
|
4
|
+
data.tar.gz: 06aa3c3894aa8e811a2a055308c7dd69e4d12a92bdf1d0357058336d3691f1e7
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ee7adcdb22f7daa2ee0e3c530a986605ad5cea2adb3c38ef6aca81bb5401a90a62187e84e72336678677155db7f9d6a4191a5e5739943fc35969c20a85169473
|
|
7
|
+
data.tar.gz: b8bafbac2ab580b4be713b965a3386312493720483d777b5566eb2bc5f522113dffe305bb01ed51ebce8a61b079629ed41645f13e563302fdd7386a608cfaeee
|
data/README.md
CHANGED
|
@@ -383,7 +383,7 @@ All of them except `ArgumentError` inherit from `Patchwork::Error`. None of them
|
|
|
383
383
|
The primitives are public if you need to sign or verify outside Rack:
|
|
384
384
|
|
|
385
385
|
```ruby
|
|
386
|
-
Patchwork::Signature.header(secrets: [secret], timestamp: Time.now.to_i, method: "POST", path: "/v1/runs", body: body)
|
|
386
|
+
Patchwork::Signature.header(secrets: [secret], timestamp: Time.now.to_i, method: "POST", path: "/v1/runs", body: body, query: nil)
|
|
387
387
|
Patchwork::Signature.verify!(secrets: [current, previous], header: header, method: "POST", path: path, body: raw_body)
|
|
388
388
|
Patchwork::SessionToken.verify(token) # => claims, or raises Patchwork::InvalidToken
|
|
389
389
|
```
|
data/lib/patchwork/signature.rb
CHANGED
|
@@ -29,8 +29,10 @@ module Patchwork
|
|
|
29
29
|
mac(secret, payload(label, timestamp, method, path, query, digest(body)))
|
|
30
30
|
end
|
|
31
31
|
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
# Emits v2, which is what Patchwork sends. v1 is retired; pass
|
|
33
|
+
# labels: [V1] if you need to produce one for a test.
|
|
34
|
+
def self.header(secrets:, timestamp:, method:, path:, body:, query: nil, labels: [ V2 ])
|
|
35
|
+
labels = Array(labels).map(&:to_s)
|
|
34
36
|
usable = usable!(secrets)
|
|
35
37
|
|
|
36
38
|
values = labels.flat_map do |label|
|
data/lib/patchwork/version.rb
CHANGED