MCPcopy Index your code
hub / github.com/massCodeIO/massCode / generateIntegrationToken

Function generateIntegrationToken

src/main/api/integrations/auth.ts:27–42  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

25}
26
27export function generateIntegrationToken(): {
28 token: string
29 tokenPreview: string
30} {
31 const token = `${TOKEN_PREFIX}${randomBytes(TOKEN_BYTES).toString('base64url')}`
32 const tokenPreview = getTokenPreview(token)
33
34 store.preferences.set('api.integrations.enabled', true)
35 store.preferences.set(
36 'api.integrations.tokenHash',
37 hashIntegrationToken(token),
38 )
39 store.preferences.set('api.integrations.tokenPreview', tokenPreview)
40
41 return { token, tokenPreview }
42}
43
44export function revokeIntegrationToken(): void {
45 store.preferences.set('api.integrations.enabled', false)

Callers 1

registerSystemHandlersFunction · 0.90

Calls 3

getTokenPreviewFunction · 0.85
hashIntegrationTokenFunction · 0.85
setMethod · 0.45

Tested by

no test coverage detected