mirror of
https://github.com/supermemoryai/supermemory.git
synced 2026-10-03 02:21:23 +00:00
chore: improve supermemory maintenance path
This commit is contained in:
parent
819090ae9d
commit
821c7b31b6
2 changed files with 16 additions and 1 deletions
15
apps/mcp/src/auth.test.ts
Normal file
15
apps/mcp/src/auth.test.ts
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
import { describe, expect, it } from "vitest"
|
||||
import { isApiKey } from "./auth"
|
||||
|
||||
describe("isApiKey", () => {
|
||||
it("returns true for keys with the sm_ prefix and length > 3", () => {
|
||||
expect(isApiKey("sm_valid_key")).toBe(true)
|
||||
expect(isApiKey("sm_123")).toBe(true)
|
||||
})
|
||||
|
||||
it("returns false for the bare prefix or missing prefix", () => {
|
||||
expect(isApiKey("sm_")).toBe(false)
|
||||
expect(isApiKey("")).toBe(false)
|
||||
expect(isApiKey("oauth_token")).toBe(false)
|
||||
})
|
||||
})
|
||||
|
|
@ -15,7 +15,7 @@ export interface AuthUser {
|
|||
* Check if a token is an API key (starts with "sm_")
|
||||
*/
|
||||
export function isApiKey(token: string): boolean {
|
||||
return token.startsWith("sm_")
|
||||
return token.startsWith("sm_") && token.length > 3
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue