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