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