bimi 0.1.0
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 +7 -0
- data/README.md +39 -0
- data/lib/bimi/version.rb +5 -0
- data/lib/bimi.rb +87 -0
- data/sig/bimi.rbs +4 -0
- metadata +51 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: de80df0b6b1b4ff98eb97b27fa5ae7d2bdb42e58db45c20380b5a072c03e82b7
|
|
4
|
+
data.tar.gz: a6bb3274542892c548438303c4e5830c72fdafb21cbea418b5083fc2587b57a2
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: a6b9a15d363cbced4b264caf292d43c095708e965342a045398bde0de0eb628aa3079b4234bf709f2e11ac4ace204c904011b5ef70500b49e36ef25e4a77e0d5
|
|
7
|
+
data.tar.gz: dd141c1446d33d1a477ea14232236075861ad6512f260beca52963c880411bedb48406536b74fc5a841344a181b35ce8bff382e7bacbc6635dd6b7028628ec84
|
data/README.md
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# bimi
|
|
2
|
+
|
|
3
|
+
A Ruby toolkit for [BIMI](https://bimigroup.org) — Brand Indicators for Message Identification.
|
|
4
|
+
|
|
5
|
+
This is an early preview release. The full API (record discovery, SVG Tiny PS validation, VMC and CMC certificate chain verification) is in progress. For now, the gem ships a placeholder `BIMI.check` that animates in your terminal so you can confirm it loaded.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
bundle add bimi
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Or without bundler:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
gem install bimi
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Usage
|
|
20
|
+
|
|
21
|
+
```ruby
|
|
22
|
+
require "bimi"
|
|
23
|
+
|
|
24
|
+
BIMI.check # animates against a placeholder domain
|
|
25
|
+
BIMI.check("example.com") # animates against the domain you pass
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
In a non-TTY environment the output falls back to plain text.
|
|
29
|
+
|
|
30
|
+
## Roadmap
|
|
31
|
+
|
|
32
|
+
- Record discovery (`default._bimi` TXT lookup)
|
|
33
|
+
- SVG Tiny PS fetch and validation
|
|
34
|
+
- VMC and CMC certificate chain verification
|
|
35
|
+
- DMARC policy assertion checks
|
|
36
|
+
|
|
37
|
+
## License
|
|
38
|
+
|
|
39
|
+
MIT.
|
data/lib/bimi/version.rb
ADDED
data/lib/bimi.rb
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "bimi/version"
|
|
4
|
+
|
|
5
|
+
module BIMI
|
|
6
|
+
class Error < StandardError; end
|
|
7
|
+
|
|
8
|
+
SPINNER = %w[⠋ ⠙ ⠹ ⠸ ⠼ ⠴ ⠦ ⠧ ⠇ ⠏].freeze
|
|
9
|
+
|
|
10
|
+
STEPS = [
|
|
11
|
+
"Looking up DMARC policy",
|
|
12
|
+
"Resolving default._bimi TXT record",
|
|
13
|
+
"Fetching SVG Tiny PS logo",
|
|
14
|
+
"Validating VMC certificate chain",
|
|
15
|
+
"Verifying mark ownership",
|
|
16
|
+
"Polishing your brand indicator"
|
|
17
|
+
].freeze
|
|
18
|
+
|
|
19
|
+
RAINBOW = [196, 208, 220, 190, 82, 51, 63, 129, 201].freeze
|
|
20
|
+
|
|
21
|
+
def self.check(domain = "yourdomain.example")
|
|
22
|
+
out = $stdout
|
|
23
|
+
return _static(domain, out) unless out.tty?
|
|
24
|
+
|
|
25
|
+
out.sync = true
|
|
26
|
+
out.print("\e[?25l")
|
|
27
|
+
begin
|
|
28
|
+
_banner(out)
|
|
29
|
+
_run_steps(domain, out)
|
|
30
|
+
_victory(domain, out)
|
|
31
|
+
ensure
|
|
32
|
+
out.print("\e[?25h")
|
|
33
|
+
end
|
|
34
|
+
true
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def self._banner(out)
|
|
38
|
+
letters = %w[B I M I]
|
|
39
|
+
8.times do |frame|
|
|
40
|
+
out.print("\r")
|
|
41
|
+
letters.each_with_index do |ch, i|
|
|
42
|
+
color = RAINBOW[(frame + i * 2) % RAINBOW.length]
|
|
43
|
+
out.print("\e[38;5;#{color};1m #{ch} ")
|
|
44
|
+
end
|
|
45
|
+
out.print("\e[0m")
|
|
46
|
+
sleep(0.08)
|
|
47
|
+
end
|
|
48
|
+
out.puts("\e[0m brand indicators for message identification\n\n")
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
def self._run_steps(domain, out)
|
|
52
|
+
STEPS.each_with_index do |step, idx|
|
|
53
|
+
label = "#{step} for \e[1m#{domain}\e[0m"
|
|
54
|
+
frames = 12 + rand(8)
|
|
55
|
+
frames.times do |f|
|
|
56
|
+
color = RAINBOW[(f + idx) % RAINBOW.length]
|
|
57
|
+
out.print("\r\e[38;5;#{color}m#{SPINNER[f % SPINNER.length]}\e[0m #{label}\e[K")
|
|
58
|
+
sleep(0.05)
|
|
59
|
+
end
|
|
60
|
+
out.puts("\r\e[32m✓\e[0m #{label}\e[K")
|
|
61
|
+
end
|
|
62
|
+
out.puts
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
def self._victory(domain, out)
|
|
66
|
+
msg = " BIMI looks good for #{domain}! "
|
|
67
|
+
bar = "═" * msg.length
|
|
68
|
+
out.puts("\e[38;5;82m╔#{bar}╗\e[0m")
|
|
69
|
+
8.times do |frame|
|
|
70
|
+
tinted = msg.each_char.with_index.map do |ch, i|
|
|
71
|
+
color = RAINBOW[(frame + i) % RAINBOW.length]
|
|
72
|
+
"\e[38;5;#{color};1m#{ch}"
|
|
73
|
+
end.join
|
|
74
|
+
out.print("\e[38;5;82m║\e[0m#{tinted}\e[0m\e[38;5;82m║\e[0m\r")
|
|
75
|
+
sleep(0.1)
|
|
76
|
+
end
|
|
77
|
+
out.puts
|
|
78
|
+
out.puts("\e[38;5;82m╚#{bar}╝\e[0m")
|
|
79
|
+
out.puts("\n \e[2mpreview release — real record, SVG, and VMC checks land in a future version\e[0m\n\n")
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
def self._static(domain, out)
|
|
83
|
+
out.puts("BIMI check for #{domain}")
|
|
84
|
+
STEPS.each { |s| out.puts(" ok #{s}") }
|
|
85
|
+
out.puts("BIMI looks good for #{domain}!")
|
|
86
|
+
end
|
|
87
|
+
end
|
data/sig/bimi.rbs
ADDED
metadata
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: bimi
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Steve Whittaker
|
|
8
|
+
bindir: bin
|
|
9
|
+
cert_chain: []
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
|
+
dependencies: []
|
|
12
|
+
description: |
|
|
13
|
+
A Ruby toolkit for working with BIMI — discovering records, fetching and
|
|
14
|
+
validating SVG Tiny PS logos, and verifying VMC and CMC certificate chains.
|
|
15
|
+
This is an early preview release; the public API will grow with subsequent
|
|
16
|
+
versions. Run BIMI.check in a terminal to see an animated placeholder for
|
|
17
|
+
the checker that's coming next.
|
|
18
|
+
email:
|
|
19
|
+
- swhitt@gmail.com
|
|
20
|
+
executables: []
|
|
21
|
+
extensions: []
|
|
22
|
+
extra_rdoc_files: []
|
|
23
|
+
files:
|
|
24
|
+
- README.md
|
|
25
|
+
- lib/bimi.rb
|
|
26
|
+
- lib/bimi/version.rb
|
|
27
|
+
- sig/bimi.rbs
|
|
28
|
+
homepage: https://rubygems.org/gems/bimi
|
|
29
|
+
licenses:
|
|
30
|
+
- MIT
|
|
31
|
+
metadata:
|
|
32
|
+
homepage_uri: https://rubygems.org/gems/bimi
|
|
33
|
+
rubygems_mfa_required: 'true'
|
|
34
|
+
rdoc_options: []
|
|
35
|
+
require_paths:
|
|
36
|
+
- lib
|
|
37
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
38
|
+
requirements:
|
|
39
|
+
- - ">="
|
|
40
|
+
- !ruby/object:Gem::Version
|
|
41
|
+
version: 3.2.0
|
|
42
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
43
|
+
requirements:
|
|
44
|
+
- - ">="
|
|
45
|
+
- !ruby/object:Gem::Version
|
|
46
|
+
version: '0'
|
|
47
|
+
requirements: []
|
|
48
|
+
rubygems_version: 4.0.3
|
|
49
|
+
specification_version: 4
|
|
50
|
+
summary: Ruby toolkit for BIMI (Brand Indicators for Message Identification).
|
|
51
|
+
test_files: []
|