1import { CommandError } from '../utils/errors'; 2import { fetchAsync } from './rest/client'; 3import { ensureLoggedInAsync } from './user/actions'; 4 5export async function getExpoGoIntermediateCertificateAsync(easProjectId: string): Promise<string> { 6 await ensureLoggedInAsync(); 7 const response = await fetchAsync( 8 `projects/${encodeURIComponent( 9 easProjectId 10 )}/development-certificates/expo-go-intermediate-certificate`, 11 { 12 method: 'GET', 13 } 14 ); 15 if (!response.ok) { 16 throw new CommandError('API', `Unexpected error from Expo servers: ${response.statusText}.`); 17 } 18 const buffer = await response.buffer(); 19 return buffer.toString('utf8'); 20} 21