well_known 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/CHANGELOG.md +19 -0
- data/README.md +181 -0
- data/lib/well_known/client.rb +78 -0
- data/lib/well_known/errors.rb +7 -0
- data/lib/well_known/registry.rb +30 -0
- data/lib/well_known/registry.yml +376 -0
- data/lib/well_known/response.rb +17 -0
- data/lib/well_known/version.rb +3 -0
- data/lib/well_known.rb +21 -0
- metadata +68 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 17b812b145ef2ea1ad10949c21c2b440086f208867733d3719c2568546d0444a
|
|
4
|
+
data.tar.gz: a9d6084c1f1a33f845ee31fbfb001cf6e6d8b0ba5df7992f64d376abe2ac3b52
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: dadcad1d3461db7d1210baee18b24a492aad3fae4cdcee26a9d2234f14895ad21919c32725f680ab886401de950ded3e3c9e358901ababe1117230a59b527994
|
|
7
|
+
data.tar.gz: 35709dd5e37484e4d2d9245c9c6fd680ac5eec54d2e9026029fb8c8560b80a082c940dbceca3c39486fbf4acf5d1e72661f354edf7e64ffc81518e769d2f8e14
|
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
+
and this gem uses to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [Unreleased]
|
|
9
|
+
|
|
10
|
+
## [0.1.0] - 2026-02-18
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- Initial release
|
|
15
|
+
- Client for fetching `/.well-known/{suffix}` URLs from any domain
|
|
16
|
+
- Full IANA well-known URI registry (96 entries)
|
|
17
|
+
- Registry lookup via `.registered?`, `.find`, `.entries`, `.suffixes`
|
|
18
|
+
- Response object with body, status, content_type, headers
|
|
19
|
+
- Thorough test suite
|
data/README.md
ADDED
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
# WellKnown
|
|
2
|
+
|
|
3
|
+
A Ruby gem client for discovering and fetching
|
|
4
|
+
[well-known URLs](https://www.iana.org/assignments/well-known-uris/well-known-uris.xhtml)
|
|
5
|
+
(RFC 8615) from any domain.
|
|
6
|
+
Includes the full IANA well-known URI registry.
|
|
7
|
+
|
|
8
|
+
## Features
|
|
9
|
+
|
|
10
|
+
- Pure Ruby - Works with any Ruby framework or plain scripts
|
|
11
|
+
- Client - Fetch `/.well-known/{suffix}` from any domain
|
|
12
|
+
- Registry - Full IANA well-known URI registry (96 entries)
|
|
13
|
+
- Lookup - Check if a URI suffix is IANA-registered
|
|
14
|
+
|
|
15
|
+
## Installation
|
|
16
|
+
|
|
17
|
+
Add this line to your application's Gemfile:
|
|
18
|
+
|
|
19
|
+
```ruby
|
|
20
|
+
gem 'well_known'
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
And then execute:
|
|
24
|
+
|
|
25
|
+
```ruby
|
|
26
|
+
bundle install
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Or install it yourself as:
|
|
30
|
+
|
|
31
|
+
```ruby
|
|
32
|
+
gem install well_known
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Usage
|
|
36
|
+
|
|
37
|
+
### Client
|
|
38
|
+
|
|
39
|
+
Fetch well-known URLs from any domain:
|
|
40
|
+
|
|
41
|
+
```ruby
|
|
42
|
+
require 'well_known'
|
|
43
|
+
|
|
44
|
+
client = WellKnown::Client.new
|
|
45
|
+
|
|
46
|
+
# Fetch nodeinfo
|
|
47
|
+
response = client.fetch 'mastodon.social', 'nodeinfo'
|
|
48
|
+
puts response.status # => 200
|
|
49
|
+
puts response.body # => '{"links":[...]}'
|
|
50
|
+
puts response.content_type # => 'application/json'
|
|
51
|
+
|
|
52
|
+
# Fetch host-meta
|
|
53
|
+
response = client.fetch 'mastodon.social', 'host-meta'
|
|
54
|
+
puts response.content_type # => 'application/xrd+xml'
|
|
55
|
+
|
|
56
|
+
# Fetch security.txt
|
|
57
|
+
response = client.fetch 'example.com', 'security.txt'
|
|
58
|
+
puts response.body # => 'Contact: security@example.com'
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
#### Build URLs Without Fetching
|
|
62
|
+
|
|
63
|
+
```ruby
|
|
64
|
+
client = WellKnown::Client.new
|
|
65
|
+
|
|
66
|
+
client.url_for 'mastodon.social', 'nodeinfo'
|
|
67
|
+
# => 'https://mastodon.social/.well-known/nodeinfo'
|
|
68
|
+
|
|
69
|
+
client.url_for 'example.com', 'webfinger'
|
|
70
|
+
# => 'https://example.com/.well-known/webfinger'
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
#### Client Options
|
|
74
|
+
|
|
75
|
+
```ruby
|
|
76
|
+
# Custom timeout (default: 10 seconds)
|
|
77
|
+
client = WellKnown::Client.new timeout: 5
|
|
78
|
+
|
|
79
|
+
# Disable redirect following (default: true)
|
|
80
|
+
client = WellKnown::Client.new follow_redirects: false
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
#### Convenience Method
|
|
84
|
+
|
|
85
|
+
```ruby
|
|
86
|
+
client = WellKnown.client
|
|
87
|
+
response = client.fetch 'example.com', 'nodeinfo'
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### Registry
|
|
91
|
+
|
|
92
|
+
Check the IANA well-known URI registry:
|
|
93
|
+
|
|
94
|
+
```ruby
|
|
95
|
+
require 'well_known'
|
|
96
|
+
|
|
97
|
+
# Check if a suffix is registered
|
|
98
|
+
WellKnown::Registry.registered? 'nodeinfo' # => true
|
|
99
|
+
WellKnown::Registry.registered? 'webfinger' # => true
|
|
100
|
+
WellKnown::Registry.registered? 'made-up' # => false
|
|
101
|
+
|
|
102
|
+
# Get details for a registered suffix
|
|
103
|
+
WellKnown::Registry.find 'nodeinfo'
|
|
104
|
+
# => { change_controller: 'NodeInfo Developer Community', reference: 'NodeInfo Diaspora' }
|
|
105
|
+
|
|
106
|
+
WellKnown::Registry.find 'webfinger'
|
|
107
|
+
# => { change_controller: 'IETF', reference: 'RFC 7033' }
|
|
108
|
+
|
|
109
|
+
# List all registered suffixes
|
|
110
|
+
WellKnown::Registry.suffixes
|
|
111
|
+
# => ['acme-challenge', 'agent-card.json', 'amphtml', ...]
|
|
112
|
+
|
|
113
|
+
# Get the full registry
|
|
114
|
+
WellKnown::Registry.entries
|
|
115
|
+
# => { 'acme-challenge' => { ... }, 'agent-card.json' => { ... }, ... }
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
### Response Object
|
|
119
|
+
|
|
120
|
+
The `WellKnown::Response` object wraps the HTTP response:
|
|
121
|
+
|
|
122
|
+
```ruby
|
|
123
|
+
response = client.fetch 'example.com', 'nodeinfo'
|
|
124
|
+
|
|
125
|
+
response.body # => String - the response body
|
|
126
|
+
response.status # => Integer - HTTP status code (e.g., 200)
|
|
127
|
+
response.content_type # => String - MIME type (e.g., 'application/json')
|
|
128
|
+
response.headers # => Hash - all response headers
|
|
129
|
+
response.success? # => Boolean - true if status is 2xx
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
## Error Handling
|
|
133
|
+
|
|
134
|
+
```ruby
|
|
135
|
+
begin
|
|
136
|
+
response = client.fetch 'example.com', 'nodeinfo'
|
|
137
|
+
rescue WellKnown::FetchError => e
|
|
138
|
+
puts "Could not fetch: #{e.message}"
|
|
139
|
+
rescue WellKnown::Error => e
|
|
140
|
+
puts "WellKnown error: #{e.message}"
|
|
141
|
+
end
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
## Development
|
|
145
|
+
|
|
146
|
+
After checking out the repo, run `bin/setup` to install dependencies.
|
|
147
|
+
Then, run `rake spec` to run the tests.
|
|
148
|
+
You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
|
149
|
+
|
|
150
|
+
### Running Tests
|
|
151
|
+
|
|
152
|
+
```ruby
|
|
153
|
+
bundle exec rspec
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
### Running RuboCop
|
|
157
|
+
|
|
158
|
+
```ruby
|
|
159
|
+
bundle exec rubocop
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
### Running All Checks
|
|
163
|
+
|
|
164
|
+
```ruby
|
|
165
|
+
bundle exec rake
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
## Contributing
|
|
169
|
+
|
|
170
|
+
Bug reports and pull requests are welcome on GitHub at the
|
|
171
|
+
https://github.com/xoengineering/well_known repo.
|
|
172
|
+
|
|
173
|
+
## License
|
|
174
|
+
|
|
175
|
+
The gem is available as open source under the terms of the
|
|
176
|
+
[MIT License](https://opensource.org/licenses/MIT).
|
|
177
|
+
|
|
178
|
+
## References
|
|
179
|
+
|
|
180
|
+
- [RFC 8615 - Well-Known URIs](https://tools.ietf.org/html/rfc8615)
|
|
181
|
+
- [IANA Well-Known URI Registry](https://www.iana.org/assignments/well-known-uris/well-known-uris.xhtml)
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
require 'http'
|
|
2
|
+
require 'uri'
|
|
3
|
+
|
|
4
|
+
module WellKnown
|
|
5
|
+
# Client for fetching well-known URLs from any domain
|
|
6
|
+
#
|
|
7
|
+
# @example Fetch nodeinfo
|
|
8
|
+
# client = WellKnown::Client.new
|
|
9
|
+
# response = client.fetch("mastodon.social", "nodeinfo")
|
|
10
|
+
# puts response.body
|
|
11
|
+
class Client
|
|
12
|
+
WELL_KNOWN_PREFIX = '/.well-known/'.freeze
|
|
13
|
+
|
|
14
|
+
attr_reader :timeout, :follow_redirects
|
|
15
|
+
|
|
16
|
+
# Initialize a new client
|
|
17
|
+
# @param timeout [Integer] HTTP timeout in seconds (default: 10)
|
|
18
|
+
# @param follow_redirects [Boolean] Whether to follow HTTP redirects (default: true)
|
|
19
|
+
def initialize timeout: 10, follow_redirects: true
|
|
20
|
+
@timeout = timeout
|
|
21
|
+
@follow_redirects = follow_redirects
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
# Fetch a well-known URL for a domain
|
|
25
|
+
# @param domain [String] The domain to fetch from (e.g., "mastodon.social")
|
|
26
|
+
# @param suffix [String] The well-known URI suffix (e.g., "nodeinfo")
|
|
27
|
+
# @return [WellKnown::Response]
|
|
28
|
+
# @raise [WellKnown::FetchError] If the request fails
|
|
29
|
+
def fetch domain, suffix
|
|
30
|
+
url = url_for domain, suffix
|
|
31
|
+
response = http_client.get url
|
|
32
|
+
|
|
33
|
+
raise FetchError, "HTTP #{response.code}" unless response.status.success?
|
|
34
|
+
|
|
35
|
+
Response.new body: response.body.to_s,
|
|
36
|
+
status: response.code,
|
|
37
|
+
content_type: response.content_type.mime_type,
|
|
38
|
+
headers: response.headers.to_h
|
|
39
|
+
rescue HTTP::Error => e
|
|
40
|
+
raise FetchError, "HTTP request failed: #{e.message}"
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
# Discover all well-known URLs that respond successfully on a domain
|
|
44
|
+
# @param domain [String] The domain to scan (e.g., "mastodon.social")
|
|
45
|
+
# @param suffixes [Array<String>] URI suffixes to try (default: all IANA-registered suffixes)
|
|
46
|
+
# @return [Hash{String => WellKnown::Response}] suffix => response for each successful fetch
|
|
47
|
+
def discover_all domain, suffixes: Registry.suffixes
|
|
48
|
+
suffixes.each_with_object({}) do |suffix, results|
|
|
49
|
+
results[suffix] = fetch domain, suffix
|
|
50
|
+
rescue FetchError
|
|
51
|
+
next
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
# Build the well-known URL for a domain and suffix
|
|
56
|
+
# @param domain [String] The domain (e.g., "mastodon.social")
|
|
57
|
+
# @param suffix [String] The URI suffix (e.g., "nodeinfo")
|
|
58
|
+
# @return [String] The full URL
|
|
59
|
+
def url_for domain, suffix
|
|
60
|
+
domain = domain.delete_prefix 'https://'
|
|
61
|
+
domain = domain.delete_prefix 'http://'
|
|
62
|
+
domain = domain.chomp '/'
|
|
63
|
+
|
|
64
|
+
host = URI.parse("https://#{domain}").host
|
|
65
|
+
path = [WELL_KNOWN_PREFIX, suffix].join
|
|
66
|
+
|
|
67
|
+
URI::HTTPS.build(host: host, path: path).to_s
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
private
|
|
71
|
+
|
|
72
|
+
def http_client
|
|
73
|
+
client = HTTP.timeout timeout
|
|
74
|
+
client = client.follow if follow_redirects
|
|
75
|
+
client
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
end
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
require 'yaml'
|
|
2
|
+
|
|
3
|
+
module WellKnown
|
|
4
|
+
# IANA Well-Known URI registry
|
|
5
|
+
# https://www.iana.org/assignments/well-known-uris/well-known-uris.xhtml
|
|
6
|
+
module Registry
|
|
7
|
+
YAML_FILE = YAML.load_file File.expand_path 'registry.yml', __dir__
|
|
8
|
+
ENTRIES = YAML_FILE.transform_values { it.transform_keys(&:to_sym) }.freeze
|
|
9
|
+
|
|
10
|
+
class << self
|
|
11
|
+
# Check if a URI suffix is registered in the IANA registry
|
|
12
|
+
# @param suffix [String]
|
|
13
|
+
# @return [Boolean]
|
|
14
|
+
def registered?(suffix) = ENTRIES.key? suffix
|
|
15
|
+
|
|
16
|
+
# Return all registered entries
|
|
17
|
+
# @return [Hash]
|
|
18
|
+
def entries = ENTRIES
|
|
19
|
+
|
|
20
|
+
# Find entry details for a given URI suffix
|
|
21
|
+
# @param suffix [String]
|
|
22
|
+
# @return [Hash, nil]
|
|
23
|
+
def find(suffix) = ENTRIES[suffix]
|
|
24
|
+
|
|
25
|
+
# Return all registered URI suffixes
|
|
26
|
+
# @return [Array<String>]
|
|
27
|
+
def suffixes = ENTRIES.keys
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
@@ -0,0 +1,376 @@
|
|
|
1
|
+
---
|
|
2
|
+
acme-challenge:
|
|
3
|
+
change_controller: IETF
|
|
4
|
+
reference: RFC 8555, Section 8.3
|
|
5
|
+
|
|
6
|
+
agent-card.json:
|
|
7
|
+
change_controller: Linux Foundation
|
|
8
|
+
reference: A2A Project Specification
|
|
9
|
+
|
|
10
|
+
amphtml:
|
|
11
|
+
change_controller: AMP Project (OpenJS Foundation)
|
|
12
|
+
reference: Google AMP Cache Update
|
|
13
|
+
|
|
14
|
+
api-catalog:
|
|
15
|
+
change_controller: IETF
|
|
16
|
+
reference: RFC 9727
|
|
17
|
+
|
|
18
|
+
appspecific:
|
|
19
|
+
change_controller: Bruce Leban
|
|
20
|
+
reference: well-known-uri-appspecific
|
|
21
|
+
|
|
22
|
+
ashrae:
|
|
23
|
+
change_controller: ASHRAE
|
|
24
|
+
reference: BACnet Addenda Add-135-2012am
|
|
25
|
+
|
|
26
|
+
assetlinks.json:
|
|
27
|
+
change_controller: Google Inc.
|
|
28
|
+
reference: Digital Asset Links
|
|
29
|
+
|
|
30
|
+
broadband-labels:
|
|
31
|
+
change_controller: BITAG
|
|
32
|
+
reference: BITAG Broadband Labels
|
|
33
|
+
|
|
34
|
+
brski:
|
|
35
|
+
change_controller: IETF
|
|
36
|
+
reference: RFC 8995
|
|
37
|
+
|
|
38
|
+
caldav:
|
|
39
|
+
change_controller: IETF
|
|
40
|
+
reference: RFC 6764
|
|
41
|
+
|
|
42
|
+
carddav:
|
|
43
|
+
change_controller: IETF
|
|
44
|
+
reference: RFC 6764
|
|
45
|
+
|
|
46
|
+
change-password:
|
|
47
|
+
change_controller: W3C
|
|
48
|
+
reference: W3C WebAppSec Change Password
|
|
49
|
+
|
|
50
|
+
cmp:
|
|
51
|
+
change_controller: IETF
|
|
52
|
+
reference: RFC 9811, RFC 9482
|
|
53
|
+
|
|
54
|
+
coap:
|
|
55
|
+
change_controller: IETF
|
|
56
|
+
reference: RFC 8323
|
|
57
|
+
|
|
58
|
+
coap-eap:
|
|
59
|
+
change_controller: IETF
|
|
60
|
+
reference: RFC 9820
|
|
61
|
+
|
|
62
|
+
core:
|
|
63
|
+
change_controller: IETF
|
|
64
|
+
reference: RFC 6690
|
|
65
|
+
|
|
66
|
+
csaf:
|
|
67
|
+
change_controller: OASIS Open
|
|
68
|
+
reference: CSAF Version 2.0
|
|
69
|
+
|
|
70
|
+
csaf-aggregator:
|
|
71
|
+
change_controller: OASIS Open
|
|
72
|
+
reference: CSAF Version 2.0
|
|
73
|
+
|
|
74
|
+
csvm:
|
|
75
|
+
change_controller: W3C
|
|
76
|
+
reference: W3C Tabular Data Model
|
|
77
|
+
|
|
78
|
+
did.json:
|
|
79
|
+
change_controller: W3C CCG
|
|
80
|
+
reference: DID Method Web
|
|
81
|
+
|
|
82
|
+
did-configuration.json:
|
|
83
|
+
change_controller: DIF
|
|
84
|
+
reference: DID Configuration
|
|
85
|
+
|
|
86
|
+
dnt:
|
|
87
|
+
change_controller: W3C
|
|
88
|
+
reference: W3C Tracking DNT Status
|
|
89
|
+
|
|
90
|
+
dnt-policy.txt:
|
|
91
|
+
change_controller: EFF
|
|
92
|
+
reference: EFF DNT Policy
|
|
93
|
+
|
|
94
|
+
dots:
|
|
95
|
+
change_controller: IETF
|
|
96
|
+
reference: RFC 9132
|
|
97
|
+
|
|
98
|
+
easy-proxy:
|
|
99
|
+
change_controller: The G3 Project
|
|
100
|
+
reference: G3 Project
|
|
101
|
+
|
|
102
|
+
ecips:
|
|
103
|
+
change_controller: Wei Tang
|
|
104
|
+
reference: ECIPS URI Specification
|
|
105
|
+
|
|
106
|
+
edhoc:
|
|
107
|
+
change_controller: IETF
|
|
108
|
+
reference: RFC 9528
|
|
109
|
+
|
|
110
|
+
enterprise-network-security:
|
|
111
|
+
change_controller: ETSI TC CYBER
|
|
112
|
+
reference: ETSI TS 103 523-5
|
|
113
|
+
|
|
114
|
+
enterprise-transport-security:
|
|
115
|
+
change_controller: ETSI TC CYBER
|
|
116
|
+
reference: ETSI TS 103 523-3
|
|
117
|
+
|
|
118
|
+
est:
|
|
119
|
+
change_controller: IETF
|
|
120
|
+
reference: RFC 7030, RFC 9148
|
|
121
|
+
|
|
122
|
+
funding-manifest-urls:
|
|
123
|
+
change_controller: floss.fund
|
|
124
|
+
reference: FundingJSON.org
|
|
125
|
+
|
|
126
|
+
genid:
|
|
127
|
+
change_controller: W3C
|
|
128
|
+
reference: RDF 1.1 Concepts
|
|
129
|
+
|
|
130
|
+
gnap-as-rs:
|
|
131
|
+
change_controller: IETF
|
|
132
|
+
reference: RFC 9767, Section 3.1
|
|
133
|
+
|
|
134
|
+
gpc.json:
|
|
135
|
+
change_controller: Global Privacy Control Project
|
|
136
|
+
reference: GPC Specification
|
|
137
|
+
|
|
138
|
+
gs1resolver:
|
|
139
|
+
change_controller: GS1
|
|
140
|
+
reference: GS1 Digital Link
|
|
141
|
+
|
|
142
|
+
hoba:
|
|
143
|
+
change_controller: IETF
|
|
144
|
+
reference: RFC 7486, Section 6
|
|
145
|
+
|
|
146
|
+
host-meta:
|
|
147
|
+
change_controller: IETF
|
|
148
|
+
reference: RFC 6415
|
|
149
|
+
|
|
150
|
+
host-meta.json:
|
|
151
|
+
change_controller: IETF
|
|
152
|
+
reference: RFC 6415
|
|
153
|
+
|
|
154
|
+
hosting-provider:
|
|
155
|
+
change_controller: Automattic Inc.
|
|
156
|
+
reference: Automattic Hosting Provider
|
|
157
|
+
|
|
158
|
+
http-opportunistic:
|
|
159
|
+
change_controller: IETF
|
|
160
|
+
reference: RFC 8164 (OBSOLETED)
|
|
161
|
+
|
|
162
|
+
ic-domains:
|
|
163
|
+
change_controller: DFINITY Foundation
|
|
164
|
+
reference: Internet Computer
|
|
165
|
+
|
|
166
|
+
idp-proxy:
|
|
167
|
+
change_controller: IETF
|
|
168
|
+
reference: RFC 8827
|
|
169
|
+
|
|
170
|
+
jmap:
|
|
171
|
+
change_controller: IETF
|
|
172
|
+
reference: RFC 8620, Section 2.2
|
|
173
|
+
|
|
174
|
+
keybase.txt:
|
|
175
|
+
change_controller: The Keybase Project
|
|
176
|
+
reference: Keybase Well-Known
|
|
177
|
+
|
|
178
|
+
knx:
|
|
179
|
+
change_controller: KNX Association
|
|
180
|
+
reference: KNX Cloud Specification
|
|
181
|
+
|
|
182
|
+
looking-glass:
|
|
183
|
+
change_controller: M. Stubbig
|
|
184
|
+
reference: RFC 8522, Section 2
|
|
185
|
+
|
|
186
|
+
masque:
|
|
187
|
+
change_controller: IETF
|
|
188
|
+
reference: RFC 9298, RFC 9484
|
|
189
|
+
|
|
190
|
+
matrix:
|
|
191
|
+
change_controller: The Matrix.org Foundation C.I.C.
|
|
192
|
+
reference: Matrix Spec
|
|
193
|
+
|
|
194
|
+
mercure:
|
|
195
|
+
change_controller: Les-Tilleuls.coop
|
|
196
|
+
reference: Mercure Protocol
|
|
197
|
+
|
|
198
|
+
mta-sts.txt:
|
|
199
|
+
change_controller: IETF
|
|
200
|
+
reference: RFC 8461
|
|
201
|
+
|
|
202
|
+
nfv-oauth-server-configuration:
|
|
203
|
+
change_controller: ETSI
|
|
204
|
+
reference: ETSI GS NFV-SEC 022
|
|
205
|
+
|
|
206
|
+
ni:
|
|
207
|
+
change_controller: IETF
|
|
208
|
+
reference: RFC 6920
|
|
209
|
+
|
|
210
|
+
nodeinfo:
|
|
211
|
+
change_controller: NodeInfo Developer Community
|
|
212
|
+
reference: NodeInfo Diaspora
|
|
213
|
+
|
|
214
|
+
nostr.json:
|
|
215
|
+
change_controller: Nostr Developer Community
|
|
216
|
+
reference: Nostr NIP-05
|
|
217
|
+
|
|
218
|
+
oauth-authorization-server:
|
|
219
|
+
change_controller: IESG
|
|
220
|
+
reference: RFC 8414, Section 3
|
|
221
|
+
|
|
222
|
+
oauth-protected-resource:
|
|
223
|
+
change_controller: IETF
|
|
224
|
+
reference: RFC 9728, Section 3
|
|
225
|
+
|
|
226
|
+
ohttp-gateway:
|
|
227
|
+
change_controller: IETF
|
|
228
|
+
reference: RFC 9540
|
|
229
|
+
|
|
230
|
+
openid-federation:
|
|
231
|
+
change_controller: OpenID Foundation
|
|
232
|
+
reference: OpenID Federation 1.0
|
|
233
|
+
|
|
234
|
+
open-resource-discovery:
|
|
235
|
+
change_controller: SAP SE
|
|
236
|
+
reference: SAP Open Resource Discovery
|
|
237
|
+
|
|
238
|
+
openid-configuration:
|
|
239
|
+
change_controller: OpenID Foundation
|
|
240
|
+
reference: OpenID Connect Discovery 1.0
|
|
241
|
+
|
|
242
|
+
openorg:
|
|
243
|
+
change_controller: Christopher Gutteridge
|
|
244
|
+
reference: Open Data Portal
|
|
245
|
+
|
|
246
|
+
oslc:
|
|
247
|
+
change_controller: OASIS
|
|
248
|
+
reference: OSLC Core Version 3.0
|
|
249
|
+
|
|
250
|
+
pki-validation:
|
|
251
|
+
change_controller: CA/Browser Forum
|
|
252
|
+
reference: Baseline Requirements
|
|
253
|
+
|
|
254
|
+
posh:
|
|
255
|
+
change_controller: IETF
|
|
256
|
+
reference: RFC 7711
|
|
257
|
+
|
|
258
|
+
privacy-sandbox-attestations.json:
|
|
259
|
+
change_controller: Google Inc.
|
|
260
|
+
reference: Privacy Sandbox Attestation
|
|
261
|
+
|
|
262
|
+
private-token-issuer-directory:
|
|
263
|
+
change_controller: IETF
|
|
264
|
+
reference: RFC 9578
|
|
265
|
+
|
|
266
|
+
probing.txt:
|
|
267
|
+
change_controller: IETF
|
|
268
|
+
reference: RFC 9511
|
|
269
|
+
|
|
270
|
+
pvd:
|
|
271
|
+
change_controller: IETF
|
|
272
|
+
reference: RFC 8801
|
|
273
|
+
|
|
274
|
+
rd:
|
|
275
|
+
change_controller: IETF
|
|
276
|
+
reference: RFC 9176
|
|
277
|
+
|
|
278
|
+
related-website-set.json:
|
|
279
|
+
change_controller: Google Inc.
|
|
280
|
+
reference: Related Website Sets
|
|
281
|
+
|
|
282
|
+
reload-config:
|
|
283
|
+
change_controller: IETF
|
|
284
|
+
reference: RFC 6940
|
|
285
|
+
|
|
286
|
+
repute-template:
|
|
287
|
+
change_controller: IETF
|
|
288
|
+
reference: RFC 7072
|
|
289
|
+
|
|
290
|
+
resourcesync:
|
|
291
|
+
change_controller: NISO
|
|
292
|
+
reference: Open Archives ResourceSync
|
|
293
|
+
|
|
294
|
+
sbom:
|
|
295
|
+
change_controller: IETF
|
|
296
|
+
reference: RFC 9472
|
|
297
|
+
|
|
298
|
+
security.txt:
|
|
299
|
+
change_controller: IETF
|
|
300
|
+
reference: RFC 9116
|
|
301
|
+
|
|
302
|
+
ssf-configuration:
|
|
303
|
+
change_controller: OpenID Shared Signals WG
|
|
304
|
+
reference: OpenID Shared Signals Framework
|
|
305
|
+
|
|
306
|
+
ssh-known-hosts:
|
|
307
|
+
change_controller: David Crawshaw
|
|
308
|
+
reference: C2SP Well-Known SSH Hosts
|
|
309
|
+
|
|
310
|
+
sshfp:
|
|
311
|
+
change_controller: Cynthia Revström
|
|
312
|
+
reference: SSHFP Specification
|
|
313
|
+
|
|
314
|
+
stun-key:
|
|
315
|
+
change_controller: IETF
|
|
316
|
+
reference: RFC 7635
|
|
317
|
+
|
|
318
|
+
terraform.json:
|
|
319
|
+
change_controller: HashiCorp
|
|
320
|
+
reference: Terraform Remote Discovery
|
|
321
|
+
|
|
322
|
+
thread:
|
|
323
|
+
change_controller: Thread Group Inc.
|
|
324
|
+
reference: Thread Group Specifications
|
|
325
|
+
|
|
326
|
+
time:
|
|
327
|
+
change_controller: Poul-Henning Kamp
|
|
328
|
+
reference: FreeBSD Time Specification
|
|
329
|
+
|
|
330
|
+
timezone:
|
|
331
|
+
change_controller: IESG
|
|
332
|
+
reference: RFC 7808
|
|
333
|
+
|
|
334
|
+
tdmrep.json:
|
|
335
|
+
change_controller: W3C
|
|
336
|
+
reference: W3C TDM Report
|
|
337
|
+
|
|
338
|
+
tor-relay:
|
|
339
|
+
change_controller: Tor Project
|
|
340
|
+
reference: Tor Relay Well-Known URI
|
|
341
|
+
|
|
342
|
+
traffic-advice:
|
|
343
|
+
change_controller: Jeremy Roman
|
|
344
|
+
reference: Private Prefetch Proxy
|
|
345
|
+
|
|
346
|
+
trust.txt:
|
|
347
|
+
change_controller: JournalList.net
|
|
348
|
+
reference: Trust.txt Reference
|
|
349
|
+
|
|
350
|
+
uma2-configuration:
|
|
351
|
+
change_controller: Kantara UMA WG
|
|
352
|
+
reference: UMA 2.0 OAuth Grant
|
|
353
|
+
|
|
354
|
+
void:
|
|
355
|
+
change_controller: W3C
|
|
356
|
+
reference: Vocabulary of Interlinked Data
|
|
357
|
+
|
|
358
|
+
webauthn:
|
|
359
|
+
change_controller: W3C
|
|
360
|
+
reference: WebAuthn Level 3
|
|
361
|
+
|
|
362
|
+
webfinger:
|
|
363
|
+
change_controller: IETF
|
|
364
|
+
reference: RFC 7033
|
|
365
|
+
|
|
366
|
+
webhook-authorized-senders.json:
|
|
367
|
+
change_controller: Intempus ApS
|
|
368
|
+
reference: Webhook Authorization
|
|
369
|
+
|
|
370
|
+
webweaver.json:
|
|
371
|
+
change_controller: DigiOnline GmbH
|
|
372
|
+
reference: WebWeaver Well-Known Resource
|
|
373
|
+
|
|
374
|
+
wot:
|
|
375
|
+
change_controller: W3C WoT WG
|
|
376
|
+
reference: W3C WoT Discovery
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
module WellKnown
|
|
2
|
+
# Wraps an HTTP response from a well-known URL fetch
|
|
3
|
+
class Response
|
|
4
|
+
attr_reader :body, :status, :content_type, :headers
|
|
5
|
+
|
|
6
|
+
def initialize body:, status:, content_type: nil, headers: {}
|
|
7
|
+
@body = body
|
|
8
|
+
@status = status
|
|
9
|
+
@content_type = content_type
|
|
10
|
+
@headers = headers
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def success?
|
|
14
|
+
(200...300).cover? status
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
data/lib/well_known.rb
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
require_relative 'well_known/version'
|
|
2
|
+
require_relative 'well_known/errors'
|
|
3
|
+
require_relative 'well_known/registry'
|
|
4
|
+
require_relative 'well_known/response'
|
|
5
|
+
require_relative 'well_known/client'
|
|
6
|
+
|
|
7
|
+
# Discover and fetch well-known URLs (RFC 8615) for any domain
|
|
8
|
+
#
|
|
9
|
+
# @example Fetch a well-known URL
|
|
10
|
+
# client = WellKnown::Client.new
|
|
11
|
+
# response = client.fetch("mastodon.social", "nodeinfo")
|
|
12
|
+
#
|
|
13
|
+
# @example Check if a URI suffix is registered
|
|
14
|
+
# WellKnown::Registry.registered?("nodeinfo") # => true
|
|
15
|
+
module WellKnown
|
|
16
|
+
class << self
|
|
17
|
+
# Create a new WellKnown client
|
|
18
|
+
# @return [WellKnown::Client]
|
|
19
|
+
def client = Client.new
|
|
20
|
+
end
|
|
21
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: well_known
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Shane Becker
|
|
8
|
+
bindir: exe
|
|
9
|
+
cert_chain: []
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
|
+
dependencies:
|
|
12
|
+
- !ruby/object:Gem::Dependency
|
|
13
|
+
name: http
|
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
|
15
|
+
requirements:
|
|
16
|
+
- - "~>"
|
|
17
|
+
- !ruby/object:Gem::Version
|
|
18
|
+
version: '5.0'
|
|
19
|
+
type: :runtime
|
|
20
|
+
prerelease: false
|
|
21
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
22
|
+
requirements:
|
|
23
|
+
- - "~>"
|
|
24
|
+
- !ruby/object:Gem::Version
|
|
25
|
+
version: '5.0'
|
|
26
|
+
description: |
|
|
27
|
+
A pure Ruby client for discovering and fetching well-known URLs (RFC 8615)
|
|
28
|
+
from any domain. Includes the full IANA well-known URI registry.
|
|
29
|
+
email:
|
|
30
|
+
- veganstraightedge@gmail.com
|
|
31
|
+
executables: []
|
|
32
|
+
extensions: []
|
|
33
|
+
extra_rdoc_files: []
|
|
34
|
+
files:
|
|
35
|
+
- CHANGELOG.md
|
|
36
|
+
- README.md
|
|
37
|
+
- lib/well_known.rb
|
|
38
|
+
- lib/well_known/client.rb
|
|
39
|
+
- lib/well_known/errors.rb
|
|
40
|
+
- lib/well_known/registry.rb
|
|
41
|
+
- lib/well_known/registry.yml
|
|
42
|
+
- lib/well_known/response.rb
|
|
43
|
+
- lib/well_known/version.rb
|
|
44
|
+
homepage: https://github.com/xoengineering/well_known
|
|
45
|
+
licenses:
|
|
46
|
+
- MIT
|
|
47
|
+
metadata:
|
|
48
|
+
source_code_uri: https://github.com/xoengineering/well_known
|
|
49
|
+
changelog_uri: https://github.com/xoengineering/well_known/blob/main/CHANGELOG.md
|
|
50
|
+
rubygems_mfa_required: 'true'
|
|
51
|
+
rdoc_options: []
|
|
52
|
+
require_paths:
|
|
53
|
+
- lib
|
|
54
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
55
|
+
requirements:
|
|
56
|
+
- - ">="
|
|
57
|
+
- !ruby/object:Gem::Version
|
|
58
|
+
version: 4.0.0
|
|
59
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
60
|
+
requirements:
|
|
61
|
+
- - ">="
|
|
62
|
+
- !ruby/object:Gem::Version
|
|
63
|
+
version: '0'
|
|
64
|
+
requirements: []
|
|
65
|
+
rubygems_version: 4.0.3
|
|
66
|
+
specification_version: 4
|
|
67
|
+
summary: Discover well-known URLs for any domain
|
|
68
|
+
test_files: []
|