Config: Split :key in to [:secret_key, :public_key]
This commit is contained in:
parent
9de2acf26a
commit
c7cd7c91eb
@ -4,10 +4,11 @@ require "../src/crypto-secret"
|
||||
|
||||
test_secret_class Crypto::Secret::Not
|
||||
test_secret_class Crypto::Secret::Bidet
|
||||
# test_secret_class Crypto::Secret::Guarded
|
||||
|
||||
describe Crypto::Secret do
|
||||
it ".for" do
|
||||
[:kgk, :key, :data, :not].each do |sym|
|
||||
[:kgk, :secret_key, :public_key, :data, :not].each do |sym|
|
||||
secret = Crypto::Secret.for 2, sym
|
||||
secret.bytesize.should eq 2
|
||||
end
|
||||
|
@ -18,20 +18,22 @@ module Crypto::Secret::Config
|
||||
# None
|
||||
end
|
||||
|
||||
def self.setup(level : SecurityLevel = SecurityLevel::Default) : Nil
|
||||
def self.setup(level : SecurityLevel = :default) : Nil
|
||||
register_use Not, :not
|
||||
|
||||
case level
|
||||
in SecurityLevel::Paranoid
|
||||
register_use Bidet, :not
|
||||
register_use CRYPTO_SECRET_KEY_CLASS, :kgk, :key, :data
|
||||
register_use Bidet, :not, :public_key
|
||||
register_use CRYPTO_SECRET_KEY_CLASS, :kgk, :secret_key, :data
|
||||
in SecurityLevel::Default
|
||||
register_use Not, :public_key
|
||||
register_use Crypto::Secret::Bidet, :data
|
||||
register_use CRYPTO_SECRET_KEY_CLASS, :kgk, :key
|
||||
register_use CRYPTO_SECRET_KEY_CLASS, :kgk, :secret_key
|
||||
in SecurityLevel::Lax
|
||||
register_use Bidet, :kgk, :key, :data
|
||||
register_use Not, :public_key
|
||||
register_use Bidet, :kgk, :secret_key, :data
|
||||
# in SecurityLevel::None
|
||||
# register_use Not, :kgk, :key, :data
|
||||
# register_use Not, :kgk, :secret_key, :data
|
||||
end
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user