localhost 1.4.0 → 1.4.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2209cedcf5a6630d9733649ad2c73f1f8665034dc82374feab9087efcc34e7f1
4
- data.tar.gz: bd7b98f6d5f3bfbe1a39e436de89679cd2eb8d6006c78bac03b1370ba3d45413
3
+ metadata.gz: 2c43cbd483ba75df04398b4a6e534ec13a4456faa6b373ee1629a6673e6bd133
4
+ data.tar.gz: 53e8080f450ce450e76d4085427fc41c9cd56eced5965672c1766798ebfd709d
5
5
  SHA512:
6
- metadata.gz: dacfd029a503d102243431bc3f012d5a17b946f95ea78bcd3fa0dc9c61bcbfcaac62085e0046cf56f7a8ed92258c95e8130555a11bba69e8cdcd723283b70a49
7
- data.tar.gz: ba94e80e5ffc354b0bfa55cb07aba0827a09ccfc339111c5210fa371d95aee44b3d1cc07663935c07b1e38271bb00732c9eb80b28c9124d3d1ac114f5d66fe55
6
+ metadata.gz: 3869a071d7ee5bd45c5e2ea41edd7a164dba4b4aca54ea46b2618b90ffaeb354761b89c1c3398fc0f39917b2342c63648dbd99e320e49d3ce0f94473e7b90ec0
7
+ data.tar.gz: 823506611fb8b34a2152eeeee30a641e5027333973c7ed2fcde5ef0ada9c60650196101c10b4aa05d8a6a1e296fce2fae770fd1857308c106e516eb1d57f0702
checksums.yaml.gz.sig CHANGED
Binary file
data/bake/localhost.rb ADDED
@@ -0,0 +1,47 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Released under the MIT License.
4
+ # Copyright, 2021-2025, by Samuel Williams.
5
+
6
+ def initialize(...)
7
+ super
8
+
9
+ require_relative "../lib/localhost"
10
+ end
11
+
12
+ # List all local authorities.
13
+ #
14
+ # @returns [Array(Hash)] The certificate and key paths, and the expiry date.
15
+ def list
16
+ Localhost::Authority.list.map do |authority|
17
+ {
18
+ certificate_path: authority.certificate_path,
19
+ key_path: authority.key_path,
20
+ expires_at: authority.certificate.not_after,
21
+ }
22
+ end
23
+ end
24
+
25
+ # Fetch a local authority by hostname. If the authority does not exist, it will be created.
26
+ #
27
+ # @parameter hostname [String] The hostname to fetch.
28
+ # @returns [Hash] The certificate and key paths, and the expiry date.
29
+ def fetch(hostname)
30
+ if authority = Localhost::Authority.fetch(hostname)
31
+ return {
32
+ certificate_path: authority.certificate_path,
33
+ key_path: authority.key_path,
34
+ expires_at: authority.certificate.not_after,
35
+ }
36
+ end
37
+ end
38
+
39
+ def install(name: nil)
40
+ issuer = Localhost::Issuer.fetch(name)
41
+
42
+ Localhost::System.current.install(issuer.certificate_path)
43
+ end
44
+
45
+ def purge
46
+ Localhost::State.purge
47
+ end
@@ -19,7 +19,15 @@ require_relative "issuer"
19
19
  module Localhost
20
20
  # Represents a single public/private key pair for a given hostname.
21
21
  class Authority
22
- # List all certificate authorities in the given directory:
22
+ # @returns [String] The path to the directory containing the certificate authorities.
23
+ def self.path
24
+ State.path
25
+ end
26
+
27
+ # List all certificate authorities in the given directory.
28
+ #
29
+ # @parameter path [String] The path to the directory containing the certificate authorities.
30
+ # @yields [Authority] Each certificate authority in the directory.
23
31
  def self.list(path = State.path)
24
32
  return to_enum(:list, path) unless block_given?
25
33
 
@@ -4,5 +4,5 @@
4
4
  # Copyright, 2018-2024, by Samuel Williams.
5
5
 
6
6
  module Localhost
7
- VERSION = "1.4.0"
7
+ VERSION = "1.4.2"
8
8
  end
data.tar.gz.sig CHANGED
@@ -1,2 +1,2 @@
1
- '�ϲ� ��Iz ��]j���QO���<���c�s���q�'N屄X]qD lĈ�0k��v��f��n^��YS��`]��Te ^/J��#amK�|d��%�`�Y�ۂ�?��Ʊ1sP��`9,^ U:�M���Lbv
2
- Bh*(e��uä65�w9WP�AO0b4�!5�p=�5�K맊�xA��%�p3��;KJ崟�v���6���g�?V���|�I(�Q�!v��6b4�%19�67&���ԇ݇6f�t�����M�`�������0�;"'�#�Ab1z��O'E��
1
+ eq(J�\T<����\\q�/��>�h􈵉jdZ���.����չX��AQPao)!�UYvaYor������;̎]��,�B�m��By��Q4�[o�����L���
2
+ n��OB����#c7��_��UAnᓓQ�;eg�`�e��I��cmV'�=�(�J�j��3`�fe�
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: localhost
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.0
4
+ version: 1.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
@@ -46,12 +46,13 @@ cert_chain:
46
46
  Q2K9NVun/S785AP05vKkXZEFYxqG6EW012U4oLcFl5MySFajYXRYbuUpH6AY+HP8
47
47
  voD0MPg1DssDLKwXyt1eKD/+Fq0bFWhwVM/1XiAXL7lyYUyOq24KHgQ2Csg=
48
48
  -----END CERTIFICATE-----
49
- date: 2025-03-24 00:00:00.000000000 Z
49
+ date: 2025-03-25 00:00:00.000000000 Z
50
50
  dependencies: []
51
51
  executables: []
52
52
  extensions: []
53
53
  extra_rdoc_files: []
54
54
  files:
55
+ - bake/localhost.rb
55
56
  - lib/localhost.rb
56
57
  - lib/localhost/authority.rb
57
58
  - lib/localhost/issuer.rb
metadata.gz.sig CHANGED
Binary file