export type RecordsUpdateKeysetRequest = {nonce: string, public_key: string}; export type PatchApiAbdmV1HiuKeysetArgs = {body: RecordsUpdateKeysetRequest}; export type PatchApiAbdmV1HiuKeysetOptions = {baseUrl?: string | undefined, authApiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * API to update client public keyset * * PATCH /abdm/v1/hiu/keyset */ export const patchApiAbdmV1HiuKeyset = async (args: PatchApiAbdmV1HiuKeysetArgs, options?: PatchApiAbdmV1HiuKeysetOptions) => { const {baseUrl = "https://api.eka.care", fetch: fetchFn = fetch, authApiKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (authApiKey !== undefined) headers.set('authorization', `Bearer ${authApiKey}`) const url = `${baseUrl.replace(/\/+$/, '')}/abdm/v1/hiu/keyset${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PATCH", 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 };