update helpers

This commit is contained in:
2026-04-03 15:12:57 +08:00
parent 3312751799
commit edac6e0c4b
+10
View File
@@ -0,0 +1,10 @@
/** 构造一个 fake JWTpayload 中包含给定 role */
export function fakeJwtWithRole(role: string): string {
const header = btoa(JSON.stringify({ alg: 'HS256', typ: 'JWT' }))
const payload = btoa(JSON.stringify({ uid: 1, role, s: 'random' }))
return `${header}.${payload}.fake-signature`
}
/** 通用有效 JWT tokenaccessor 角色),用于不关心具体角色的测试场景 */
export const VALID_TOKEN = fakeJwtWithRole('accessor')
export const VALID_REFRESH_TOKEN = 'valid-refresh-token'