MCPcopy Create free account
hub / github.com/evolution-foundation/evolution-api / saveKey

Function saveKey

src/utils/use-multi-file-auth-state-prisma.ts:28–45  ·  view source on GitHub ↗
(sessionId: string, keyJson: any)

Source from the content-addressed store, hash-verified

26}
27
28export async function saveKey(sessionId: string, keyJson: any): Promise<any> {
29 const exists = await keyExists(sessionId);
30 try {
31 if (!exists)
32 return await prismaRepository.session.create({
33 data: {
34 sessionId: sessionId,
35 creds: JSON.stringify(keyJson),
36 },
37 });
38 await prismaRepository.session.update({
39 where: { sessionId: sessionId },
40 data: { creds: JSON.stringify(keyJson) },
41 });
42 } catch {
43 return null;
44 }
45}
46
47export async function getAuthKey(sessionId: string): Promise<any> {
48 try {

Callers 1

writeDataFunction · 0.85

Calls 3

keyExistsFunction · 0.85
updateMethod · 0.80
createMethod · 0.45

Tested by

no test coverage detected