MCPcopy
hub / github.com/coder/mux / normalizeOptionalString

Function normalizeOptionalString

src/node/services/serverAuthService.ts:107–114  ·  view source on GitHub ↗
(value: unknown)

Source from the content-addressed store, hash-verified

105}
106
107function normalizeOptionalString(value: unknown): string | undefined {
108 if (typeof value !== "string") {
109 return undefined;
110 }
111
112 const trimmed = value.trim();
113 return trimmed.length > 0 ? trimmed : undefined;
114}
115
116function hashSessionToken(sessionToken: string): string {
117 return crypto.createHash("sha256").update(sessionToken).digest("hex");

Callers 10

normalizeIpAddressFunction · 0.70
buildSessionLabelFunction · 0.70
parseGithubUserResponseFunction · 0.70
sanitizeSessionFunction · 0.70
validateSessionTokenMethod · 0.70
revokeSessionMethod · 0.70
createSessionLockedMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected