Sha256: 8751e68aa0cfdbbe010076311ed11db9eb44688f3e7001a26c68943850bfc3ad
Contents?: true
Size: 1.42 KB
Versions: 2
Compression:
Stored size: 1.42 KB
Contents
# frozen_string_literal: true module Decidim module BulletinBoard # The Bulletin Board settings class class Settings def initialize(config) @server = config.server.presence @server_public_key = config.server_public_key.presence @api_key = config.api_key.presence @authority_name = config.authority_name.presence @identification_private_key = config.identification_private_key.presence @scheme_name = config.scheme_name.presence @number_of_trustees = config.number_of_trustees.presence @quorum = config.quorum.presence || number_of_trustees end attr_reader :server, :server_public_key, :api_key, :authority_name, :scheme_name, :number_of_trustees, :quorum def configured? server && server_public_key && api_key && authority_name && private_key && scheme_name && number_of_trustees end def authority_slug @authority_slug ||= authority_name.parameterize end def private_key return nil unless identification_private_key.present? @private_key ||= JwkUtils.import_private_key(identification_private_key) end def public_key @public_key ||= private_key&.export end def server_public_key_rsa @server_public_key_rsa ||= JWT::JWK::RSA.import(server_public_key).public_key end private attr_reader :identification_private_key end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
decidim-bulletin_board-0.10.1 | lib/decidim/bulletin_board/settings.rb |
decidim-bulletin_board-0.10.0 | lib/decidim/bulletin_board/settings.rb |