mirror of
https://github.com/openclaw/openclaw.git
synced 2026-07-07 12:23:58 +00:00
45 lines
1.3 KiB
TypeScript
45 lines
1.3 KiB
TypeScript
// Secret input helpers normalize credential prompt definitions for plugin setup flows.
|
|
import { z } from "zod";
|
|
import {
|
|
hasConfiguredSecretInput,
|
|
isSecretRef,
|
|
coerceSecretRef,
|
|
resolveSecretInputString,
|
|
normalizeResolvedSecretInputString,
|
|
normalizeSecretInputString,
|
|
} from "../config/types.secrets.js";
|
|
import { normalizeSecretInput } from "../utils/normalize-secret-input.js";
|
|
import { buildSecretInputSchema } from "./secret-input-schema.js";
|
|
|
|
export type {
|
|
SecretInput,
|
|
SecretInputStringResolution,
|
|
SecretInputStringResolutionMode,
|
|
} from "../config/types.secrets.js";
|
|
export {
|
|
buildSecretInputSchema,
|
|
coerceSecretRef,
|
|
hasConfiguredSecretInput,
|
|
isSecretRef,
|
|
resolveSecretInputString,
|
|
normalizeResolvedSecretInputString,
|
|
normalizeSecretInput,
|
|
normalizeSecretInputString,
|
|
};
|
|
|
|
/**
|
|
* Builds an optional secret-input schema for config fields that may be omitted.
|
|
* The inner schema stays shared so sensitive-path redaction still recognizes it.
|
|
*/
|
|
export function buildOptionalSecretInputSchema() {
|
|
return buildSecretInputSchema().optional();
|
|
}
|
|
|
|
/**
|
|
* Builds an array schema for provider/channel config that accepts multiple secret inputs.
|
|
* Each element uses the shared schema so plaintext and ref validation stay identical.
|
|
*/
|
|
export function buildSecretInputArraySchema() {
|
|
return z.array(buildSecretInputSchema());
|
|
}
|