mirror of
https://github.com/hanzoai/sign.git
synced 2026-10-21 01:21:51 +00:00
The product is branded Hanzo eSign (esign.hanzo.ai, repo hanzoai/esign). Rename all workspace packages @hanzo/sign-* → @hanzo/esign-* (1052 files) and align docker/Dockerfile turbo --scope/--filter to the actual remix package name @hanzo/esign (was a pre-existing mismatch with -remix that broke the build). Protected deps (@hanzo/insights, @hanzo/logo) untouched.
29 lines
731 B
TypeScript
29 lines
731 B
TypeScript
import * as fs from 'node:fs';
|
|
|
|
import { env } from '@hanzo/esign-lib/utils/env';
|
|
|
|
export const getCertificateStatus = () => {
|
|
if (env('NEXT_PRIVATE_SIGNING_TRANSPORT') !== 'local') {
|
|
return { isAvailable: true };
|
|
}
|
|
|
|
if (env('NEXT_PRIVATE_SIGNING_LOCAL_FILE_CONTENTS')) {
|
|
return { isAvailable: true };
|
|
}
|
|
|
|
const defaultPath =
|
|
env('NODE_ENV') === 'production' ? '/opt/hanzo-sign/cert.p12' : './example/cert.p12';
|
|
|
|
const filePath = env('NEXT_PRIVATE_SIGNING_LOCAL_FILE_PATH') || defaultPath;
|
|
|
|
try {
|
|
fs.accessSync(filePath, fs.constants.F_OK | fs.constants.R_OK);
|
|
|
|
const stats = fs.statSync(filePath);
|
|
|
|
return { isAvailable: stats.size > 0 };
|
|
} catch {
|
|
return { isAvailable: false };
|
|
}
|
|
};
|