Move tofu.go to a subpackage
This commit is contained in:
parent
1f2888c54a
commit
d78052ce08
@ -17,11 +17,12 @@ import (
|
||||
"time"
|
||||
|
||||
"git.sr.ht/~adnano/go-gemini"
|
||||
"git.sr.ht/~adnano/go-gemini/tofu"
|
||||
"git.sr.ht/~adnano/go-xdg"
|
||||
)
|
||||
|
||||
var (
|
||||
hosts gemini.KnownHostsFile
|
||||
hosts tofu.KnownHostsFile
|
||||
scanner *bufio.Scanner
|
||||
)
|
||||
|
||||
@ -46,7 +47,7 @@ Otherwise, this should be safe to trust.
|
||||
=> `
|
||||
|
||||
func trustCertificate(hostname string, cert *x509.Certificate) error {
|
||||
fingerprint := gemini.NewFingerprint(cert.Raw, cert.NotAfter)
|
||||
fingerprint := tofu.NewFingerprint(cert.Raw, cert.NotAfter)
|
||||
knownHost, ok := hosts.Lookup(hostname)
|
||||
if ok && time.Now().Before(knownHost.Expires) {
|
||||
// Check fingerprint
|
||||
|
@ -1,4 +1,5 @@
|
||||
package gemini
|
||||
// Package tofu implements trust on first use using hosts and fingerprints.
|
||||
package tofu
|
||||
|
||||
import (
|
||||
"bufio"
|
Loading…
Reference in New Issue
Block a user