Add receipt_format to stamp and verify. Omitted → text; receipt|PDF-Receipt → PDF; JSON-Receipt → JSON; MD|MD-Receipt; CSV|CSV-Receipt; TSV|TSV-Receipt. Stamp always returns receipts[] and adds artifacts[] in the chosen format. Stdio writes ~/.verae/receipts (0600); public MCP returns content_text/content_base64 only. Verify accepts inline receipt or receipt_path (stdio), parses id, and re-emits an artifact. Vendors pdfcert (+ slim statuslang, gofpdf) for CERT-01 PDF. Also lands welcome tool and email-username helpers already wired into register/public paths.
20 lines
479 B
Go
20 lines
479 B
Go
package tools
|
|
|
|
import (
|
|
"fmt"
|
|
"strings"
|
|
)
|
|
|
|
// requireEmailUsername enforces that Verae usernames are email addresses.
|
|
func requireEmailUsername(username string) error {
|
|
s := strings.TrimSpace(username)
|
|
at := strings.IndexByte(s, '@')
|
|
if at <= 0 || at >= len(s)-1 {
|
|
return fmt.Errorf("username must be an email address")
|
|
}
|
|
dot := strings.LastIndexByte(s, '.')
|
|
if dot <= at+1 || dot >= len(s)-1 {
|
|
return fmt.Errorf("username must be an email address")
|
|
}
|
|
return nil
|
|
}
|