Content Address
Title: Content Address
| Type | object |
| Required | No |
| Additional properties | Not allowed |
Description: This schema describes the JSON representation of Nix's ContentAddress type, which conveys information about content-addressing store objects.
Note
For current methods of content addressing, this data type is a bit suspicious, because it is neither simply a content address of a file system object (the
methodis richer), nor simply a content address of a store object (thehashdoesn't account for the references). It should thus only be used in contexts where the references are also known / otherwise made tamper-resistant.
| Property | Type | Pattern | Title/Description |
|---|---|---|---|
| + method | enum (of string) | No | Content-Addressing Method |
| + hash | string | No | Content Address |
1. Property method
Title: Content-Addressing Method
| Type | enum (of string) |
| Required | Yes |
| Defined in | JSON format for ContentAddress |
Description: A string representing the method of content addressing that is chosen.
Valid method strings are:
Must be one of:
- "flat"
- "nar"
- "text"
- "git"
2. Property hash
Title: Content Address
| Type | string |
| Required | Yes |
| Defined in | JSON format for Hash |
Description: This would be the content-address itself.
For all current methods, this is just a content address of the file system object of the store object, as described in the store chapter, and not of the store object as a whole. In particular, the references of the store object are not taken into account with this hash (and currently-supported methods).
Examples:
"sha256-ungWv48Bz+pBQUDeXa4iI7ADYaOWF3qctBD/YfIAFa0="
"sha512-IEqPxt2oLwoM7XvrjgikFlfBbvRosiioJ5vjMacDwzWW/RXBOxsH+aodO+pXeJygMa2Fx6cd1wNU7GMSOMo0RQ=="
| Restrictions | |
|---|---|
| Must match regular expression | ^(blake3|md5|sha1|sha256|sha512)-[A-Za-z0-9+/]+=*$ Test |
Examples
Text method
{
"hash": "sha256-8OTC92xYkW7CWPJGhRvqCR0U1CR6L8PhhpRGGxgW4Ts=",
"method": "text"
}
Nix Archive method
{
"hash": "sha256-9vLqj0XYoFfJVmoz+ZR02i5camYE1zYSFlDicwxvsKM=",
"method": "nar"
}