MCPcopy Index your code
hub / github.com/cameri/nostream / getRelayPrivateKey

Function getRelayPrivateKey

src/utils/event.ts:129–143  ·  view source on GitHub ↗
(secret?: string)

Source from the content-addressed store, hash-verified

127
128let privateKeyCache: string | undefined
129export 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
145const publicKeyCache: Record<string, string> = {}
146export const getPublicKey = (privkey: string) => {

Callers 4

handleRequestMethod · 0.90
getRelayPublicKeyMethod · 0.90
getRelayPublicKeyMethod · 0.90

Calls 2

deriveFromSecretFunction · 0.90
toStringMethod · 0.80

Tested by

no test coverage detected