mixin_bot 0.8.1 → 0.8.2
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/lib/mixin_bot/api/auth.rb +3 -2
- data/lib/mixin_bot/api.rb +8 -7
- data/lib/mixin_bot/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e33af18983466579858bca5f2593e733d80a8038fc84b1e51e8ec21ed8ca592f
|
4
|
+
data.tar.gz: 6e5d059a71f87c0c5926de5c08ddad64225d0594e1fe0b2a193b672451332b97
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6f710964c98112fccc42cde1fa0f16dbe6eaa171f3edafa8ad4584a4de2b0bf0897d13d543fb4e8709d52898e1f1f8b583dda4500c436380dcd3cb5bd2db0824
|
7
|
+
data.tar.gz: ace503482d89be25331d47db1aa6649f50c9fff8fd79ffb0ecf788e187be31162af527d20972541fda580739f632e6d29bed3e01b80075e560df04c96bb9f030
|
data/lib/mixin_bot/api/auth.rb
CHANGED
@@ -17,10 +17,11 @@ module MixinBot
|
|
17
17
|
sig: sig,
|
18
18
|
scp: scp
|
19
19
|
}
|
20
|
-
|
20
|
+
case key_type
|
21
|
+
when :ed25519
|
21
22
|
jwk = JOSE::JWK.from_okp [:Ed25519, private_key]
|
22
23
|
jws = JOSE::JWS.from({ 'alg' => 'EdDSA' })
|
23
|
-
|
24
|
+
when :rsa
|
24
25
|
jwk = JOSE::JWK.from_pem private_key
|
25
26
|
jws = JOSE::JWS.from({ 'alg' => 'RS512' })
|
26
27
|
end
|
data/lib/mixin_bot/api.rb
CHANGED
@@ -22,7 +22,7 @@ require_relative './api/withdraw'
|
|
22
22
|
|
23
23
|
module MixinBot
|
24
24
|
class API
|
25
|
-
attr_reader :client_id, :client_secret, :session_id, :pin_token, :private_key, :client, :blaze_host, :
|
25
|
+
attr_reader :client_id, :client_secret, :session_id, :pin_token, :private_key, :client, :blaze_host, :key_type
|
26
26
|
|
27
27
|
def initialize(options = {})
|
28
28
|
@client_id = options[:client_id] || MixinBot.client_id
|
@@ -37,12 +37,13 @@ module MixinBot
|
|
37
37
|
''
|
38
38
|
end
|
39
39
|
_private_key = options[:private_key] || MixinBot.private_key
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
40
|
+
if /^-----BEGIN RSA PRIVATE KEY-----/.match? _private_key
|
41
|
+
@private_key = _private_key.gsub('\\r\\n', "\n").gsub("\r\n", "\n")
|
42
|
+
@key_type = :rsa
|
43
|
+
else
|
44
|
+
@private_key = Base64.urlsafe_decode64 _private_key
|
45
|
+
@key_type = :ed25519
|
46
|
+
end
|
46
47
|
end
|
47
48
|
|
48
49
|
def sign_raw_transaction(tx)
|
data/lib/mixin_bot/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mixin_bot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- an-lee
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-03-
|
11
|
+
date: 2022-03-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|