mirror of
https://github.com/hzrd149/blossom.git
synced 2025-12-09 07:08:50 +00:00
Require file extension
This commit is contained in:
21
buds/10.md
21
buds/10.md
@@ -11,23 +11,23 @@ Defines a URI schema for referencing Blossom blobs similar to magnet links. This
|
||||
The `blob:` URI schema MUST follow this format:
|
||||
|
||||
```
|
||||
blob:<sha256>[.ext][?param1=value1¶m2=value2...]
|
||||
blob:<sha256>.<ext>[?param1=value1¶m2=value2...]
|
||||
```
|
||||
|
||||
### Components
|
||||
|
||||
- `blob:` - The URI scheme identifier
|
||||
- `<sha256>` - A 64 character lowercase hexadecimal sha256 hash of the blob
|
||||
- `[.ext]` - An optional file extension (e.g., `.pdf`, `.png`, `.jpg`, `.mp4`)
|
||||
- `.<ext>` - A file extension (e.g., `.pdf`, `.png`, `.jpg`, `.mp4`). If the file extension is unknown, it MUST default to `.bin`
|
||||
- `[?params]` - Optional query parameters for discovery hints
|
||||
|
||||
### Examples
|
||||
|
||||
```
|
||||
blob:b1674191a88ec5cdd733e4240a81803105dc412d6c6708d53ab94fc248f4f553
|
||||
blob:b1674191a88ec5cdd733e4240a81803105dc412d6c6708d53ab94fc248f4f553.pdf
|
||||
blob:b1674191a88ec5cdd733e4240a81803105dc412d6c6708d53ab94fc248f4f553.pdf?xs=cdn.example.com
|
||||
blob:b1674191a88ec5cdd733e4240a81803105dc412d6c6708d53ab94fc248f4f553.png?as=ec4425ff5e9446080d2f70440188e3ca5d6da8713db7bdeef73d0ed54d9093f0&sz=184292
|
||||
blob:b1674191a88ec5cdd733e4240a81803105dc412d6c6708d53ab94fc248f4f553.bin
|
||||
```
|
||||
|
||||
## Query Parameters
|
||||
@@ -103,7 +103,7 @@ When parsing a `blob:` URI, clients MUST:
|
||||
|
||||
1. Verify the URI starts with the `blob:` scheme
|
||||
2. Extract the 64 character hexadecimal sha256 hash
|
||||
3. Extract the optional file extension if present
|
||||
3. Extract the file extension (which MUST be present)
|
||||
4. Parse any query parameters (`as`, `xs`, and `sz`) into appropriate types to handle multiple values
|
||||
|
||||
### Resolution Strategy
|
||||
@@ -146,10 +146,13 @@ A client would:
|
||||
|
||||
### Creating and Sharing blob URIs
|
||||
|
||||
When creating or sharing a `blob:` URI, clients SHOULD:
|
||||
When creating or sharing a `blob:` URI, clients MUST:
|
||||
|
||||
1. Always include the sha256 hash
|
||||
2. Include the file extension if known - this is especially important when sharing or embedding the URI in content (such as nostr events, web pages, or messages) as it allows other clients to determine the blob type without downloading or making additional HTTP requests
|
||||
2. Always include a file extension - if the file extension is unknown or cannot be determined, default to `.bin` (similar to how [BUD-01](./01.md#get-sha256---get-blob) defaults the MIME type to `application/octet-stream`)
|
||||
|
||||
Clients SHOULD also:
|
||||
|
||||
3. Include the `sz` parameter with the blob size in bytes to help with verification and download management
|
||||
4. Include at least one `xs` parameter pointing to a server where the blob is known to exist
|
||||
5. Include the `as` parameter with the uploader's pubkey to enable future discovery via their server list
|
||||
@@ -174,12 +177,12 @@ The `blob:` URI schema enables several use cases:
|
||||
|
||||
### Minimal URI
|
||||
```
|
||||
blob:b1674191a88ec5cdd733e4240a81803105dc412d6c6708d53ab94fc248f4f553
|
||||
blob:b1674191a88ec5cdd733e4240a81803105dc412d6c6708d53ab94fc248f4f553.pdf
|
||||
```
|
||||
|
||||
### With File Extension
|
||||
### Unknown File Type
|
||||
```
|
||||
blob:b1674191a88ec5cdd733e4240a81803105dc412d6c6708d53ab94fc248f4f553.pdf
|
||||
blob:b1674191a88ec5cdd733e4240a81803105dc412d6c6708d53ab94fc248f4f553.bin
|
||||
```
|
||||
|
||||
### With Single Server Hint
|
||||
|
||||
Reference in New Issue
Block a user