(secret?: string)
| 127 | |
| 128 | let privateKeyCache: string | undefined |
| 129 | export function getRelayPrivateKey(secret?: string): string { |
| 130 | if (privateKeyCache) { |
| 131 | return privateKeyCache |
| 132 | } |
| 133 | |
| 134 | if (process.env.RELAY_PRIVATE_KEY) { |
| 135 | privateKeyCache = process.env.RELAY_PRIVATE_KEY |
| 136 | |
| 137 | return privateKeyCache |
| 138 | } |
| 139 | |
| 140 | privateKeyCache = deriveFromSecret(secret).toString('hex') |
| 141 | |
| 142 | return privateKeyCache |
| 143 | } |
| 144 | |
| 145 | const publicKeyCache: Record<string, string> = {} |
| 146 | export const getPublicKey = (privkey: string) => { |
no test coverage detected