feat(release): prepare 1.1.0 candidate
This commit is contained in:
parent
5a34f66981
commit
5205dcdfa9
736 changed files with 115667 additions and 12203 deletions
15
apps/mobile-rn/src/features/admin/admin-session.ts
Normal file
15
apps/mobile-rn/src/features/admin/admin-session.ts
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
import { supabase } from '../../lib/supabase'
|
||||
import { AdminServiceError } from './admin-service'
|
||||
|
||||
export async function requireAdminAccessToken(expectedUserId: string): Promise<string> {
|
||||
const { data, error } = await supabase.auth.getSession()
|
||||
const session = data.session
|
||||
if (error !== null || session === null || session.user.id !== expectedUserId) {
|
||||
throw new AdminServiceError('auth', null, false)
|
||||
}
|
||||
const token = session.access_token.trim()
|
||||
if (token.length < 20 || token.length > 16_384 || /\s/.test(token)) {
|
||||
throw new AdminServiceError('auth', null, false)
|
||||
}
|
||||
return token
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue