func (c *Client) buildSigner() (*schema.Signer, error) { c.initSignerPublicKeyBlobrefOnce.Do(c.initSignerPublicKeyBlobref) if !c.signerPublicKeyRef.Valid() { return nil, camtypes.Err("client-no-public-key") } return schema.NewSigner(c.signerPublicKeyRef, strings.NewReader(c.publicKeyArmored), c.SecretRingFile()) }
func errHandler(w http.ResponseWriter, r *http.Request) { errString := strings.TrimPrefix(r.URL.Path, errPattern) defer func() { if x := recover(); x != nil { http.Error(w, fmt.Sprintf("unknown error: %v", errString), http.StatusNotFound) } }() err := camtypes.Err(errString) data := struct { Code string Description template.HTML }{ Code: errString, Description: template.HTML(camliURLPattern.ReplaceAllString(err.Error(), toHyperlink)), } contents := applyTemplate(camliErrorHTML, "camliErrorHTML", data) w.WriteHeader(http.StatusFound) servePage(w, errString, "", contents) }