mirror of
https://github.com/immich-app/immich
synced 2025-11-14 17:36:12 +00:00
refactor(server): license key env (#13162)
This commit is contained in:
parent
2c8c3651de
commit
3ddb5b8733
6 changed files with 37 additions and 41 deletions
|
|
@ -1,6 +1,5 @@
|
|||
import { BadRequestException, Injectable, NotFoundException } from '@nestjs/common';
|
||||
import { DateTime } from 'luxon';
|
||||
import { getClientLicensePublicKey, getServerLicensePublicKey } from 'src/config';
|
||||
import { SALT_ROUNDS } from 'src/constants';
|
||||
import { StorageCore } from 'src/cores/storage.core';
|
||||
import { AuthDto } from 'src/dtos/auth.dto';
|
||||
|
|
@ -133,16 +132,18 @@ export class UserService extends BaseService {
|
|||
throw new BadRequestException('Invalid license key');
|
||||
}
|
||||
|
||||
const { licensePublicKey } = this.configRepository.getEnv();
|
||||
|
||||
const clientLicenseValid = this.cryptoRepository.verifySha256(
|
||||
license.licenseKey,
|
||||
license.activationKey,
|
||||
getClientLicensePublicKey(),
|
||||
licensePublicKey.client,
|
||||
);
|
||||
|
||||
const serverLicenseValid = this.cryptoRepository.verifySha256(
|
||||
license.licenseKey,
|
||||
license.activationKey,
|
||||
getServerLicensePublicKey(),
|
||||
licensePublicKey.server,
|
||||
);
|
||||
|
||||
if (!clientLicenseValid && !serverLicenseValid) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue