nuntius 0.1.1 → 1.0.27
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +199 -63
- data/Rakefile +62 -1
- data/app/controllers/nuntius/admin/campaigns_controller.rb +56 -0
- data/app/controllers/nuntius/admin/layouts/attachments_controller.rb +32 -0
- data/app/controllers/nuntius/admin/layouts_controller.rb +50 -0
- data/app/controllers/nuntius/admin/lists/subscribers_controller.rb +50 -0
- data/app/controllers/nuntius/admin/lists_controller.rb +46 -0
- data/app/controllers/nuntius/admin/locales_controller.rb +46 -0
- data/app/controllers/nuntius/admin/messages_controller.rb +24 -0
- data/app/controllers/nuntius/admin/templates_controller.rb +56 -0
- data/app/controllers/nuntius/api/events_controller.rb +16 -0
- data/app/controllers/nuntius/application_admin_controller.rb +11 -0
- data/app/controllers/nuntius/application_controller.rb +12 -0
- data/app/controllers/nuntius/callbacks_controller.rb +21 -0
- data/app/controllers/nuntius/dashboard_controller.rb +12 -0
- data/app/controllers/nuntius/feedback_controller.rb +17 -0
- data/app/controllers/nuntius/inbound_messages/twilio_inbound_smses_controller.rb +56 -0
- data/app/controllers/nuntius/messages_controller.rb +13 -0
- data/app/drops/nuntius/application_drop.rb +17 -0
- data/app/drops/nuntius/campaign_drop.rb +7 -0
- data/app/drops/nuntius/layout_drop.rb +11 -0
- data/app/drops/nuntius/message_drop.rb +11 -0
- data/app/drops/nuntius/template_drop.rb +7 -0
- data/app/exceptions/nuntius/base_exception.rb +4 -0
- data/app/exceptions/nuntius/missing_messenger_exception.rb +4 -0
- data/app/helpers/nuntius/application_helper.rb +78 -0
- data/app/jobs/nuntius/application_job.rb +9 -0
- data/app/jobs/nuntius/deliver_inbound_message_job.rb +10 -0
- data/app/jobs/nuntius/messenger_job.rb +17 -0
- data/app/jobs/nuntius/process_inbound_message_job.rb +10 -0
- data/app/jobs/nuntius/purge_message_job.rb +13 -0
- data/app/jobs/nuntius/retrieve_mail_job.rb +18 -0
- data/app/jobs/nuntius/transport_delivery_job.rb +32 -0
- data/app/jobs/nuntius/transport_refresh_job.rb +22 -0
- data/app/message_boxes/nuntius/base_message_box.rb +75 -0
- data/app/messengers/nuntius/base_messenger.rb +193 -0
- data/app/messengers/nuntius/custom_messenger.rb +6 -0
- data/app/models/nuntius/application_record.rb +11 -0
- data/app/models/nuntius/attachment.rb +13 -0
- data/app/models/nuntius/campaign.rb +75 -0
- data/app/models/nuntius/concerns/metadata_scoped.rb +31 -0
- data/app/models/nuntius/concerns/yamlify.rb +23 -0
- data/app/models/nuntius/inbound_message.rb +14 -0
- data/app/models/nuntius/layout.rb +13 -0
- data/app/models/nuntius/list.rb +10 -0
- data/app/models/nuntius/locale.rb +11 -0
- data/app/models/nuntius/message.rb +148 -0
- data/app/models/nuntius/subscriber.rb +12 -0
- data/app/models/nuntius/template.rb +102 -0
- data/app/presenters/application_presenter.rb +28 -0
- data/app/presenters/template_presenter.rb +17 -0
- data/app/providers/nuntius/apnotic_push_provider.rb +44 -0
- data/app/providers/nuntius/base_provider.rb +72 -0
- data/app/providers/nuntius/firebase_push_provider.rb +26 -0
- data/app/providers/nuntius/houston_push_provider.rb +40 -0
- data/app/providers/nuntius/message_bird_sms_provider.rb +39 -0
- data/app/providers/nuntius/slack_slack_provider.rb +36 -0
- data/app/providers/nuntius/smtp_mail_provider.rb +80 -0
- data/app/providers/nuntius/twilio_sms_provider.rb +37 -0
- data/app/providers/nuntius/twilio_voice_provider.rb +70 -0
- data/app/reportlets/nuntius/application_reportlet.rb +35 -0
- data/app/reportlets/nuntius/daily_messages_per_template_reportlet.rb +50 -0
- data/app/runners/nuntius/application_runner.rb +6 -0
- data/app/runners/nuntius/basic_application_runner.rb +15 -0
- data/app/runners/nuntius/timebased_events_runner.rb +15 -0
- data/app/services/nuntius/application_service.rb +7 -0
- data/app/services/nuntius/aws_sns_processor_service.rb +81 -0
- data/app/services/nuntius/deliver_inbound_message_service.rb +14 -0
- data/app/services/nuntius/retrieve_inbound_mail_service.rb +36 -0
- data/app/tables/nuntius_campaigns_table.rb +21 -0
- data/app/tables/nuntius_layouts_table.rb +24 -0
- data/app/tables/nuntius_lists_table.rb +19 -0
- data/app/tables/nuntius_locales_table.rb +18 -0
- data/app/tables/nuntius_messages_table.rb +36 -0
- data/app/tables/nuntius_subscribers_table.rb +19 -0
- data/app/tables/nuntius_templates_table.rb +30 -0
- data/app/transports/nuntius/base_transport.rb +36 -0
- data/app/transports/nuntius/mail_transport.rb +35 -0
- data/app/transports/nuntius/push_transport.rb +15 -0
- data/app/transports/nuntius/slack_transport.rb +6 -0
- data/app/transports/nuntius/sms_transport.rb +6 -0
- data/app/transports/nuntius/voice_transport.rb +6 -0
- data/app/validators/liquid_validator.rb +11 -0
- data/app/views/nuntius/admin/campaigns/edit.html.slim +49 -0
- data/app/views/nuntius/admin/campaigns/index.html.slim +2 -0
- data/app/views/nuntius/admin/layouts/attachments/_attachments.html.slim +28 -0
- data/app/views/nuntius/admin/layouts/attachments/_index.html.slim +2 -0
- data/app/views/nuntius/admin/layouts/attachments/create.json.jbuilder +5 -0
- data/app/views/nuntius/admin/layouts/edit.html.slim +24 -0
- data/app/views/nuntius/admin/layouts/index.html.slim +2 -0
- data/app/views/nuntius/admin/lists/edit.html.slim +14 -0
- data/app/views/nuntius/admin/lists/index.html.slim +2 -0
- data/app/views/nuntius/admin/lists/subscribers/edit.html.slim +14 -0
- data/app/views/nuntius/admin/locales/edit.html.slim +14 -0
- data/app/views/nuntius/admin/locales/index.html.slim +2 -0
- data/app/views/nuntius/admin/messages/index.html.slim +2 -0
- data/app/views/nuntius/admin/messages/show.html.slim +56 -0
- data/app/views/nuntius/admin/templates/edit.html.slim +81 -0
- data/app/views/nuntius/admin/templates/index.html.slim +2 -0
- data/app/views/nuntius/dashboard/show.html.slim +7 -0
- data/app/views/nuntius/messages/show.html.slim +7 -0
- data/config/locales/en.yml +22 -0
- data/config/locales/nl.yml +22 -0
- data/config/routes.rb +38 -0
- data/config/webpack/development.js +5 -0
- data/config/webpack/environment.js +4 -0
- data/config/webpack/production.js +5 -0
- data/config/webpack/test.js +5 -0
- data/config/webpacker.yml +119 -0
- data/db/migrate/20190301201541_create_nuntius_templates.rb +27 -0
- data/db/migrate/20190301202436_create_nuntius_messages.rb +30 -0
- data/db/migrate/20190322112815_create_nuntius_lists.rb +12 -0
- data/db/migrate/20190322114340_create_nuntius_campaigns.rb +18 -0
- data/db/migrate/20190322121338_create_nuntius_subscribers.rb +17 -0
- data/db/migrate/20190327123535_add_metadata_to_models.rb +8 -0
- data/db/migrate/20190327124407_create_nuntius_layouts.rb +24 -0
- data/db/migrate/20190327143921_add_campaign_to_message.rb +7 -0
- data/db/migrate/20190327155112_add_state_to_campaign.rb +7 -0
- data/db/migrate/20190412103335_add_enabled_to_templates.rb +7 -0
- data/db/migrate/20190417125153_change_message_status_default.rb +9 -0
- data/db/migrate/20190417144554_add_nuntiable_to_subscriber.rb +7 -0
- data/db/migrate/20190521135011_add_payload_to_nuntius_messages.rb +7 -0
- data/db/migrate/20190522122657_add_metadata_to_nuntius_message.rb +7 -0
- data/db/migrate/20190825080757_update_nuntius_message_sending_to_sent.rb +11 -0
- data/db/migrate/20200220154927_change_nuntius_templates_payload_type.rb +7 -0
- data/db/migrate/20200224132337_create_nuntius_locales.rb +13 -0
- data/db/migrate/20200318095339_create_nuntius_attachments.rb +12 -0
- data/db/migrate/20200407050646_add_interval_to_nuntius_template.rb +5 -0
- data/db/migrate/20200430131219_make_html_processing_optional.rb +6 -0
- data/db/migrate/20200430154032_make_html_processing_optional_revert.rb +6 -0
- data/db/migrate/20201121185718_create_nuntius_inbound_messages.rb +21 -0
- data/db/migrate/20220412114148_add_last_sent_to_message.rb +5 -0
- data/lib/nuntius/active_record_helpers.rb +28 -0
- data/lib/nuntius/active_storage_helpers.rb +8 -0
- data/lib/nuntius/configuration.rb +97 -0
- data/lib/nuntius/deprecator.rb +8 -0
- data/lib/nuntius/devise.rb +19 -0
- data/lib/nuntius/engine.rb +46 -0
- data/lib/nuntius/i18n_store.rb +100 -0
- data/lib/nuntius/liquid/tags/attach_tag.rb +44 -0
- data/lib/nuntius/mail_allow_list.rb +23 -0
- data/lib/nuntius/nuntiable.rb +24 -0
- data/lib/nuntius/state_machine.rb +19 -0
- data/lib/nuntius/transactio.rb +30 -0
- data/lib/nuntius/version.rb +3 -1
- data/lib/nuntius.rb +74 -8
- data/lib/preamble.rb +87 -0
- data/lib/tasks/nuntius_tasks.rake +27 -0
- metadata +532 -67
- data/.gitignore +0 -4
- data/Gemfile +0 -4
- data/lib/nuntius/encodings/url_safe_base64.rb +0 -26
- data/lib/nuntius/encodings.rb +0 -9
- data/lib/nuntius/envelope.rb +0 -45
- data/lib/nuntius/key.rb +0 -47
- data/lib/nuntius/messenger.rb +0 -37
- data/nuntius.gemspec +0 -23
- data/spec/keys/alice.pem +0 -27
- data/spec/keys/alice.pub +0 -9
- data/spec/keys/bob.pem +0 -27
- data/spec/keys/bob.pub +0 -9
- data/spec/nuntius/encodings/url_safe_base64_spec.rb +0 -36
- data/spec/nuntius/envelope_spec.rb +0 -6
- data/spec/nuntius/key_spec.rb +0 -12
- data/spec/nuntius/messenger_spec.rb +0 -26
- data/spec/spec_helper.rb +0 -9
- data/spec/support/keys.rb +0 -3
data/lib/nuntius/envelope.rb
DELETED
@@ -1,45 +0,0 @@
|
|
1
|
-
module Nuntius
|
2
|
-
class Envelope
|
3
|
-
include Enumerable
|
4
|
-
attr_accessor :data, :key, :signature
|
5
|
-
|
6
|
-
def initialize(attributes)
|
7
|
-
self.data = attributes[:raw_data] ? encode(attributes[:raw_data]) : attributes[:data]
|
8
|
-
self.key = attributes[:raw_key] ? encode(attributes[:raw_key]) : attributes[:key]
|
9
|
-
self.signature = attributes[:raw_signature] ? encode(attributes[:raw_signature]) : attributes[:signature]
|
10
|
-
end
|
11
|
-
|
12
|
-
def to_hash
|
13
|
-
{
|
14
|
-
:data => data,
|
15
|
-
:key => key,
|
16
|
-
:signature => signature
|
17
|
-
}
|
18
|
-
end
|
19
|
-
|
20
|
-
def raw_data
|
21
|
-
decode data
|
22
|
-
end
|
23
|
-
|
24
|
-
def raw_key
|
25
|
-
decode key
|
26
|
-
end
|
27
|
-
|
28
|
-
def raw_signature
|
29
|
-
decode signature
|
30
|
-
end
|
31
|
-
|
32
|
-
def each(&block)
|
33
|
-
self.to_hash.each(&block)
|
34
|
-
end
|
35
|
-
|
36
|
-
protected
|
37
|
-
def encode(string)
|
38
|
-
Encodings::URLSafeBase64.encode(string)
|
39
|
-
end
|
40
|
-
|
41
|
-
def decode(string)
|
42
|
-
Encodings::URLSafeBase64.decode(string)
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
data/lib/nuntius/key.rb
DELETED
@@ -1,47 +0,0 @@
|
|
1
|
-
module Nuntius
|
2
|
-
class Key
|
3
|
-
def initialize(key_data)
|
4
|
-
@key = OpenSSL::PKey::RSA.new(key_data)
|
5
|
-
end
|
6
|
-
|
7
|
-
def private?
|
8
|
-
@key.private?
|
9
|
-
end
|
10
|
-
|
11
|
-
def to_str
|
12
|
-
@key.to_pem
|
13
|
-
end
|
14
|
-
|
15
|
-
def hash
|
16
|
-
@key.hash
|
17
|
-
end
|
18
|
-
|
19
|
-
def ==(key)
|
20
|
-
case key
|
21
|
-
when Nuntius::Key
|
22
|
-
key.hash == self.hash
|
23
|
-
else
|
24
|
-
false
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
def sign(string)
|
29
|
-
digest = OpenSSL::Digest::SHA512.new.digest(string)
|
30
|
-
|
31
|
-
@key.private_encrypt(digest)
|
32
|
-
end
|
33
|
-
|
34
|
-
def validate(message,signature)
|
35
|
-
digest = OpenSSL::Digest::SHA512.new.digest(message)
|
36
|
-
digest == @key.public_decrypt(signature)
|
37
|
-
end
|
38
|
-
|
39
|
-
def encrypt(string)
|
40
|
-
@key.public_encrypt(string)
|
41
|
-
end
|
42
|
-
|
43
|
-
def decrypt(string)
|
44
|
-
@key.private_decrypt(string)
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
data/lib/nuntius/messenger.rb
DELETED
@@ -1,37 +0,0 @@
|
|
1
|
-
module Nuntius
|
2
|
-
class Messenger
|
3
|
-
attr_accessor :key
|
4
|
-
|
5
|
-
def initialize(attributes)
|
6
|
-
self.key = attributes[:key]
|
7
|
-
end
|
8
|
-
|
9
|
-
def wrap(options)
|
10
|
-
cipher = OpenSSL::Cipher.new('AES-256-CBC').encrypt
|
11
|
-
|
12
|
-
key = options[:to].encrypt( cipher.random_key )
|
13
|
-
data = cipher.update( options[:message] ) + cipher.final
|
14
|
-
signature = @key.sign(data)
|
15
|
-
|
16
|
-
Envelope.new({
|
17
|
-
:raw_data => data,
|
18
|
-
:raw_key => key,
|
19
|
-
:raw_signature => signature
|
20
|
-
})
|
21
|
-
end
|
22
|
-
|
23
|
-
def unwrap(options)
|
24
|
-
data = options[:envelope].raw_data
|
25
|
-
signature = options[:envelope].raw_signature
|
26
|
-
|
27
|
-
options[:from].validate(data, signature)
|
28
|
-
|
29
|
-
key = @key.decrypt options[:envelope].raw_key
|
30
|
-
|
31
|
-
cipher = OpenSSL::Cipher.new('AES-256-CBC').decrypt
|
32
|
-
cipher.key = key
|
33
|
-
|
34
|
-
cipher.update(data) + cipher.final
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
data/nuntius.gemspec
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
|
-
$:.push File.expand_path("../lib", __FILE__)
|
3
|
-
require "nuntius/version"
|
4
|
-
|
5
|
-
Gem::Specification.new do |s|
|
6
|
-
s.name = "nuntius"
|
7
|
-
s.version = Nuntius::VERSION
|
8
|
-
s.author = "Sebastian Gamboa"
|
9
|
-
s.email = "me@sagmor.com"
|
10
|
-
s.homepage = "https://github.com/sagmor/nuntius"
|
11
|
-
s.summary = %q{Nuntius: A messenger, reporter, courier, bearer of news or tidings}
|
12
|
-
s.description = %q{Nuntius is a simple scheme to send and receive messages in a cryptographicaly secure and compatible way.}
|
13
|
-
|
14
|
-
s.rubyforge_project = "nuntius"
|
15
|
-
|
16
|
-
s.files = `git ls-files`.split("\n")
|
17
|
-
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
18
|
-
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
19
|
-
s.require_paths = ["lib"]
|
20
|
-
|
21
|
-
s.add_development_dependency "rake"
|
22
|
-
s.add_development_dependency "rspec", ">= 2.7.0"
|
23
|
-
end
|
data/spec/keys/alice.pem
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
-----BEGIN RSA PRIVATE KEY-----
|
2
|
-
MIIEpQIBAAKCAQEA5ApVWuSH8hmUU0t855uMnisyJSz4/HpNm+s9pFRCml3AsUKf
|
3
|
-
0pFcLyip12XrzU489lOzO3vDmt5gFKEULRhR2xTqvqGO+PIcjsDtvWOUN07BOlBU
|
4
|
-
PuvkqulNZpb0A0wEuMwEQ40uzcte78e9zxieKt7mXfBcGrWwnFNVH73hX2zQXi2H
|
5
|
-
AW8aWpkTC7RpHx7iSun0eHEo/xwhf33yIL9UIk5ebYuurEXuUZSkbE99QRgGoyYR
|
6
|
-
M+J0IPFsJMpq4Dl+NaiiA9373nxgtdlgE7Ms9xwDuIR+SCnZ30IE+qZZTy8FzjJ8
|
7
|
-
E6/mtDU+VLgYYNJPNhQrUYo+qzwFdcfCSiyjLwIDAQABAoIBAQDBilujBu6ydS9D
|
8
|
-
+n+J+qS/4R1wG9k+P3b67A6nF7RnW0adq1QF3MUGaVasr54P42UuEx+9Tm9XU4Ds
|
9
|
-
QUHkfA2NCRWqsWestZ+zMN8VrBwxTLAGlALMXFz5CYVdmqSC39PqG41K39pnY0Gx
|
10
|
-
9C6OQ/CJpiCSfdtN+AJqyvcmN3u+BfvLBQ7dNXJP4kBgo918trkumPgk8ZO6bnQB
|
11
|
-
7b4JeGZWQ0Tk/GMhdC/j6RYDTtjpqe9wNXmc6T8I/fdIvHW4p4Oo7Wwrnl1aMeY5
|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d3ZzJrI8KY3GdH67NYahL0=
|
27
|
-
-----END RSA PRIVATE KEY-----
|
data/spec/keys/alice.pub
DELETED
@@ -1,9 +0,0 @@
|
|
1
|
-
-----BEGIN PUBLIC KEY-----
|
2
|
-
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA5ApVWuSH8hmUU0t855uM
|
3
|
-
nisyJSz4/HpNm+s9pFRCml3AsUKf0pFcLyip12XrzU489lOzO3vDmt5gFKEULRhR
|
4
|
-
2xTqvqGO+PIcjsDtvWOUN07BOlBUPuvkqulNZpb0A0wEuMwEQ40uzcte78e9zxie
|
5
|
-
Kt7mXfBcGrWwnFNVH73hX2zQXi2HAW8aWpkTC7RpHx7iSun0eHEo/xwhf33yIL9U
|
6
|
-
Ik5ebYuurEXuUZSkbE99QRgGoyYRM+J0IPFsJMpq4Dl+NaiiA9373nxgtdlgE7Ms
|
7
|
-
9xwDuIR+SCnZ30IE+qZZTy8FzjJ8E6/mtDU+VLgYYNJPNhQrUYo+qzwFdcfCSiyj
|
8
|
-
LwIDAQAB
|
9
|
-
-----END PUBLIC KEY-----
|
data/spec/keys/bob.pem
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
-----BEGIN RSA PRIVATE KEY-----
|
2
|
-
MIIEowIBAAKCAQEAux0cSSixp54Q9O65y3tsUGj3AtKYSo1H6SDlDkGsYu0/y11M
|
3
|
-
JSdRPvI1Pyb3ZYaQ5J2yiWj6OPTGtTHBSyRxemHdRbAVQHukx/LBpeFKzr5YGgiV
|
4
|
-
K5GUsE3MKHY5R8HBtevLv89c56vKaaEApYjMimw5qGciknEMRDNstq45F+RHl1QE
|
5
|
-
0fVx/LEsapj4EfsBnJH0761jMXoW1T3G4krF5PPDvxCydSbZilMCHad0eqr1YQAT
|
6
|
-
rF58HwSaS0WqqeUMJHN8YxHtU7nFVWnnFFtvjLUY/KUFLVfGDju+HXv1FAUrpjSH
|
7
|
-
PY9gGELFP8sepD26Me8iIAkIy3joZXv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H12mAqydEnU7dRAzSjjxL0RucIvMkAnxxh7W+vdGgbU4uaTjFcPcS55/V
|
23
|
-
enEbrhD8mzAL9ti5oY0iY0F82KqZembYdhQA8tvSE5IfRDtkGRSuY+bWptCusP4q
|
24
|
-
g8zqgQKBgB+HShQ1zmaRiwwJthCQ4b3cfaICkczLO2re53MlFcWcQ6bb27nvtT7h
|
25
|
-
/+oHUmnYoDTOuhqYdeR3F50qARIl8im7JBBnJtj5Z5HzefO7MODVgJQlGHB5NPWU
|
26
|
-
7BcrPH0xUlnLAqLes6mPiVCVElUgCf9X3/qepX/2qXlesOehTZfp
|
27
|
-
-----END RSA PRIVATE KEY-----
|
data/spec/keys/bob.pub
DELETED
@@ -1,9 +0,0 @@
|
|
1
|
-
-----BEGIN PUBLIC KEY-----
|
2
|
-
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAux0cSSixp54Q9O65y3ts
|
3
|
-
UGj3AtKYSo1H6SDlDkGsYu0/y11MJSdRPvI1Pyb3ZYaQ5J2yiWj6OPTGtTHBSyRx
|
4
|
-
emHdRbAVQHukx/LBpeFKzr5YGgiVK5GUsE3MKHY5R8HBtevLv89c56vKaaEApYjM
|
5
|
-
imw5qGciknEMRDNstq45F+RHl1QE0fVx/LEsapj4EfsBnJH0761jMXoW1T3G4krF
|
6
|
-
5PPDvxCydSbZilMCHad0eqr1YQATrF58HwSaS0WqqeUMJHN8YxHtU7nFVWnnFFtv
|
7
|
-
jLUY/KUFLVfGDju+HXv1FAUrpjSHPY9gGELFP8sepD26Me8iIAkIy3joZXvoyKNp
|
8
|
-
rQIDAQAB
|
9
|
-
-----END PUBLIC KEY-----
|
@@ -1,36 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Nuntius::Encodings::URLSafeBase64 do
|
4
|
-
|
5
|
-
before(:all) do
|
6
|
-
@samples = {
|
7
|
-
"" => "",
|
8
|
-
"Hello World" => "SGVsbG8gV29ybGQ",
|
9
|
-
OpenSSL::Digest::SHA512.new("").digest =>
|
10
|
-
"z4PhNX7vuL3xVChQ1m2AB9Yg5AULVxXcg_SpIdNs6c5H0NE8XYXysP-DGNKHfuwvY7kxvUdBeoGlODJ6-SfaPg",
|
11
|
-
"The quick brown fox jumps over the lazy dog" =>
|
12
|
-
"VGhlIHF1aWNrIGJyb3duIGZveCBqdW1wcyBvdmVyIHRoZSBsYXp5IGRvZw"
|
13
|
-
}
|
14
|
-
end
|
15
|
-
|
16
|
-
before(:each) do
|
17
|
-
@encoder = Nuntius::Encodings::URLSafeBase64
|
18
|
-
end
|
19
|
-
|
20
|
-
it "should encode messages using RFC4648 compatible Base 64 Encoding with URL and Filename Safe Alphabet" do
|
21
|
-
@samples.each do |string,expected|
|
22
|
-
@encoder.encode(string).should == expected
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
it "should decode valid RFC4648 compatible Base 64 Encoding with URL and Filename Safe Alphabet messages" do
|
27
|
-
@samples.each do |expected,string|
|
28
|
-
@encoder.decode(string).should == expected
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
it "should raise an exception on wrongly encoded messages" do
|
33
|
-
expect { @encoder.decode "wrong encoding" }.to raise_error(Nuntius::Encodings::DecodingError)
|
34
|
-
end
|
35
|
-
|
36
|
-
end
|
data/spec/nuntius/key_spec.rb
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Nuntius::Messenger do
|
4
|
-
before(:each) do
|
5
|
-
@messenger = Nuntius::Messenger.new key: get_key('bob.pem')
|
6
|
-
@alice = get_key('alice.pub')
|
7
|
-
end
|
8
|
-
|
9
|
-
it "should encrypt and sign messages" do
|
10
|
-
@envelope = @messenger.wrap message: "Hello Allice", to: @alice
|
11
|
-
|
12
|
-
@envelope.key.should_not be_nil
|
13
|
-
@envelope.signature.should_not be_nil
|
14
|
-
@envelope.data.should_not be_nil
|
15
|
-
end
|
16
|
-
|
17
|
-
it "should decrypt valid messages" do
|
18
|
-
@envelope = Nuntius::Envelope.new({
|
19
|
-
data: "EiOgHgmZQ6Lsg1QKobu5AA",
|
20
|
-
key: "PjLZjiwU9kZlOsDYhiiwf_P7Vkvd3l-rtk5MMU7EoYyObTj_H52ujyHlwuzDjgI_KyGKU95U5F8zDrjegsVTkhN6b1t73BQ8ImEOXwsicb1hwsaKbDT3PJLR5c0Zk-x_RbaAEE-7Sd3Vodg0qJul1v0b6us-uJZNX5sqjsfvvQn_LCVtgtvWKru_YzLwxVsZD4tNCu_misl6D-BOewkOHovwGiJPqirvSTR7jPWNPbQHgSL0xvdqFL6kEAwzJ_p5Oj1KH68dNeRhBKU8HwSfc8ZEMCTlcwVWMlc2NcxNhiSbjSxCHjawK5zegviqlhYhzw9J_HDMIMMe7K4gk3O_iA",
|
21
|
-
signature: "FF5BhVNFzcoQQbV9_MOsgBHpaLLWKIe0AxmXwx7dOU5QlRmlwzdJhKdQOCUHmbuJIqTfR444kEznQTyAKF66Pmk7UgFniKcmPLPHSfYf5e5BzUkYb2oXI1yqk3qOl9NTb82oVinBOQweufNyo1rmH6b5GrB811xQmzTco7Frogzt5aWGC7BY9x2FWoes633vOMvC4z3kprL4XQVVH2cqIqIvbBXtFteIagy_90HsLA4mfjf1ku5Sjzv5789L2lUUc2oCic5BqUAx0AQ2y9I_q0J8uu4MXCX3vD53Iq5IsrCr2-h6f1nWoHbYWf6aDU4pYGOqStQJRYkurnlh7docFA"
|
22
|
-
})
|
23
|
-
|
24
|
-
@messenger.unwrap(envelope: @envelope, from: @alice).should == "Hello Bob!"
|
25
|
-
end
|
26
|
-
end
|
data/spec/spec_helper.rb
DELETED
data/spec/support/keys.rb
DELETED