# File Generation and Infrastructure

## File Naming Conventions

### Standard Naming

**Format:** `{COMPANY_LEGAL_NAME}{COMPANY_ID}{AGENCY_NAME}{YYYYMMDD}.txt`

**Example:** `ACMELENDINGLLCCPYL69X5Z1EQUIFAX20260101.txt`

**Rules:**

- Company legal name: First 20 characters, special characters removed
- Company ID: Peach public company ID
- Agency name: Full agency name in uppercase
- Date: Activity date in `YYYYMMDD` format


### Experian Convention

**Format:** `{FILE_NAME_PREFIX}.{MMDDYYYY}.txt`

**Example:** `MKFRT.01012026.txt`

**Requirements:**

- `nameFilePerAgencyConvention: true`
- `fileNamePrefix` must be set (provided by Experian)
- Date format is `MMDDYYYY` (different from standard)


### Chunk File Naming (Internal)

**Format:** `part.{agency}.{date}.{chunk_id}.peach.txt`

**Example:** `part.equifax.20260101.abc123.peach.txt`

### Metadata File Naming (Internal)

**Format:** `metadata.{agency}.{date}.{chunk_id}.json`

**Example:** `metadata.equifax.20260101.abc123.json`

## SFTP Upload and Encryption

### Authentication Methods

**Username/Password:**


```json
{
  "sftpAccessMethod": "usernamePassword",
  "sftpHostname": "sftp.bureau.com:22",
  "sftpUsername": "yourcompany",
  "sftpPassword": "encrypted_password"
}
```

**SSH Keys:**


```json
{
  "sftpAccessMethod": "keys",
  "sftpHostname": "sftp.bureau.com:22"
}
```

When using keys, Peach generates a key pair. Share the public key with the bureau.

### GPG Encryption

When `encryptionMethod: "GPG"` is configured:

1. Generate Metro 2 file in plain text
2. Import bureau's public key
3. Encrypt file using GPG
4. Upload encrypted file to SFTP


### Directory Navigation

Use `sftpCdDir` to specify the upload directory:


```json
{
  "sftpCdDir": "/inbound/metro2"
}
```

The system will `cd` to this directory before uploading.

### File Creation Record

After upload, a FileCreationRecord is created:

**Success:**


```json
{
  "creditAgencyIds": ["CA-XXX"],
  "companyIds": ["CP-YYY"],
  "agencyName": "equifax",
  "status": "succeeded",
  "activityDate": "2025-12-31",
  "fileName": "ACMELENDING...20260101.txt"
}
```

**Failure:**


```json
{
  "status": "failed",
  "failureDescription": "SFTP connection timeout"
}
```