pedicel-pay 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 367c31ed8b6dde587ae072ebbd40206db194e249c946cf4a84e1f939c9352891
4
- data.tar.gz: 6b147be0f6dd592f1a4597624f5de9108eaac99cebfe472b7ff919f6ded07c8c
3
+ metadata.gz: 7c8846c27908c71a5c71b3d6cdab7457effead859afed3e3cc5d71a5c206bae1
4
+ data.tar.gz: 6248a8df827cfb068573f26dfb831b43c21a5e9d6509db0acd7383224b14fefa
5
5
  SHA512:
6
- metadata.gz: b2a84e2d4bf091153bdae40d1d8109b21e9cff88358ba5f51d53c38adf4dbbf239d0121e59723276f8898ba95e2c5ac9ef6a17b614c75e6b8d13dfa79f6a1b2b
7
- data.tar.gz: 6ce9deb968f28e6153bcfa99a815b61c2003dd5855d0ba9d491ca695086079aa9f690876aad2a062db1ebc6e95d954589bfab7d38a1251449a7ebacf10069f46
6
+ metadata.gz: '098b8e789ae5f4db37c7cc169e3e406cdaa304415d0cb0b2ecfafcbaeedf6af9258f35e6bedfef634a35f7028d8ef28feb7a3ac864141d6b21b6d9a2d72f8b99'
7
+ data.tar.gz: b4a050fe6fb05ae78cd86613bacaf2da234c8711def144731c3cbc307bd0fb279a6bb4dbfcc4a1fbf1caa1627b1d685aabab92d4a4113fdbdbd2805c9a584188
@@ -85,7 +85,7 @@ module PedicelPay
85
85
  token
86
86
  end
87
87
 
88
- def sign(token, certificate: leaf_certificate, key: leaf_key)
88
+ def sign(token, certificate: leaf_certificate, key: leaf_key, replace: true)
89
89
  raise ArgumentError, 'token has no encrypted_data' unless token.encrypted_data
90
90
  raise ArgumentError, 'token has no ephemeral_pubkey' unless token.header.ephemeral_pubkey
91
91
 
@@ -104,9 +104,13 @@ module PedicelPay
104
104
  OpenSSL::PKCS7::BINARY # Handle 0x00 correctly.
105
105
  )
106
106
 
107
- if token.signature # Already signed.
108
- oldsig = OpenSSL::PKCS7.new(Base64.strict_decode64(token.signature))
109
- signature = oldsig.add_signer(signature.signers.first)
107
+ if replace
108
+ # Just replace token.signature.
109
+ else
110
+ if token.signature # Already signed.
111
+ existing_signature = OpenSSL::PKCS7.new(Base64.strict_decode64(token.signature))
112
+ signature = existing_signature.add_signer(signature.signers.first)
113
+ end
110
114
  end
111
115
 
112
116
  token.signature = Base64.strict_encode64(signature.to_der)
@@ -1,3 +1,3 @@
1
1
  module PedicelPay
2
- VERSION = '0.0.3'
2
+ VERSION = '0.0.4'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pedicel-pay
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Clearhaus A/S
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-06-28 00:00:00.000000000 Z
11
+ date: 2018-07-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler