export type SystemUnsealRequest = {key?: string | undefined, reset?: boolean | undefined}; export type CreateApiSysUnsealArgs = {body: SystemUnsealRequest}; export type CreateApiSysUnsealOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Unseal the Vault. * * POST /sys/unseal */ export const createApiSysUnseal = async (args: CreateApiSysUnsealArgs, options: CreateApiSysUnsealOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") const url = `${baseUrl.replace(/\/+$/, '')}/sys/unseal${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };