triauth 0.0.1 → 1.0.0.beta.4

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.
Files changed (46) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +56 -0
  3. data/LICENSE +202 -28
  4. data/README.md +2036 -7
  5. data/lib/triauth/api/attestation.rb +419 -0
  6. data/lib/triauth/api/authentication.rb +651 -0
  7. data/lib/triauth/api/identity.rb +245 -0
  8. data/lib/triauth/api/signing.rb +740 -0
  9. data/lib/triauth/api/validation.rb +162 -0
  10. data/lib/triauth/api.rb +33 -0
  11. data/lib/triauth/authentication_endpoint.rb +196 -0
  12. data/lib/triauth/challenge.rb +115 -0
  13. data/lib/triauth/challenge_response_flow.rb +344 -0
  14. data/lib/triauth/config.rb +93 -0
  15. data/lib/triauth/error.rb +95 -0
  16. data/lib/triauth/helpers.rb +1222 -0
  17. data/lib/triauth/identity.rb +301 -0
  18. data/lib/triauth/identity_domain.rb +212 -0
  19. data/lib/triauth/identity_includes.rb +249 -0
  20. data/lib/triauth/identity_keys.rb +309 -0
  21. data/lib/triauth/logger.rb +156 -0
  22. data/lib/triauth/multi_signature.rb +177 -0
  23. data/lib/triauth/protocol.rb +74 -0
  24. data/lib/triauth/request_cipher.rb +121 -0
  25. data/lib/triauth/resolvers/base.rb +147 -0
  26. data/lib/triauth/resolvers/caching_resolver.rb +202 -0
  27. data/lib/triauth/resolvers/cloudflare.rb +40 -0
  28. data/lib/triauth/resolvers/dns_json.rb +391 -0
  29. data/lib/triauth/resolvers/dns_sb.rb +40 -0
  30. data/lib/triauth/resolvers/google.rb +39 -0
  31. data/lib/triauth/resolvers/multi_resolver.rb +202 -0
  32. data/lib/triauth/resolvers/system_dns.rb +259 -0
  33. data/lib/triauth/resolvers.rb +33 -0
  34. data/lib/triauth/response.rb +142 -0
  35. data/lib/triauth/response_cipher.rb +341 -0
  36. data/lib/triauth/signature.rb +405 -0
  37. data/lib/triauth/validator.rb +549 -0
  38. data/lib/triauth/verifiers/base.rb +147 -0
  39. data/lib/triauth/verifiers/ecdsa.rb +87 -0
  40. data/lib/triauth/verifiers/ed25519.rb +89 -0
  41. data/lib/triauth/verifiers/registry.rb +52 -0
  42. data/lib/triauth/verifiers/web_authn.rb +253 -0
  43. data/lib/triauth/verifiers.rb +37 -0
  44. data/lib/triauth/version.rb +23 -0
  45. data/lib/triauth.rb +104 -7
  46. metadata +55 -13
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright (c) 2026 The Triauth Authors (https://www.triauth.org/)
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+ #
17
+ # SPDX-License-Identifier: Apache-2.0
18
+
19
+
20
+ module Triauth
21
+ # The gem version (RubyGems prerelease syntax for triauth-js 1.0.0-beta.4); the protocol version lives in `Triauth::Protocol::VERSION`.
22
+ VERSION = '1.0.0.beta.4'
23
+ end
data/lib/triauth.rb CHANGED
@@ -1,14 +1,111 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Official placeholder for the triauth project. See https://www.triauth.org/.
3
+ # Copyright (c) 2026 The Triauth Authors (https://www.triauth.org/)
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+ #
17
+ # SPDX-License-Identifier: Apache-2.0
18
+
19
+
20
+ require_relative 'triauth/version'
21
+ require_relative 'triauth/protocol'
22
+ require_relative 'triauth/config'
23
+ require_relative 'triauth/error'
24
+ require_relative 'triauth/logger'
25
+ require_relative 'triauth/helpers'
26
+ require_relative 'triauth/verifiers'
27
+ require_relative 'triauth/resolvers'
28
+ require_relative 'triauth/validator'
29
+ require_relative 'triauth/authentication_endpoint'
30
+ require_relative 'triauth/identity_domain'
31
+ require_relative 'triauth/identity_keys'
32
+ require_relative 'triauth/identity_includes'
33
+ require_relative 'triauth/identity'
34
+ require_relative 'triauth/signature'
35
+ require_relative 'triauth/multi_signature'
36
+ require_relative 'triauth/challenge'
37
+ require_relative 'triauth/response'
38
+ require_relative 'triauth/response_cipher'
39
+ require_relative 'triauth/request_cipher'
40
+ require_relative 'triauth/challenge_response_flow'
41
+ require_relative 'triauth/api'
42
+
43
+ # Entry point of triauth-ruby, assembling the `Triauth` namespace.
44
+ #
45
+ # Example use:
46
+ #
47
+ # ```ruby
48
+ # require 'triauth'
49
+ # Triauth.authenticate(...)
50
+ # ```
4
51
  module Triauth
5
- VERSION = "0.0.1"
52
+ # Top-level classes and namespaces
53
+ # (the `export` lines have no counterpart: `Helpers`, `Logger`, `Validator`, `Error`, `Identity`, `IdentityKeys`,
54
+ # `IdentityIncludes`, `IdentityDomain`, `AuthenticationEndpoint`, `Challenge`, `Response`, `Signature`, `MultiSignature`,
55
+ # `ChallengeResponseFlow`, `Triauth.config`, `Resolvers`, `Verifiers` and `Api` are defined on this module by the files required above)
56
+
57
+ # `index.js` re-exports `LIMITS` of `protocol.js` at the top level; so does the port.
58
+ LIMITS = Protocol::LIMITS
59
+
60
+ # Top-level API method aliases
61
+ class << self
62
+ # (see ::Triauth::Api::Authentication.authenticate)
63
+ # (`options = {}`: a missing argument is the JS `undefined`, which `ChallengeResponseFlow.perform`'s own default turns into `{}` (`invalid_arguments` from the stage detection); an explicit nil is the JS `null` (`invalid_arguments` from the known-keys guard))
64
+ def authenticate(options = {}, config = {}) = Api::Authentication.authenticate(options, config)
65
+
66
+ # (see ::Triauth::Api::Authentication.check)
67
+ def check(options = nil, config = {}) = Api::Authentication.check(options, config)
68
+
69
+ # (see ::Triauth::Api::Authentication.ping)
70
+ # (`options = {}`: as for `authenticate`)
71
+ def ping(options = {}, config = {}) = Api::Authentication.ping(options, config)
72
+
73
+ # (see ::Triauth::Api::Attestation.attest)
74
+ def attest(options = nil, config = {}) = Api::Attestation.attest(options, config)
75
+
76
+ # (see ::Triauth::Api::Identity.whois)
77
+ def whois(options = nil, config = {}) = Api::Identity.whois(options, config)
78
+
79
+ # (see ::Triauth::Api::Validation.validate)
80
+ def validate(objects = nil, config = {}) = Api::Validation.validate(objects, config)
81
+
82
+ # (see ::Triauth::Api::Signing.sign)
83
+ def sign(options = nil, config = {}) = Api::Signing.sign(options, config)
84
+
85
+ # (see ::Triauth::Api::Signing.stamp)
86
+ def stamp(options = nil, config = {}) = Api::Signing.stamp(options, config)
87
+
88
+ # (see ::Triauth::Api::Signing.verify)
89
+ def verify(message = nil, signature = nil, constraints = {}, config = {}) = Api::Signing.verify(message, signature, constraints, config)
90
+ end
91
+
92
+ # Initialize defaults that depend on constructed instances
6
93
 
7
- MESSAGE = "triauth for Ruby has not been released yet.\n" \
8
- "This package name is reserved by the triauth project to prevent supply-chain confusion.\n" \
9
- "See https://www.triauth.org/"
94
+ # `config.logger ??= ...`: assign only when nullish
95
+ config[:logger] = Logger.new(Logger::CONSOLE, { logLevel: 'error', prefix: '[triauth]' }) if config[:logger].nil?
10
96
 
11
- def self.method_missing(*) = raise(NotImplementedError, MESSAGE)
97
+ # `config.resolver ??= ...`: assign only when nullish (`4e3` and `8.5e3` are these Integers; `NodeDns` is `SystemDns`)
98
+ if config[:resolver].nil?
99
+ config[:resolver] = Resolvers::MultiResolver.new(
100
+ [
101
+ Resolvers::Cloudflare.new({ retries: 1, timeout: 4000 }),
102
+ Resolvers::Google.new({ retries: 1, timeout: 4000 }),
103
+ Resolvers::SystemDns.new({ timeout: 4000 })
104
+ ],
105
+ { maxFailures: 1, timeout: 8500 }
106
+ )
107
+ end
12
108
 
13
- def self.respond_to_missing?(*) = true
109
+ # Web browser specific - dispatch a `triauth:ready` event when loaded
110
+ # (dropped: the `typeof window` browser lane has no counterpart in a server-side Ruby gem)
14
111
  end
metadata CHANGED
@@ -1,34 +1,77 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: triauth
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 1.0.0.beta.4
5
5
  platform: ruby
6
6
  authors:
7
- - Triauth
8
- autorequire:
7
+ - The Triauth Authors
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2026-06-12 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies: []
13
- description: 'triauth: password-less sign-in for web. Placeholder - real release coming;
14
- see https://www.triauth.org/'
12
+ description: Authentication for modern web - a client library for the triauth protocol.
13
+ triauth-ruby is a faithful port of triauth-js, the reference implementation, and
14
+ shares its JSON conformance suites.
15
15
  email:
16
- - devs@triauth.org
16
+ - security@triauth.org
17
17
  executables: []
18
18
  extensions: []
19
19
  extra_rdoc_files: []
20
20
  files:
21
+ - CHANGELOG.md
21
22
  - LICENSE
22
23
  - README.md
23
24
  - lib/triauth.rb
25
+ - lib/triauth/api.rb
26
+ - lib/triauth/api/attestation.rb
27
+ - lib/triauth/api/authentication.rb
28
+ - lib/triauth/api/identity.rb
29
+ - lib/triauth/api/signing.rb
30
+ - lib/triauth/api/validation.rb
31
+ - lib/triauth/authentication_endpoint.rb
32
+ - lib/triauth/challenge.rb
33
+ - lib/triauth/challenge_response_flow.rb
34
+ - lib/triauth/config.rb
35
+ - lib/triauth/error.rb
36
+ - lib/triauth/helpers.rb
37
+ - lib/triauth/identity.rb
38
+ - lib/triauth/identity_domain.rb
39
+ - lib/triauth/identity_includes.rb
40
+ - lib/triauth/identity_keys.rb
41
+ - lib/triauth/logger.rb
42
+ - lib/triauth/multi_signature.rb
43
+ - lib/triauth/protocol.rb
44
+ - lib/triauth/request_cipher.rb
45
+ - lib/triauth/resolvers.rb
46
+ - lib/triauth/resolvers/base.rb
47
+ - lib/triauth/resolvers/caching_resolver.rb
48
+ - lib/triauth/resolvers/cloudflare.rb
49
+ - lib/triauth/resolvers/dns_json.rb
50
+ - lib/triauth/resolvers/dns_sb.rb
51
+ - lib/triauth/resolvers/google.rb
52
+ - lib/triauth/resolvers/multi_resolver.rb
53
+ - lib/triauth/resolvers/system_dns.rb
54
+ - lib/triauth/response.rb
55
+ - lib/triauth/response_cipher.rb
56
+ - lib/triauth/signature.rb
57
+ - lib/triauth/validator.rb
58
+ - lib/triauth/verifiers.rb
59
+ - lib/triauth/verifiers/base.rb
60
+ - lib/triauth/verifiers/ecdsa.rb
61
+ - lib/triauth/verifiers/ed25519.rb
62
+ - lib/triauth/verifiers/registry.rb
63
+ - lib/triauth/verifiers/web_authn.rb
64
+ - lib/triauth/version.rb
24
65
  homepage: https://www.triauth.org/
25
66
  licenses:
26
- - BSD-3-Clause
67
+ - Apache-2.0
27
68
  metadata:
28
69
  homepage_uri: https://www.triauth.org/
29
70
  source_code_uri: https://github.com/triauth/triauth-ruby
71
+ changelog_uri: https://github.com/triauth/triauth-ruby/blob/main/CHANGELOG.md
72
+ bug_tracker_uri: https://github.com/triauth/triauth-ruby/issues
73
+ documentation_uri: https://rubydoc.info/gems/triauth
30
74
  rubygems_mfa_required: 'true'
31
- post_install_message:
32
75
  rdoc_options: []
33
76
  require_paths:
34
77
  - lib
@@ -36,15 +79,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
36
79
  requirements:
37
80
  - - ">="
38
81
  - !ruby/object:Gem::Version
39
- version: '3.0'
82
+ version: '3.2'
40
83
  required_rubygems_version: !ruby/object:Gem::Requirement
41
84
  requirements:
42
85
  - - ">="
43
86
  - !ruby/object:Gem::Version
44
87
  version: '0'
45
88
  requirements: []
46
- rubygems_version: 3.5.22
47
- signing_key:
89
+ rubygems_version: 3.6.9
48
90
  specification_version: 4
49
- summary: 'triauth: password-less sign-in for web (placeholder)'
91
+ summary: Authentication for modern web - a client library for the triauth protocol.
50
92
  test_files: []