HOWTO:

HOWTO:

### 1. nosdav.go - Main backend file for NosDAV

#### Functions:
- NewFs: Initializes a new file system based on the provided NosDAV config.
- list: Lists the files in the NosDAV backend.
- createDir: Creates a new directory.
- removeDir: Removes a directory.
- updateFile: Updates or creates a new file.
- deleteFile: Deletes a file.
- retrieveFile: Retrieves a file from NosDAV.

---

### 2. identity.go - Handles Nostr identity-related functions

#### Functions:
- getNostrID: Retrieves the NostrID for the user.
- validateNostrID: Validates a given NostrID.
- generateNostrID: Generates a new NostrID (if needed).

---

### 3. http.go - HTTP request handling for NosDAV

#### Functions:
- doGetRequest: Executes a GET request to NosDAV.
- doPutRequest: Executes a PUT request to NosDAV.

---

### 4. auth.go - Handles authentication for NosDAV

#### Functions:
- generateAuthHeader: Generates the authentication header for NosDAV requests.
- signNostrEvent: Signs a nostr event using the Schnorr signature scheme.
- validateAuthHeader: Validates the received authentication header.

---

### 5. content.go - Handles content types and file-related operations

#### Functions:
- getContentType: Determines the content type based on the file extension.
- readFile: Reads the contents of a file.
- writeFile: Writes contents to a file.

---

### 6. cors.go - Handles CORS for NosDAV

#### Functions:
- setCORSHeaders: Sets the necessary CORS headers for NosDAV responses.

---

### 7. discovery.go - Handles discovery of user storage

#### Functions:
- discoverStorage: Discovers user storage based on NostrID and other tags.
- storeURI: Stores the base URI for user storage.

---

### 8. config.go - Manages configuration for the NosDAV backend

#### Functions:
- loadConfig: Loads configuration for NosDAV from the rclone config file.
- saveConfig: Saves configuration to the rclone config file.