mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 21:18:28 +00:00
Secrets: make runtime activation auth loads read-only
This commit is contained in:
committed by
Peter Steinberger
parent
3dbb6be270
commit
8e33ebe471
14
src/secrets/shared.ts
Normal file
14
src/secrets/shared.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
export function isRecord(value: unknown): value is Record<string, unknown> {
|
||||
return typeof value === "object" && value !== null && !Array.isArray(value);
|
||||
}
|
||||
|
||||
export function isNonEmptyString(value: unknown): value is string {
|
||||
return typeof value === "string" && value.trim().length > 0;
|
||||
}
|
||||
|
||||
export function normalizePositiveInt(value: unknown, fallback: number): number {
|
||||
if (typeof value === "number" && Number.isFinite(value)) {
|
||||
return Math.max(1, Math.floor(value));
|
||||
}
|
||||
return Math.max(1, Math.floor(fallback));
|
||||
}
|
||||
Reference in New Issue
Block a user