Documentation
¶
Overview ¶
Package testenv runs an in-process Inkless with a throwaway database, dev keys, a local TSA and a capturing mailer, plus a scripted browser for the ceremony. For tests and examples only.
Index ¶
- func Conformance(t *testing.T, driverName string)
- func Database(ctx context.Context, driverName string) (dbURL string, cleanup func(), err error)
- func Drivers() []string
- type Browser
- func (b *Browser) Decline(reason string) (*Response, error)
- func (b *Browser) Get(u string) (*Response, error)
- func (b *Browser) Open(link string) (*Response, error)
- func (b *Browser) Page() string
- func (b *Browser) Post(path string, fields url.Values) (*Response, error)
- func (b *Browser) Ready(link string, m *Mailer, email string) (*Response, error)
- func (b *Browser) Sign() (*Response, error)
- type Clock
- type Env
- type Mailer
- type Response
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Conformance ¶
Conformance runs the storage conformance suite against driver, skipping when its server URL is not configured.
Types ¶
type Browser ¶
type Browser struct {
// Base is the server's base URL.
Base string
// contains filtered or unexported fields
}
Browser drives the hosted ceremony like a user agent with cookies. It does not follow redirects, so outcomes can be inspected.
func NewBrowser ¶
NewBrowser returns a Browser with an empty cookie jar for the server at base.
func (*Browser) Decline ¶
Decline declines on the current review page with the given reason. Like Sign, it resolves Location to the link back to the application.
func (*Browser) Open ¶
Open loads a signing link like a user who presses its start button: the link page asks first, and only the form post consumes the link. It returns the response that carries the session cookie, or the link page itself when the link cannot be opened.
func (*Browser) Post ¶
Post submits a form on the current page, adding its nonce and document digest unless fields sets them.
type Clock ¶
type Clock struct {
// contains filtered or unexported fields
}
Clock is real time plus an offset that tests advance.
type Env ¶
type Env struct {
// URL is the server's base URL.
URL string
// Service is the running service, for direct calls and ticking jobs.
Service *service.Service
// Mailer captures the codes the service emails.
Mailer *Mailer
// Keys are the signing and trust keys the service uses.
Keys *signer.Keys
// Store is the open database.
Store storage.Store
// Clock is the service's clock. Advance it to move time forward
// without waiting.
Clock *Clock
// contains filtered or unexported fields
}
Env is a running in-process Inkless.
func Start ¶
Start runs Inkless against dbURL with fresh development keys. Background jobs run every 50ms.
func StartWith ¶
StartWith runs Inkless against dbURL with keys and a local TSA issuing tokens with tsa.
func (*Env) Close ¶
func (e *Env) Close()
Close stops the server and background jobs and closes the store.
func (*Env) Complete ¶
Complete runs one single-signer request to completion and returns its sealed PDF and evidence package.
func (*Env) VerifyOptions ¶
VerifyOptions returns the trust configuration matching the env's keys.
type Mailer ¶
type Mailer struct {
// contains filtered or unexported fields
}
Mailer captures messages instead of sending them, unless UseMailpit was called.
func (*Mailer) LastCode ¶
LastCode returns the most recent code mailed to addr, or "" if there is none.