Source identity
| Field | Recorded value |
|---|---|
| Source type | GitHub source |
| Original record | Janady13/missionmatch / internal/modules/auth/helpers.go |
| Date | Not specified in source |
| Repository | Janady13/missionmatch |
| Revision | 720d47fae476b0d38477ae4401697d372b1ea2bc |
| Branch | feature/opportunity-to-outcome |
| Path or archive member | internal/modules/auth/helpers.go |
| Original SHA-256 | 49cc46913ce0c2c02c47783e75638ece90cad04e6e4d341d3238afa5cef01afb |
| Git blob SHA | 215fd280e3f209468027ccc17bdef806fe5c0a74 |
| Reading-copy SHA-256 | 49cc46913ce0c2c02c47783e75638ece90cad04e6e4d341d3238afa5cef01afb |
Every recorded occurrence
These 2 records contain identical original source bytes. Their paths and revisions remain part of the archive.
| Original record | Branch or archive | Revision / identifier | Original location |
|---|---|---|---|
| Janady13/missionmatch / internal/modules/auth/helpers.go | feature/opportunity-to-outcome | 720d47fae476b0d38477ae4401697d372b1ea2bc | Open original |
| Janady13/missionmatch / internal/modules/auth/helpers.go | feature/aioe-upgrade | 2178e7298d0e5d9af83afa12402fd587f0ba6ed8 | Open original |
Recovered source transcript
Download complete source text ↓59 lines · 1.4 KB
package auth
import (
"encoding/json"
"time"
"github.com/google/uuid"
)
// nowFn is the clock for TOTP validation. It is a variable so a test can pin time; production uses
// the wall clock. Session expiry math runs on the database clock, not this one.
var nowFn = time.Now
func reasonJSON(reason string) []byte {
b, _ := json.Marshal(map[string]string{"reason": reason})
return b
}
// lockedJSON is the lockout audit payload. It carries the number of distinct source addresses behind
// the failures so an operator reading the trail can tell a single noisy client from a distributed run,
// which is the signal the old per ip lock scope used to imply and no longer does.
func lockedJSON(reason string, sourceIPs int) []byte {
b, _ := json.Marshal(map[string]any{"reason": reason, "distinct_source_ips": sourceIPs})
return b
}
func reasonRole(role string) []byte {
b, _ := json.Marshal(map[string]string{"role": role})
return b
}
func nullStr(s string) *string {
if s == "" {
return nil
}
return &s
}
// mustUUID parses a uuid that originates from validated server state (a session row), where it is
// always well formed. An unparseable value yields uuid.Nil, which matches no real row.
func mustUUID(s string) uuid.UUID {
id, err := uuid.Parse(s)
if err != nil {
return uuid.Nil
}
return id
}
func orgPtr(s string) *uuid.UUID {
if s == "" {
return nil
}
id, err := uuid.Parse(s)
if err != nil {
return nil
}
return &id
}