Skip to content

Commit 01e61ec

Browse files
Merge branch 'keyshade-xyz:develop' into API-Implement-rate-limiting-in-the-API-keyshade-xyz#12
2 parents 1df5969 + d8c58fe commit 01e61ec

File tree

6 files changed

+104
-52
lines changed

6 files changed

+104
-52
lines changed

.github/workflows/auto-assign.yaml

+9-9
Original file line numberDiff line numberDiff line change
@@ -15,32 +15,32 @@ jobs:
1515
github-token: ${{ secrets.GITHUB_TOKEN }}
1616
script: |
1717
const comment = context.payload.comment;
18-
const issue = context.issue;
18+
const issue = context.payload.issue;
1919
const owner = 'keyshade-xyz';
2020
const repo = 'keyshade';
2121
const userMaxConcurrentIssueCount = process.env.USER_MAX_CONCURRENT_ISSUE_COUNT || 5;
2222
23-
async function listIssueEvents(issue) {
24-
const allEvents = [];
23+
async function listIssueEvents(issueNumber) {
24+
const events = [];
2525
let page = 1;
2626
let hasNextPage = true;
2727
2828
while (hasNextPage) {
29-
const issuesResponse = await github.rest.issues.listEventsForTimeline({
29+
const eventsResponse = await github.rest.issues.listEventsForTimeline({
3030
owner,
3131
repo,
32-
issue_number: issue.number,
32+
issue_number: issueNumber,
3333
per_page: 100,
3434
page
3535
});
3636
37-
allEvents.push(...issuesResponse.data);
37+
events.push(...eventsResponse.data);
3838
39-
hasNextPage = issuesResponse.headers.link && issuesResponse.headers.link.includes('rel="next"');
39+
hasNextPage = eventsResponse.headers.link && eventsResponse.headers.link.includes('rel="next"');
4040
page++;
4141
}
4242
43-
return allEvents;
43+
return events;
4444
}
4545
4646
async function listUserOpenIssuesWithoutActivePullRequest(user) {
@@ -55,7 +55,7 @@ jobs:
5555
});
5656
5757
for (const issue of userOpenIssues) {
58-
const events = await listIssueEvents(issue);
58+
const events = await listIssueEvents(issue.number);
5959
const userPullRequestIssues = events
6060
.filter(event => event.event === 'cross-referenced')
6161
.map(event => event.source.issue)

CHANGELOG.md

+24
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,27 @@
1+
## [2.12.0-stage.15](https://github.com/keyshade-xyz/keyshade/compare/v2.12.0-stage.14...v2.12.0-stage.15) (2025-02-23)
2+
3+
### 🐛 Bug Fixes
4+
5+
* **api:** Added import statement for crypto module ([#789](https://github.com/keyshade-xyz/keyshade/issues/789)) ([f6ddf0f](https://github.com/keyshade-xyz/keyshade/commit/f6ddf0fc54280c9844143ac42840fcbde1438b23))
6+
7+
## [2.12.0-stage.14](https://github.com/keyshade-xyz/keyshade/compare/v2.12.0-stage.13...v2.12.0-stage.14) (2025-02-23)
8+
9+
### 🐛 Bug Fixes
10+
11+
* **api:** Issue fetched via API ([#788](https://github.com/keyshade-xyz/keyshade/issues/788)) ([b373eeb](https://github.com/keyshade-xyz/keyshade/commit/b373eeb5974ee61bd07ce586da4b56dbd0d10fab))
12+
13+
## [2.12.0-stage.13](https://github.com/keyshade-xyz/keyshade/compare/v2.12.0-stage.12...v2.12.0-stage.13) (2025-02-23)
14+
15+
### 🐛 Bug Fixes
16+
17+
* **platform:** Add graceful fallback in error parsing ([a59de60](https://github.com/keyshade-xyz/keyshade/commit/a59de60e40b6f3617a4278837e0c63fcb5752d16))
18+
19+
## [2.12.0-stage.12](https://github.com/keyshade-xyz/keyshade/compare/v2.12.0-stage.11...v2.12.0-stage.12) (2025-02-22)
20+
21+
### 🚀 Features
22+
23+
* **platform:** Displays a warning message when store private key switch is ON ([#782](https://github.com/keyshade-xyz/keyshade/issues/782)) ([ae8a432](https://github.com/keyshade-xyz/keyshade/commit/ae8a432ebf269d85eb8add5c7293eb89fe94b913))
24+
125
## [2.12.0-stage.11](https://github.com/keyshade-xyz/keyshade/compare/v2.12.0-stage.10...v2.12.0-stage.11) (2025-02-22)
226

327
### 🐛 Bug Fixes

apps/api/src/common/util.ts

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { UserAuthenticatedResponse } from '@/auth/auth.types'
22
import { UserWithWorkspace } from '@/user/user.types'
33
import { Otp, PrismaClient, User } from '@prisma/client'
44
import { Response } from 'express'
5+
import * as crypto from 'crypto'
56

67
/**
78
* Limits the given limit to a maximum number of items per page.

apps/platform/src/components/dashboard/project/createProjectDialogue/index.tsx

+56-35
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type { CreateProjectRequest } from '@keyshade/schema'
22
import { toast } from 'sonner'
3-
import { useCallback, useMemo, useState } from 'react'
3+
import { useCallback, useEffect, useMemo, useRef, useState } from 'react'
44
import { useAtom, useAtomValue } from 'jotai'
55
import { AddSVG } from '@public/svg/shared'
66
import { Button } from '@/components/ui/button'
@@ -32,6 +32,7 @@ import {
3232
import { useHttp } from '@/hooks/use-http'
3333

3434
export default function CreateProjectDialogue(): JSX.Element {
35+
const privateKeyWarningRef = useRef<HTMLDivElement | null>(null)
3536
const [projects, setProjects] = useAtom(projectsOfWorkspaceAtom)
3637
const [isCreateProjectDialogOpen, setIsCreateProjectDialogOpen] = useAtom(
3738
createProjectOpenAtom
@@ -110,10 +111,21 @@ export default function CreateProjectDialogue(): JSX.Element {
110111
])
111112

112113
const toggleDialog = useCallback(
113-
() => setIsCreateProjectDialogOpen((prev) => !prev),
114-
[setIsCreateProjectDialogOpen]
114+
() => {
115+
setIsCreateProjectDialogOpen((prev) => !prev)
116+
if (!isCreateProjectDialogOpen) {
117+
setNewProjectData((prev) => ({ ...prev, storePrivateKey: false })) // Reset switch state
118+
}
119+
},
120+
[isCreateProjectDialogOpen, setIsCreateProjectDialogOpen]
115121
)
116122

123+
useEffect(() => {
124+
if (newProjectData.storePrivateKey && privateKeyWarningRef.current) {
125+
privateKeyWarningRef.current.scrollIntoView({ behavior: 'smooth' })
126+
}
127+
}, [newProjectData.storePrivateKey])
128+
117129
return (
118130
<Dialog
119131
onOpenChange={setIsCreateProjectDialogOpen}
@@ -126,20 +138,20 @@ export default function CreateProjectDialogue(): JSX.Element {
126138
</Button>
127139
)}
128140
</DialogTrigger>
129-
<DialogContent className="h-[39.5rem] w-[28.625rem] rounded-[12px] border bg-[#1E1E1F] ">
130-
<div className="flex h-[3.125rem] w-[25.625rem] flex-col items-start justify-center">
141+
<DialogContent className="h-[39.5rem] w-full rounded-[12px] border bg-[#1E1E1F] ">
142+
<div className="flex h-[3.125rem] w-full flex-col items-start justify-center">
131143
<DialogHeader className=" font-geist h-[1.875rem] w-[8.5rem] text-[1.125rem] font-semibold text-white ">
132-
Create Projects
144+
Create Project
133145
</DialogHeader>
134146

135-
<DialogDescription className=" font-inter h-[1.25rem] w-[25.625rem] text-[0.875rem] font-normal text-[#D4D4D4]">
147+
<DialogDescription className=" font-inter h-[1.25rem] w-full text-[0.875rem] font-normal text-[#D4D4D4]">
136148
Create your new project
137149
</DialogDescription>
138150
</div>
139-
<div className="flex flex-col gap-y-8">
140-
<div className="flex h-[29.125rem] w-[25.813rem] flex-col gap-[1rem] py-[1rem] ">
151+
<div className="flex flex-col gap-y-8 overflow-auto">
152+
<div className="flex h-[29.125rem] w-full flex-col gap-[1rem] py-[1rem] ">
141153
{/* NAME */}
142-
<div className="flex h-[2.25rem] w-[25.813rem] items-center justify-center gap-[1rem]">
154+
<div className="flex h-[2.25rem] w-full items-center justify-between gap-[1rem]">
143155
<Label
144156
className="font-geist h-[1.25rem] w-[4.813rem] gap-[0.25rem] text-left text-[0.875rem] font-[500] "
145157
htmlFor="name"
@@ -160,7 +172,7 @@ export default function CreateProjectDialogue(): JSX.Element {
160172
</div>
161173

162174
{/* DESCRIPTION */}
163-
<div className="flex h-[5.625rem] w-[25.813rem] items-center justify-center gap-[1rem]">
175+
<div className="flex h-[5.625rem] w-full items-center justify-between gap-[1rem]">
164176
<Label
165177
className="font-geist h-[1.25rem] w-[4.813rem] gap-[0.25rem] text-left text-[0.875rem] font-[500] "
166178
htmlFor="name"
@@ -181,7 +193,7 @@ export default function CreateProjectDialogue(): JSX.Element {
181193
</div>
182194

183195
{/* ENV. NAME */}
184-
<div className="flex h-[2.25rem] w-[25.813rem] items-center justify-center gap-[1rem]">
196+
<div className="flex h-[2.25rem] w-full items-center justify-between gap-[1rem]">
185197
<Label
186198
className="font-geist h-[1.25rem] w-[4.813rem] gap-[0.25rem] text-left text-[0.875rem] font-[500] "
187199
htmlFor="envName"
@@ -204,7 +216,7 @@ export default function CreateProjectDialogue(): JSX.Element {
204216
</div>
205217

206218
{/* ENV. DESCRIPTION */}
207-
<div className="flex h-[4.875rem] w-[25.813rem] items-center justify-center gap-[1rem]">
219+
<div className="flex h-[4.875rem] w-full items-center justify-between gap-[1rem]">
208220
<Label
209221
className="font-geist h-[1.25rem] w-[4.813rem] gap-[0.25rem] text-left text-[0.875rem] font-[500]"
210222
htmlFor="envDescription"
@@ -229,7 +241,7 @@ export default function CreateProjectDialogue(): JSX.Element {
229241
</div>
230242

231243
{/* ACCESS LEVEL */}
232-
<div className="flex h-[2.25rem] w-[25.813rem] items-center justify-center gap-[1rem]">
244+
<div className="flex h-[2.25rem] w-full items-center justify-between gap-[1rem]">
233245
<Label
234246
className="font-geist h-[0.875rem] w-[5.5rem] gap-[0.25rem] text-left text-[0.875rem] font-[500] "
235247
htmlFor="accessLevel"
@@ -264,32 +276,41 @@ export default function CreateProjectDialogue(): JSX.Element {
264276
</Select>
265277
</div>
266278

267-
<div className="flex h-[4.875rem] w-[25.813rem] items-center justify-center gap-[1rem]">
268-
<div className="flex h-[2.875rem] w-[22.563rem] flex-col items-start justify-center">
269-
<h1 className="font-geist h-[1.5rem] w-[18.688rem] text-[1rem] font-[500]">
270-
Should the private key be saved or not?
271-
</h1>
272-
<h1 className="font-inter h-[1.25rem] w-[16.563rem] text-[0.8rem] font-normal text-[#A1A1AA] ">
273-
Choose if you want to save your private key
274-
</h1>
275-
</div>
279+
{/* SWITCH */}
280+
<div className="flex flex-col gap-y-4 pb-4">
281+
<div className="flex h-[4.875rem] w-full items-center justify-between gap-[1rem]">
282+
<div className="flex h-[2.875rem] w-[22.563rem] flex-col items-start justify-center">
283+
<h1 className="font-geist h-[1.5rem] w-[18.688rem] text-[1rem] font-[500]">
284+
Should the private key be saved or not?
285+
</h1>
286+
<h1 className="font-inter h-[1.25rem] w-[16.563rem] text-[0.8rem] font-normal text-[#A1A1AA] ">
287+
Choose if you want to save your private key
288+
</h1>
289+
</div>
276290

277-
<div className="p-[0.125rem]">
278-
<Switch
279-
checked={newProjectData.storePrivateKey}
280-
className="h-[1.25rem] w-[2.25rem]"
281-
onCheckedChange={(checked) => {
282-
setNewProjectData((prev) => ({
283-
...prev,
284-
storePrivateKey: checked
285-
}))
286-
}}
287-
/>
291+
<div className="p-[0.125rem]">
292+
<Switch
293+
checked={newProjectData.storePrivateKey}
294+
onCheckedChange={(checked) => {
295+
setNewProjectData((prev) => ({
296+
...prev,
297+
storePrivateKey: checked
298+
}))
299+
}}
300+
/>
301+
</div>
288302
</div>
303+
{
304+
newProjectData.storePrivateKey ? (
305+
<div className="p-4 border border-yellow-300 rounded-lg" ref={privateKeyWarningRef}>
306+
<p className="text-[0.8rem] font-normal text-[#A1A1AA]">Enabling this would save the private key in our database. This would allow all permissible members to read your secrets. In the unnatural event of a data breach, your secrets might be exposed to attackers. We recommend you to not save your private key.</p>
307+
</div>
308+
) : null
309+
}
289310
</div>
290311
</div>
291312
</div>
292-
<div className="flex h-[2.25rem] w-[25.625rem] justify-end">
313+
<div className="flex h-[2.25rem] w-full justify-end">
293314
<Button
294315
className="font-inter h-[2.25rem] w-[8rem] rounded-[0.375rem] text-[0.875rem] font-[500]"
295316
disabled={isLoading}

apps/platform/src/hooks/use-http.ts

+13-7
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,20 @@ export function useHttp<T, V extends ClientResponse<T>>(
3737
handle403()
3838
} else if (statusCode.toString().startsWith('4')) {
3939
// For 4xx errors
40-
const { header, body } = JSON.parse(response.error.message) as {
41-
header: string
42-
body: string
43-
}
40+
try {
41+
const { header, body } = JSON.parse(response.error.message) as {
42+
header: string
43+
body: string
44+
}
4445

45-
toast.error(header, {
46-
description: body
47-
})
46+
toast.error(header, {
47+
description: body
48+
})
49+
} catch (error) {
50+
toast.error('Faced an error processing your request', {
51+
description: response.error.message
52+
})
53+
}
4854
} else if (statusCode === 500) {
4955
handle500(response.error)
5056
}

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "keyshade-xyz",
3-
"version": "2.12.0-stage.11",
3+
"version": "2.12.0-stage.15",
44
"license": "MPL-2.0",
55
"private": true,
66
"engineStrict": false,

0 commit comments

Comments
 (0)