decidim-bulletin_board 0.10.1 → 0.13.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -5,45 +5,37 @@ module Decidim
5
5
  # The Bulletin Board settings class
6
6
  class Settings
7
7
  def initialize(config)
8
- @server = config.server.presence
9
- @server_public_key = config.server_public_key.presence
10
- @api_key = config.api_key.presence
8
+ @bulletin_board_server = config.bulletin_board_server.presence
9
+ @bulletin_board_public_key = config.bulletin_board_public_key.presence
11
10
 
11
+ @authority_api_key = config.authority_api_key.presence
12
12
  @authority_name = config.authority_name.presence
13
- @identification_private_key = config.identification_private_key.presence
13
+ @authority_private_key = JwkUtils.import_private_key(config.authority_private_key) if config.authority_private_key.present?
14
14
 
15
15
  @scheme_name = config.scheme_name.presence
16
16
  @number_of_trustees = config.number_of_trustees.presence
17
17
  @quorum = config.quorum.presence || number_of_trustees
18
18
  end
19
19
 
20
- attr_reader :server, :server_public_key, :api_key, :authority_name, :scheme_name, :number_of_trustees, :quorum
21
-
22
20
  def configured?
23
- server && server_public_key && api_key && authority_name && private_key && scheme_name && number_of_trustees
24
- end
25
-
26
- def authority_slug
27
- @authority_slug ||= authority_name.parameterize
21
+ bulletin_board_server && bulletin_board_public_key && authority_api_key && authority_name && authority_private_key && scheme_name && number_of_trustees
28
22
  end
29
23
 
30
- def private_key
31
- return nil unless identification_private_key.present?
24
+ attr_reader :bulletin_board_server, :bulletin_board_public_key,
25
+ :authority_private_key, :authority_api_key, :authority_name,
26
+ :scheme_name, :number_of_trustees, :quorum
32
27
 
33
- @private_key ||= JwkUtils.import_private_key(identification_private_key)
28
+ def bulletin_board_public_key_rsa
29
+ @bulletin_board_public_key_rsa ||= JWT::JWK::RSA.import(bulletin_board_public_key).public_key
34
30
  end
35
31
 
36
- def public_key
37
- @public_key ||= private_key&.export
32
+ def authority_slug
33
+ @authority_slug ||= authority_name.parameterize
38
34
  end
39
35
 
40
- def server_public_key_rsa
41
- @server_public_key_rsa ||= JWT::JWK::RSA.import(server_public_key).public_key
36
+ def authority_public_key
37
+ @authority_public_key ||= authority_private_key&.export
42
38
  end
43
-
44
- private
45
-
46
- attr_reader :identification_private_key
47
39
  end
48
40
  end
49
41
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Decidim
4
4
  module BulletinBoard
5
- VERSION = "0.10.1"
5
+ VERSION = "0.13.1"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: decidim-bulletin_board
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.1
4
+ version: 0.13.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Morcillo
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: exe
13
13
  cert_chain: []
14
- date: 2021-02-15 00:00:00.000000000 Z
14
+ date: 2021-02-25 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: rails