DEV Community

Cover image for I Built a VS Code Extension to Upload Code Snippets to PasteDB in One Click šŸš€
Aditya Sorathiya
Aditya Sorathiya

Posted on Edited on

I Built a VS Code Extension to Upload Code Snippets to PasteDB in One Click šŸš€

I created the official PasteDB VS Code extension that lets you upload your current file or selected code directly from Visual Studio Code. It includes secure API key storage, customizable upload settings, recent paste history, automatic language detection, and instant shareable links. In this post, I'll explain how it works, how to install it, and the challenges I faced while building it.
More Info
View on Marketplace

Top comments (165)

Collapse
 
aditya_sorathiya_069252f4 profile image
Aditya Sorathiya •

Do any one tried the extension?
Is there something missing?

 
aditya_sorathiya_069252f4 profile image
Aditya Sorathiya •

I tried with incognito also but I got same, (I was prevented from screenshoting)
There was also no VPN active

 
aditya_sorathiya_069252f4 profile image
Aditya Sorathiya •

One ux update
When title or content exceed the limit of characters
Then after showing alert you are emptying that fields
So user has to type that again
So don't delete the content in title and content

 
aditya_sorathiya_069252f4 profile image
Aditya Sorathiya •

Perfect! šŸ‘ That's exactly what I wanted to clarify. Server-side encryption at rest is a good approach for this use case. Looking forward to seeing the integration.

So if you want you can start integration
If any error occurs in node js SDK, u are free to tell me

 
aditya_sorathiya_069252f4 profile image
Aditya Sorathiya •

If u store that one key in env then yes, that's secure against someone stealing the database, but it's not end-to-end encryption. Since Vlox has both the encrypted API key and the AES key from the environment, Vlox can decrypt and read the API key whenever needed. It's server-side encryption (encryption at rest), which is perfectly valid, just not E2EE.

 
aditya_sorathiya_069252f4 profile image
Aditya Sorathiya •

You can't do that
It will exploit sensitive information of user
If I allow you to make api at the name of the user without asking them then that would be trouble for both of us
Instead say if you want to make a stylish paste , enter the API
Or something like that

Thread Thread
 
aditya_sorathiya_069252f4 profile image
Aditya Sorathiya •

How will you make account
By normal email and password
Or let the user register
I only have Continue with Google way to be registered or loggedin
So you can't make a account as things like email of user can not be used without their permission
Etc

Thread Thread
 
aditya_sorathiya_069252f4 profile image
Aditya Sorathiya •

But why we need to get the API key
User will enter the API key if he want
And Vlox can save in localStorage or indexed db (in the device) or can be stored on Vlox Database or server

 
aditya_sorathiya_069252f4 profile image
Aditya Sorathiya •

You said of post requests
But what about ownership
The paste will belong to whom?
Will it be guest?
If guest paste then no one can edit it
Or you can do this
Say the user to make the API key of pastedb of user by registering them to pastedb
And put that api key in vlox to make pastes whose owner is user

Collapse
 
aditya_sorathiya_069252f4 profile image
Aditya Sorathiya •

Tip: If pastedb.netlify.app is blocked in your country, try using a VPN for the best experience. Alternatively, you can access the GitHub Pages mirror at sorathiya903.github.io/pastedb/⁠

Note: If you encounter a 404 Not Found page, make sure the URL contains /pastedb/ after the domain. If it doesn't, simply append /pastedb/ to the URL and reload the page.

Example:
āŒ sorathiya903.github.io/explore
āœ… sorathiya903.github.io/pastedb/exp...

 
aditya_sorathiya_069252f4 profile image
Aditya Sorathiya •

I saw your paste on PasteDB explore
Nice!!
What happened, you were saying that I will integrate PasteDB, is that completed?
I made PasteDB CLI for those people who can't access netlify sites

 
aditya_sorathiya_069252f4 profile image
Aditya Sorathiya • • Edited

But one problem
Hashing is one way
IT can't be reversed to a raw api

One small note though: if Vlox needs to use the API key later, don't hash it.
If you store it on your server, encrypt it (AES-256 is a good choice) and decrypt it only when making a request to PasteDB. If you store it only on the user's device, that's fine too.

Storing in IndexedDB is good for now
If user wants to update api he can do , no fetchs to api and change on server
It's fast also
As if first getting the api key from db then making paste is time consuming

Thread Thread
 
aditya_sorathiya_069252f4 profile image
Aditya Sorathiya •

But one problem
Hashing is one way
IT can't be reversed to a raw api

One small note though: if Vlox needs to use the API key later, don't hash it.
If you store it on your server, encrypt it (AES-256 is a good choice) and decrypt it only when making a request to PasteDB. If you store it only on the user's device, that's fine too.

Storing in IndexedDB is good for now
If user wants to update api he can do , no fetchs to api and change on server
It's fast also
As if first getting the api key from db then making paste is time consuming

Some comments may only be visible to logged-in visitors. Sign in to view all comments.