This commit is contained in:
Vladyslav Matsiiako
2022-11-30 20:55:35 -05:00
58 changed files with 55 additions and 126 deletions

View File

@ -271,4 +271,4 @@ Looking to report a security vulnerability? Please don't post about it in GitHub
<!-- prettier-ignore-start -->
<!-- markdownlint-disable -->
<a href="https://github.com/dangtony98"><img src="https://avatars.githubusercontent.com/u/25857006?v=4" width="50" height="50" alt=""/></a> <a href="https://github.com/mv-turtle"><img src="https://avatars.githubusercontent.com/u/78047717?s=96&v=4" width="50" height="50" alt=""/></a> <a href="https://github.com/maidul98"><img src="https://avatars.githubusercontent.com/u/9300960?v=4" width="50" height="50" alt=""/></a> <a href="https://github.com/gangjun06"><img src="https://avatars.githubusercontent.com/u/50910815?v=4" width="50" height="50" alt=""/></a> <a href="https://github.com/hanywang2"><img src="https://avatars.githubusercontent.com/u/44352119?v=4" width="50" height="50" alt=""/></a> <a href="https://github.com/tobias-mintlify"><img src="https://avatars.githubusercontent.com/u/110702161?v=4" width="50" height="50" alt=""/></a> <a href="https://github.com/0xflotus"><img src="https://avatars.githubusercontent.com/u/26602940?v=4" width="50" height="50" alt=""/></a>
<a href="https://github.com/dangtony98"><img src="https://avatars.githubusercontent.com/u/25857006?v=4" width="50" height="50" alt=""/></a> <a href="https://github.com/mv-turtle"><img src="https://avatars.githubusercontent.com/u/78047717?s=96&v=4" width="50" height="50" alt=""/></a> <a href="https://github.com/maidul98"><img src="https://avatars.githubusercontent.com/u/9300960?v=4" width="50" height="50" alt=""/></a> <a href="https://github.com/gangjun06"><img src="https://avatars.githubusercontent.com/u/50910815?v=4" width="50" height="50" alt=""/></a> <a href="https://github.com/reginaldbondoc"><img src="https://avatars.githubusercontent.com/u/7693108?v=4" width="50" height="50" alt=""/></a> <a href="https://github.com/hanywang2"><img src="https://avatars.githubusercontent.com/u/44352119?v=4" width="50" height="50" alt=""/></a> <a href="https://github.com/tobias-mintlify"><img src="https://avatars.githubusercontent.com/u/110702161?v=4" width="50" height="50" alt=""/></a> <a href="https://github.com/0xflotus"><img src="https://avatars.githubusercontent.com/u/26602940?v=4" width="50" height="50" alt=""/></a>

View File

