Codehagen / Dingify

Dingify is helping you unlock the power of seamless real-time monitoring
https://www.dingify.io/
GNU Affero General Public License v3.0
191 stars 25 forks source link

Feature: Generate new API-key for user #11

Closed Codehagen closed 4 months ago

Praashh commented 4 months ago

hey @Codehagen what type of passkey we have to generate can you elaborate a bit with some ss ?

Codehagen commented 4 months ago

Hi @Praashh - I have been working on the component when a user first logs inn, they need to be able to generate a API key.

import { randomBytes } from 'crypto';

function generateApiKey(length: number = 32): string {
  // Create a buffer of random bytes
  const bytes = randomBytes(length);
  // Convert bytes to a hexadecimal string
  return bytes.toString('hex');
}

export default generateApiKey;

Need to update the prisma schema first.

Praashh commented 4 months ago

ok got it @Codehagen if noone isn't working on this issue, will happy to work upon that.

Codehagen commented 4 months ago

I need a way to copy the api key from the frontend and maybe make it so it displays **. Can make a issue now for you? Screenshot 2024-05-13@2x

Codehagen commented 4 months ago

@Praashh you can see the issue here #18

Praashh commented 4 months ago

ok let me give it a try.

Codehagen commented 4 months ago

Any questions @Praashh ? 😁

Praashh commented 4 months ago

not now sir , need to setup locally first is there any community channel of Dingify?

Codehagen commented 4 months ago

Hi @Praashh Somone started on this actully made it... But I can make another one for you.