1
0
Fork 0
VaultUI/src/api/submitUnsealKey.ts
2021-05-08 00:21:58 +01:00

19 lines
463 B
TypeScript

import { appendAPIURL } from "./apiUtils";
export async function submitUnsealKey(key: string): Promise<void> {
const request = new Request(appendAPIURL("/v1/sys/unseal"), {
method: "POST",
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
"key": key
})
});
const response = await fetch(request);
if (!response.ok) {
const json = await response.json();
throw new Error(json.errors[0]);
}
}