@ -1,8 +1,6 @@
import { PATH } from "~/const";
import token from "~/pages/api/auth/Token";
export default class SecurityClient {
static authOrigins = [PATH];
static #token = "";
contructor() {}
@ -13,13 +11,12 @@ export default class SecurityClient {
static async fetchCall(resource, options) {
let req = new Request(resource, options);
const destOrigin = new URL(req.url).origin;
if (this.#token == "") {
this.setToken(await token());
}
if (this.#token && this.authOrigins.includes(destOrigin)) {
if (this.#token) {
req.headers.set("Authorization", "Bearer " + this.#token);
return fetch(req);
}

View File

@ -1,5 +1,3 @@
export const PATH = process.env.NEXT_PUBLIC_WEBSITE_URL;
export const publicPaths = [
`/`,
// `/integrations`,

View File

@ -1,4 +1,3 @@
import { PATH } from "~/const";
import SecurityClient from "~/utilities/SecurityClient";
/**
@ -14,7 +13,7 @@ const changePassword2 = ({
verifier,
clientProof,
}) => {
return SecurityClient.fetchCall(PATH + "/api/v1/password/change-password", {
return SecurityClient.fetchCall("/api/v1/password/change-password", {
method: "POST",
headers: {
"Content-Type": "application/json",

View File

@ -1,4 +1,3 @@
import { PATH } from "~/const";
import SecurityClient from "~/utilities/SecurityClient.js";
/**
@ -9,7 +8,7 @@ import SecurityClient from "~/utilities/SecurityClient.js";
* @returns
*/
const checkAuth = async (req, res) => {
return SecurityClient.fetchCall(PATH + "/api/v1/auth/checkAuth", {
return SecurityClient.fetchCall("/api/v1/auth/checkAuth", {
method: "POST",
headers: {
"Content-Type": "application/json",

View File

@ -1,5 +1,3 @@
import { PATH } from "~/const";
/**
* This route check the verification code from the email that user just recieved
* @param {*} email
@ -7,7 +5,7 @@ import { PATH } from "~/const";
* @returns
*/
const checkEmailVerificationCode = (email, code) => {
return fetch(PATH + "/api/v1/signup/email/verify", {
return fetch("/api/v1/signup/email/verify", {
method: "POST",
headers: {
"Content-Type": "application/json",

View File

@ -1,5 +1,3 @@
import { PATH } from "~/const";
/**
* This function is called in the end of the signup process.
* It sends all the necessary nformation to the server.
@ -28,7 +26,7 @@ const completeAccountInformationSignup = ({
verifier,
token,
}) => {
return fetch(PATH + "/api/v1/signup/complete-account/signup", {
return fetch("/api/v1/signup/complete-account/signup", {
method: "POST",
headers: {
"Content-Type": "application/json",

View File

@ -1,5 +1,3 @@
import { PATH } from "~/const";
/**
* This function is called in the end of the signup process.
* It sends all the necessary nformation to the server.
@ -26,7 +24,7 @@ const completeAccountInformationSignupInvite = ({
verifier,
token,
}) => {
return fetch(PATH + "/api/v1/signup/complete-account/invite", {
return fetch("/api/v1/signup/complete-account/invite", {
method: "POST",
headers: {
"Content-Type": "application/json",

View File

@ -1,4 +1,3 @@
import { PATH } from "~/const";
import SecurityClient from "~/utilities/SecurityClient";
/**
@ -13,7 +12,7 @@ const issueBackupPrivateKey = ({
clientProof,
}) => {
return SecurityClient.fetchCall(
PATH + "/api/v1/password/backup-private-key",
"/api/v1/password/backup-private-key",
{
method: "POST",
headers: {

View File

@ -1,5 +1,3 @@
import { PATH } from "~/const";
/**
* This is the first step of the login process (pake)
* @param {*} email
@ -7,7 +5,7 @@ import { PATH } from "~/const";
* @returns
*/
const login1 = (email, clientPublicKey) => {
return fetch(PATH + "/api/v1/auth/login1", {
return fetch("/api/v1/auth/login1", {
method: "POST",
headers: {
"Content-Type": "application/json",

View File

@ -1,5 +1,3 @@
import { PATH } from "~/const";
/**
* This is the second step of the login process
* @param {*} email
@ -7,7 +5,7 @@ import { PATH } from "~/const";
* @returns
*/
const login2 = (email, clientProof) => {
return fetch(PATH + "/api/v1/auth/login2", {
return fetch("/api/v1/auth/login2", {
method: "POST",
headers: {
"Content-Type": "application/json",

View File

@ -1,4 +1,3 @@
import { PATH } from "~/const";
import SecurityClient from "~/utilities/SecurityClient";
/**
@ -9,7 +8,7 @@ import SecurityClient from "~/utilities/SecurityClient";
* @returns
*/
const logout = async (req, res) => {
return SecurityClient.fetchCall(PATH + "/api/v1/auth/logout", {
return SecurityClient.fetchCall("/api/v1/auth/logout", {
method: "POST",
headers: {
"Content-Type": "application/json",

View File

@ -1,4 +1,3 @@
import { PATH } from "~/const";
import SecurityClient from "~/utilities/SecurityClient";
/**
@ -7,7 +6,7 @@ import SecurityClient from "~/utilities/SecurityClient";
* @returns
*/
const SRP1 = ({ clientPublicKey }) => {
return SecurityClient.fetchCall(PATH + "/api/v1/password/srp1", {
return SecurityClient.fetchCall("/api/v1/password/srp1", {
method: "POST",
headers: {
"Content-Type": "application/json",

View File

@ -1,11 +1,9 @@
import { PATH } from "~/const";
/**
* This route send the verification email to the user's email (contains a 6-digit verification code)
* @param {*} email
*/
const sendVerificationEmail = (email) => {
fetch(PATH + "/api/v1/signup/email/signup", {
fetch("/api/v1/signup/email/signup", {
method: "POST",
headers: {
"Content-Type": "application/json",

View File

@ -1,7 +1,5 @@
import { PATH } from "~/const";
const token = async (req, res) => {
return fetch(PATH + "/api/v1/auth/token", {
return fetch("/api/v1/auth/token", {
method: "POST",
headers: {
"Content-Type": "application/json",

View File

@ -1,5 +1,3 @@
import { PATH } from "~/const";
/**
* This route verifies the signup invite link
* @param {*} email
@ -7,7 +5,7 @@ import { PATH } from "~/const";
* @returns
*/
const verifySignupInvite = ({ email, code }) => {
return fetch(PATH + "/api/v1/invite-org/verify", {
return fetch("/api/v1/invite-org/verify", {
method: "POST",
headers: {
"Content-Type": "application/json",

View File

@ -1,5 +1,3 @@
import { PATH } from "~/const";
/**
* This route lets us get the public key of infisical. Th euser doesn't have to be authenticated since this is just the public key.
* @param {*} req
@ -7,7 +5,7 @@ import { PATH } from "~/const";
* @returns
*/
const publicKeyInfisical = (req, res) => {
return fetch(PATH + "/api/v1/key/publicKey/infisical", {
return fetch("/api/v1/key/publicKey/infisical", {
method: "GET",
headers: {
"Content-Type": "application/json",

View File

@ -1,4 +1,3 @@
import { PATH } from "~/const";
import SecurityClient from "~/utilities/SecurityClient.js";
/**
@ -9,7 +8,6 @@ import SecurityClient from "~/utilities/SecurityClient.js";
*/
const getSecrets = async (workspaceId, env) => {
return SecurityClient.fetchCall(
PATH +
"/api/v1/secret/" +
workspaceId +
"?" +

View File

@ -1,4 +1,3 @@
import { PATH } from "~/const";
import SecurityClient from "~/utilities/SecurityClient";
/**
@ -8,7 +7,7 @@ import SecurityClient from "~/utilities/SecurityClient";
* @returns
*/
const uploadSecrets = async ({ workspaceId, secrets, keys, environment }) => {
return SecurityClient.fetchCall(PATH + "/api/v1/secret/" + workspaceId, {
return SecurityClient.fetchCall("/api/v1/secret/" + workspaceId, {
method: "POST",
headers: {
"Content-Type": "application/json",

View File

@ -1,9 +1,8 @@
import { PATH } from "~/const";
import SecurityClient from "~/utilities/SecurityClient";
const changeHerokuConfigVars = ({ integrationId, key, secrets }) => {
return SecurityClient.fetchCall(
PATH + "/api/v1/integration/" + integrationId + "/sync",
"/api/v1/integration/" + integrationId + "/sync",
{
method: "POST",
headers: {

View File

@ -1,4 +1,3 @@
import { PATH } from "~/const";
import SecurityClient from "~/utilities/SecurityClient";
/**
@ -8,7 +7,7 @@ import SecurityClient from "~/utilities/SecurityClient";
*/
const deleteIntegration = ({ integrationId }) => {
return SecurityClient.fetchCall(
PATH + "/api/v1/integration/" + integrationId,
"/api/v1/integration/" + integrationId,
{
method: "DELETE",
headers: {

View File

@ -1,4 +1,3 @@
import { PATH } from "~/const";
import SecurityClient from "~/utilities/SecurityClient";
/**
@ -8,7 +7,7 @@ import SecurityClient from "~/utilities/SecurityClient";
*/
const deleteIntegrationAuth = ({ integrationAuthId }) => {
return SecurityClient.fetchCall(
PATH + "/api/v1/integration-auth/" + integrationAuthId,
"/api/v1/integration-auth/" + integrationAuthId,
{
method: "DELETE",
headers: {

View File

@ -1,9 +1,8 @@
import { PATH } from "~/const";
import SecurityClient from "~/utilities/SecurityClient";
const getIntegrationApps = ({ integrationAuthId }) => {
return SecurityClient.fetchCall(
PATH + "/api/v1/integration-auth/" + integrationAuthId + "/apps",
"/api/v1/integration-auth/" + integrationAuthId + "/apps",
{
method: "GET",
headers: {

View File

@ -1,8 +1,7 @@
import { PATH } from "~/const";
import SecurityClient from "~/utilities/SecurityClient";
const getIntegrations = () => {
return SecurityClient.fetchCall(PATH + "/api/v1/integration/integrations", {
return SecurityClient.fetchCall("/api/v1/integration/integrations", {
method: "GET",
headers: {
"Content-Type": "application/json",

View File

@ -1,4 +1,3 @@
import { PATH } from "~/const";
import SecurityClient from "~/utilities/SecurityClient";
/**
@ -8,7 +7,7 @@ import SecurityClient from "~/utilities/SecurityClient";
*/
const startIntegration = ({ integrationId, appName, environment }) => {
return SecurityClient.fetchCall(
PATH + "/api/v1/integration/" + integrationId,
"/api/v1/integration/" + integrationId,
{
method: "PATCH",
headers: {

View File

@ -1,4 +1,3 @@
import { PATH } from "~/const";
import SecurityClient from "~/utilities/SecurityClient";
/**
@ -8,7 +7,7 @@ import SecurityClient from "~/utilities/SecurityClient";
*/
const AuthorizeIntegration = ({ workspaceId, code, integration }) => {
return SecurityClient.fetchCall(
PATH + "/api/v1/integration-auth/oauth-token",
"/api/v1/integration-auth/oauth-token",
{
method: "POST",
headers: {

View File

@ -1,4 +1,3 @@
import { PATH } from "~/const";
import SecurityClient from "~/utilities/SecurityClient";
/**
@ -8,7 +7,7 @@ import SecurityClient from "~/utilities/SecurityClient";
*/
const getWorkspaceAuthorizations = ({ workspaceId }) => {
return SecurityClient.fetchCall(
PATH + "/api/v1/workspace/" + workspaceId + "/authorizations",
"/api/v1/workspace/" + workspaceId + "/authorizations",
{
method: "GET",
headers: {

View File

@ -1,4 +1,3 @@
import { PATH } from "~/const";
import SecurityClient from "~/utilities/SecurityClient";
/**
@ -8,7 +7,7 @@ import SecurityClient from "~/utilities/SecurityClient";
*/
const getWorkspaceIntegrations = ({ workspaceId }) => {
return SecurityClient.fetchCall(
PATH + "/api/v1/workspace/" + workspaceId + "/integrations",
"/api/v1/workspace/" + workspaceId + "/integrations",
{
method: "GET",
headers: {

View File

@ -1,4 +1,3 @@
import { PATH } from "~/const";
import SecurityClient from "~/utilities/SecurityClient";
/**
@ -8,7 +7,7 @@ import SecurityClient from "~/utilities/SecurityClient";
* @returns
*/
const getOrganization = (req, res) => {
return SecurityClient.fetchCall(PATH + "/api/v1/organization/" + req.orgId, {
return SecurityClient.fetchCall("/api/v1/organization/" + req.orgId, {
method: "GET",
headers: {
"Content-Type": "application/json",

View File

@ -1,4 +1,3 @@
import { PATH } from "~/const";
import SecurityClient from "~/utilities/SecurityClient";
/**
@ -9,7 +8,7 @@ import SecurityClient from "~/utilities/SecurityClient";
*/
const getOrganizationProjects = (req, res) => {
return SecurityClient.fetchCall(
PATH + "/api/organization/" + req.orgId + "/workspaces",
"/api/organization/" + req.orgId + "/workspaces",
{
method: "GET",
headers: {

View File

@ -1,4 +1,3 @@
import { PATH } from "~/const";
import SecurityClient from "~/utilities/SecurityClient";
/**
@ -9,7 +8,7 @@ import SecurityClient from "~/utilities/SecurityClient";
*/
const getOrganizationSubscriptions = (req, res) => {
return SecurityClient.fetchCall(
PATH + "/api/v1/organization/" + req.orgId + "/subscriptions",
"/api/v1/organization/" + req.orgId + "/subscriptions",
{
method: "GET",
headers: {

View File

@ -1,4 +1,3 @@
import { PATH } from "~/const";
import SecurityClient from "~/utilities/SecurityClient";
/**
@ -9,7 +8,7 @@ import SecurityClient from "~/utilities/SecurityClient";
*/
const getOrganizationUserProjects = (req, res) => {
return SecurityClient.fetchCall(
PATH + "/api/v1/organization/" + req.orgId + "/my-workspaces",
"/api/v1/organization/" + req.orgId + "/my-workspaces",
{
method: "GET",
headers: {

View File

@ -1,4 +1,3 @@
import { PATH } from "~/const";
import SecurityClient from "~/utilities/SecurityClient";
/**
@ -9,7 +8,7 @@ import SecurityClient from "~/utilities/SecurityClient";
*/
const getOrganizationUsers = (req, res) => {
return SecurityClient.fetchCall(
PATH + "/api/v1/organization/" + req.orgId + "/users",
"/api/v1/organization/" + req.orgId + "/users",
{
method: "GET",
headers: {

View File

@ -1,4 +1,3 @@
import { PATH } from "~/const";
import SecurityClient from "~/utilities/SecurityClient";
/**
@ -9,7 +8,7 @@ import SecurityClient from "~/utilities/SecurityClient";
*/
const StripeRedirect = ({ orgId }) => {
return SecurityClient.fetchCall(
PATH + "/api/v1/organization/" + orgId + "/customer-portal-session",
"/api/v1/organization/" + orgId + "/customer-portal-session",
{
method: "POST",
headers: {

View File

@ -1,4 +1,3 @@
import { PATH } from "~/const";
import SecurityClient from "~/utilities/SecurityClient";
/**
@ -8,7 +7,7 @@ import SecurityClient from "~/utilities/SecurityClient";
*/
const addIncidentContact = (organizationId, email) => {
return SecurityClient.fetchCall(
PATH + "/api/v1/organization/" + organizationId + "/incidentContactOrg",
"/api/v1/organization/" + organizationId + "/incidentContactOrg",
{
method: "POST",
headers: {

View File

@ -1,4 +1,3 @@
import { PATH } from "~/const";
import SecurityClient from "~/utilities/SecurityClient";
/**
@ -8,7 +7,7 @@ import SecurityClient from "~/utilities/SecurityClient";
* @returns
*/
const addUserToOrg = (email, orgId) => {
return SecurityClient.fetchCall(PATH + "/api/v1/invite-org/signup", {
return SecurityClient.fetchCall("/api/v1/invite-org/signup", {
method: "POST",
headers: {
"Content-Type": "application/json",

View File

@ -1,4 +1,3 @@
import { PATH } from "~/const";
import SecurityClient from "~/utilities/SecurityClient";
/**
@ -8,7 +7,7 @@ import SecurityClient from "~/utilities/SecurityClient";
*/
const deleteIncidentContact = (organizaionId, email) => {
return SecurityClient.fetchCall(
PATH + "/api/v1/organization/" + organizaionId + "/incidentContactOrg",
"/api/v1/organization/" + organizaionId + "/incidentContactOrg",
{
method: "DELETE",
headers: {

View File

@ -1,4 +1,3 @@
import { PATH } from "~/const";
import SecurityClient from "~/utilities/SecurityClient";
/**
@ -8,7 +7,7 @@ import SecurityClient from "~/utilities/SecurityClient";
*/
const deleteUserFromOrganization = (membershipId) => {
return SecurityClient.fetchCall(
PATH + "/api/v1/membership-org/" + membershipId,
"/api/v1/membership-org/" + membershipId,
{
method: "DELETE",
headers: {

View File

@ -1,4 +1,3 @@
import { PATH } from "~/const";
import SecurityClient from "~/utilities/SecurityClient";
/**
@ -8,7 +7,7 @@ import SecurityClient from "~/utilities/SecurityClient";
*/
const getIncidentContacts = (organizationId) => {
return SecurityClient.fetchCall(
PATH + "/api/v1/organization/" + organizationId + "/incidentContactOrg",
"/api/v1/organization/" + organizationId + "/incidentContactOrg",
{
method: "GET",
headers: {

View File

@ -1,4 +1,3 @@
import { PATH } from "~/const";
import SecurityClient from "~/utilities/SecurityClient";
/**
@ -8,7 +7,7 @@ import SecurityClient from "~/utilities/SecurityClient";
* @returns
*/
const getOrganizations = (req, res) => {
return SecurityClient.fetchCall(PATH + "/api/v1/organization", {
return SecurityClient.fetchCall("/api/v1/organization", {
method: "GET",
headers: {
"Content-Type": "application/json",

View File

@ -1,4 +1,3 @@
import { PATH } from "~/const";
import SecurityClient from "~/utilities/SecurityClient";
/**
@ -9,7 +8,7 @@ import SecurityClient from "~/utilities/SecurityClient";
*/
const renameOrg = (orgId, newOrgName) => {
return SecurityClient.fetchCall(
PATH + "/api/v1/organization/" + orgId + "/name",
"/api/v1/organization/" + orgId + "/name",
{
method: "PATCH",
headers: {

View File

@ -1,4 +1,3 @@
import { PATH } from "~/const";
import SecurityClient from "~/utilities/SecurityClient";
/**
@ -15,7 +14,7 @@ const addServiceToken = ({
encryptedKey,
nonce,
}) => {
return SecurityClient.fetchCall(PATH + "/api/v1/service-token/", {
return SecurityClient.fetchCall("/api/v1/service-token/", {
method: "POST",
headers: {
"Content-Type": "application/json",

View File

@ -1,4 +1,3 @@
import { PATH } from "~/const";
import SecurityClient from "~/utilities/SecurityClient";
/**
@ -8,7 +7,7 @@ import SecurityClient from "~/utilities/SecurityClient";
*/
const getServiceTokens = ({ workspaceId }) => {
return SecurityClient.fetchCall(
PATH + "/api/v1/workspace/" + workspaceId + "/service-tokens",
"/api/v1/workspace/" + workspaceId + "/service-tokens",
{
method: "GET",
headers: {

View File

@ -1,4 +1,3 @@
import { PATH } from "~/const";
import SecurityClient from "~/utilities/SecurityClient";
/**
@ -8,7 +7,7 @@ import SecurityClient from "~/utilities/SecurityClient";
* @returns
*/
const getUser = (req, res) => {
return SecurityClient.fetchCall(PATH + "/api/v1/user", {
return SecurityClient.fetchCall("/api/v1/user", {
method: "GET",
headers: {
"Content-Type": "application/json",

View File

@ -1,4 +1,3 @@
import { PATH } from "~/const";
import SecurityClient from "~/utilities/SecurityClient";
/**
@ -9,7 +8,6 @@ import SecurityClient from "~/utilities/SecurityClient";
*/
const checkUserAction = ({ action }) => {
return SecurityClient.fetchCall(
PATH +
"/api/v1/user-action" +
"?" +
new URLSearchParams({

View File

@ -1,4 +1,3 @@
import { PATH } from "~/const";
import SecurityClient from "~/utilities/SecurityClient";
/**
@ -7,7 +6,7 @@ import SecurityClient from "~/utilities/SecurityClient";
* @returns
*/
const registerUserAction = ({ action }) => {
return SecurityClient.fetchCall(PATH + "/api/v1/user-action", {
return SecurityClient.fetchCall("/api/v1/user-action", {
method: "POST",
headers: {
"Content-Type": "application/json",

View File

@ -1,4 +1,3 @@
import { PATH } from "~/const";
import SecurityClient from "~/utilities/SecurityClient";
/**
@ -9,7 +8,7 @@ import SecurityClient from "~/utilities/SecurityClient";
*/
const addUserToWorkspace = (email, workspaceId) => {
return SecurityClient.fetchCall(
PATH + "/api/v1/workspace/" + workspaceId + "/invite-signup",
"/api/v1/workspace/" + workspaceId + "/invite-signup",
{
method: "POST",
headers: {

View File

@ -1,4 +1,3 @@
import { PATH } from "~/const";
import SecurityClient from "~/utilities/SecurityClient";
/**
@ -9,7 +8,7 @@ import SecurityClient from "~/utilities/SecurityClient";
*/
const changeUserRoleInWorkspace = (membershipId, role) => {
return SecurityClient.fetchCall(
PATH + "/api/v1/membership/" + membershipId + "/change-role",
"/api/v1/membership/" + membershipId + "/change-role",
{
method: "POST",
headers: {

View File

@ -1,4 +1,3 @@
import { PATH } from "~/const";
import SecurityClient from "~/utilities/SecurityClient";
/**
@ -7,7 +6,7 @@ import SecurityClient from "~/utilities/SecurityClient";
* @returns
*/
const createWorkspace = (workspaceName, organizationId) => {
return SecurityClient.fetchCall(PATH + "/api/v1/workspace", {
return SecurityClient.fetchCall("/api/v1/workspace", {
method: "POST",
headers: {
"Content-Type": "application/json",

View File

@ -1,4 +1,3 @@
import { PATH } from "~/const";
import SecurityClient from "~/utilities/SecurityClient";
/**
@ -7,7 +6,7 @@ import SecurityClient from "~/utilities/SecurityClient";
* @returns
*/
const deleteUserFromWorkspace = (membershipId) => {
return SecurityClient.fetchCall(PATH + "/api/v1/membership/" + membershipId, {
return SecurityClient.fetchCall("/api/v1/membership/" + membershipId, {
method: "DELETE",
headers: {
"Content-Type": "application/json",

View File

@ -1,4 +1,3 @@
import { PATH } from "~/const";
import SecurityClient from "~/utilities/SecurityClient";
/**
@ -7,7 +6,7 @@ import SecurityClient from "~/utilities/SecurityClient";
* @returns
*/
const deleteWorkspace = (workspaceId) => {
return SecurityClient.fetchCall(PATH + "/api/v1/workspace/" + workspaceId, {
return SecurityClient.fetchCall("/api/v1/workspace/" + workspaceId, {
method: "DELETE",
headers: {
"Content-Type": "application/json",

View File

@ -1,4 +1,3 @@
import { PATH } from "~/const";
import SecurityClient from "~/utilities/SecurityClient";
/**
@ -8,7 +7,7 @@ import SecurityClient from "~/utilities/SecurityClient";
*/
const getLatestFileKey = (workspaceId) => {
return SecurityClient.fetchCall(
PATH + "/api/v1/key/" + workspaceId + "/latest",
"/api/v1/key/" + workspaceId + "/latest",
{
method: "GET",
headers: {

View File

@ -1,4 +1,3 @@
import { PATH } from "~/const";
import SecurityClient from "~/utilities/SecurityClient";
/**
@ -9,7 +8,7 @@ import SecurityClient from "~/utilities/SecurityClient";
*/
const getWorkspaceInfo = (req, res) => {
return SecurityClient.fetchCall(
PATH + "/api/v1/workspace/" + req.workspaceId,
"/api/v1/workspace/" + req.workspaceId,
{
method: "GET",
headers: {

View File

@ -1,4 +1,3 @@
import { PATH } from "~/const";
import SecurityClient from "~/utilities/SecurityClient";
/**
@ -9,7 +8,7 @@ import SecurityClient from "~/utilities/SecurityClient";
*/
const getWorkspaceKeys = (req, res) => {
return SecurityClient.fetchCall(
PATH + "/api/v1/workspace/" + req.workspaceId + "/keys",
"/api/v1/workspace/" + req.workspaceId + "/keys",
{
method: "GET",
headers: {

View File

@ -1,4 +1,3 @@
import { PATH } from "~/const";
import SecurityClient from "~/utilities/SecurityClient";
/**
@ -9,7 +8,7 @@ import SecurityClient from "~/utilities/SecurityClient";
*/
const getWorkspaceUsers = (req, res) => {
return SecurityClient.fetchCall(
PATH + "/api/v1/workspace/" + req.workspaceId + "/users",
"/api/v1/workspace/" + req.workspaceId + "/users",
{
method: "GET",
headers: {

View File

@ -1,4 +1,3 @@
import { PATH } from "~/const";
import SecurityClient from "~/utilities/SecurityClient";
/**
@ -8,7 +7,7 @@ import SecurityClient from "~/utilities/SecurityClient";
* @returns
*/
const getWorkspaces = (req, res) => {
return SecurityClient.fetchCall(PATH + "/api/v1/workspace", {
return SecurityClient.fetchCall("/api/v1/workspace", {
method: "GET",
headers: {
"Content-Type": "application/json",

View File

@ -1,4 +1,3 @@
import { PATH } from "~/const";
import SecurityClient from "~/utilities/SecurityClient";
/**
@ -9,7 +8,7 @@ import SecurityClient from "~/utilities/SecurityClient";
*/
const renameWorkspace = (workspaceId, newWorkspaceName) => {
return SecurityClient.fetchCall(
PATH + "/api/v1/workspace/" + workspaceId + "/name",
"/api/v1/workspace/" + workspaceId + "/name",
{
method: "POST",
headers: {

View File

@ -1,4 +1,3 @@
import { PATH } from "~/const";
import SecurityClient from "~/utilities/SecurityClient";
/**
@ -10,7 +9,7 @@ import SecurityClient from "~/utilities/SecurityClient";
* @returns
*/
const uploadKeys = (workspaceId, userId, encryptedKey, nonce) => {
return SecurityClient.fetchCall(PATH + "/api/v1/key/" + workspaceId, {
return SecurityClient.fetchCall("/api/v1/key/" + workspaceId, {
method: "POST",
headers: {
"Content-Type": "application/json",