We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents f7b9b05 + 4662be4 commit e6729bfCopy full SHA for e6729bf
1 file changed
backend/src/modules/api-keys/domain/aggregates/ApiKey.ts
@@ -268,7 +268,9 @@ export class ApiKey extends AggregateRoot<ApiKeyId> {
268
const rawKeySecret = ApiKey.generateApiKeySecret();
269
const rawEncryptionKey = ApiKey.generateEncryptKey();
270
const keyHint = rawKeySecret.slice(-4);
271
- const apiKeySecret = crypto.createHash('sha256').update(rawKeySecret).digest('hex');
+ const salt = crypto.randomBytes(16).toString('hex');
272
+ const derivedKey = crypto.scryptSync(rawKeySecret, salt, 64).toString('hex');
273
+ const apiKeySecret = `${salt}:${derivedKey}`;
274
275
this.props.apiKeySecret = apiKeySecret;
276
this.props.keyHint = keyHint;
0 commit comments