UNPKG

@scalar/api-client

Version:

the open source API testing client

11 lines (10 loc) 459 B
import { encode as e } from "js-base64"; const l = (t) => t.flatMap((r) => r.type === "apiKey" ? r["x-scalar-secret-token"] : r?.type === "http" ? [ r["x-scalar-secret-token"], r["x-scalar-secret-username"], r["x-scalar-secret-password"], e(`${r["x-scalar-secret-username"]}:${r["x-scalar-secret-password"]}`) ] : r.type === "oauth2" ? Object.values(r.flows).map((a) => a["x-scalar-secret-token"]) : []).filter(Boolean); export { l as getSecrets };