Documentation
¶
Overview ¶
Package forge is how a test plays the hostile operator in front of internal/fakeserver: a read of a box served otherwise than the server holds it, mail put in a box as only the operator can, a call answered as a server that is down. The Go client's tests and the script's share it, so each forgery is written once, as an operator could make it.
Index ¶
- func Capture(s *fakeserver.Server, method, suffix string) *[]byte
- func Carry(w http.ResponseWriter, r *http.Request, next http.Handler, ...)
- func Encrypt(t testing.TB, s *fakeserver.Server, to protocol.Address, parts ...[]byte) []byte
- func FailOnce(s *fakeserver.Server, method, suffix string)
- func Hides(t testing.TB, s *fakeserver.Server)
- func Line(t testing.TB, doc []byte, from, to protocol.Address, body string, at time.Time) []byte
- func ReadOf(r *http.Request) (protocol.Address, bool)
- func Refuse(w http.ResponseWriter, code protocol.Code, with ...func(*protocol.Problem))
- func Seal(t testing.TB, s *fakeserver.Server, to, from protocol.Address, ...) string
- func Serve(t testing.TB, s *fakeserver.Server, w http.ResponseWriter, r *http.Request, ...)
- func Sign(t testing.TB, s ssh.Signer, line []byte, to protocol.Address) []byte
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Capture ¶
func Capture(s *fakeserver.Server, method, suffix string) *[]byte
Capture records the body of the next request to s matching method and path suffix: JSON, or a send's ciphertext.
func Carry ¶
func Carry(w http.ResponseWriter, r *http.Request, next http.Handler, rec *protocol.Revocations)
Carry answers r as next answers it, but that a 410 revoked carries rec in place of the record its server holds, or none for nil: an operator that says an address is revoked and shows another record, or none.
func Encrypt ¶
Encrypt encrypts the parts, one after the other, to a box's current prekey as s holds it.
func FailOnce ¶
func FailOnce(s *fakeserver.Server, method, suffix string)
FailOnce answers the first request to s matching method and path suffix with a 503, as a server that is down would.
func Hides ¶
func Hides(t testing.TB, s *fakeserver.Server)
Hides puts an operator in front of s that serves every box without what its identity signed about it: a revoked box as if it were not, and no revocation of a box's certificates.
func Line ¶
Line is an envelope's line as a sender writes it: from the box whose identity document it carries, to a box, sent at at.
func Refuse ¶
Refuse answers as the server refuses a call, with code under its own status and type; each of with sets a member it carries.
func Seal ¶
func Seal(t testing.TB, s *fakeserver.Server, to, from protocol.Address, plaintext ...[]byte) string
Seal encrypts what a sender encrypts, an envelope's line and then whatever follows it, to a box's current prekey as s holds it, and stores it in that box as mail from a sender, as only the operator can. It returns the id it is stored under: the hash of the ciphertext.
func Serve ¶
func Serve(t testing.TB, s *fakeserver.Server, w http.ResponseWriter, r *http.Request, next http.Handler, edit func(*protocol.BoxResponse))
Serve answers r, a read of a box, with the box s holds, edited first: an operator that serves a box otherwise than it holds it. A revoked box is served as it was before, from its last prekey, with none of what its identity signed about it, so edit can make it look like any box.
Types ¶
This section is empty.