blob: ab767b8f37a32d6c5bbf374528d068c0f9c8ca8c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
package acme
import (
"io"
"os"
"path"
)
type webRootSolver struct {
webroot string
file string
}
func NewWebRootSolver(webroot string) Solver {
return &webRootSolver{webroot: webroot}
}
func (s *webRootSolver) Solve(token, keyAuth string) error {
s.file = path.Join(s.webroot, WellKnown, token)
fd, err := CreatePubFile(s.file)
if err != nil {
return err
}
defer fd.Close()
_, err = io.WriteString(fd, keyAuth)
return err
}
func (s *webRootSolver) Solved() error {
return os.Remove(s.file)
}
|