INNER CODE UNIT · Go
TestLoginKeyPointerSitsAtTheGenerationSite
minekube/gate · accepted_crypto_doc_test.go:96
func TestLoginKeyPointerSitsAtTheGenerationSite(t *testing.T) {
src := readRepoFile(t, "pkg/edition/java/auth/authenticator.go")
const want = "// Accepted scanner finding (weak key): see docs/accepted-crypto-primitives.md.\n" +
"\t\tprivate, err = rsa.GenerateKey(rand.Reader, privateKeyBits(options))"
if !strings.Contains(src, want) {
t.Errorf("pkg/edition/java/auth/authenticator.go no longer carries the weak-key pointer "+
"comment immediately above the login key generation, so the flagged line has no "+
"rationale next to it; see %s", acceptedCryptoDocPath)
}
}
func readRepoFile(t *testing.T, path string) string {
t.Helper()
b, err := os.ReadFile(path)
if err != nil {
t.Fatalf("reading %s: %v", path, err)
}