Skip to content

Commit

Permalink
Added schemas that will be used by the FileSystem DAC
Browse files Browse the repository at this point in the history
  • Loading branch information
redsolver committed Jul 29, 2021
1 parent bebfca4 commit a38b6d1
Show file tree
Hide file tree
Showing 3 changed files with 150 additions and 0 deletions.
59 changes: 59 additions & 0 deletions draft-01/directoryFile.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
{
"$id": "https://skystandards.hns.siasky.net/draft-01/directoryFile.schema.json",
"$schema": "http://json-schema.org/draft-07/schema#",
"description": "Metadata of a file, can contain multiple versions",
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "Name of this file"
},
"created": {
"type": "integer",
"description": "Unix timestamp (in milliseconds) when this file was created",
"minimum": 0
},
"modified": {
"type": "integer",
"description": "Unix timestamp (in milliseconds) when this file was last modified",
"minimum": 0
},
"mimeType": {
"type": "string",
"description": "MIME Type of the file, optional"
},
"version": {
"type": "integer",
"description": "Current version of the file. When this file was already modified 9 times, this value is 9",
"minimum": 0
},
"size": {
"type": "integer",
"description": "Unencrypted size of the file, in bytes",
"minimum": 0
},
"file": {
"$ref": "https://skystandards.hns.siasky.net/draft-01/fileData.schema.json",
"description": "The current version of a file"
},
"history": {
"type": "object",
"patternProperties": {
"^[0-9]+$": {
"$ref": "https://skystandards.hns.siasky.net/draft-01/fileData.schema.json",
"description": "A file version"
}
},
"description": "Historic versions of a file",
"additionalProperties": false
}
},
"required": [
"name",
"created",
"modified",
"version",
"size",
"file"
]
}
43 changes: 43 additions & 0 deletions draft-01/directoryIndex.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
"$id": "https://skystandards.hns.siasky.net/draft-01/directoryIndex.schema.json",
"$schema": "http://json-schema.org/draft-07/schema#",
"description": "Index file of a directory, contains all directories and files in this specific directory",
"type": "object",
"properties": {
"directories": {
"type": "object",
"patternProperties": {
"^.+$": {
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "Name of this directory"
},
"created": {
"type": "integer",
"description": "Unix timestamp (in milliseconds) when this directory was created",
"minimum": 0
}
}
}
},
"additionalProperties": false,
"description": "A subdirectory in this directory"
},
"files": {
"type": "object",
"patternProperties": {
"^.+$": {
"$ref": "https://skystandards.hns.siasky.net/draft-01/directoryFile.schema.json"
}
},
"additionalProperties": false,
"description": "A file in this directory"
}
},
"required": [
"directories",
"files"
]
}
48 changes: 48 additions & 0 deletions draft-01/fileData.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
"$id": "https://skystandards.hns.siasky.net/draft-01/fileData.schema.json",
"$schema": "http://json-schema.org/draft-07/schema#",
"description": "Specific version of a file. Immutable.",
"type": "object",
"properties": {
"url": {
"type": "string",
"description": "URL where the encrypted file blob can be downloaded, usually a skylink (sia://)"
},
"key": {
"type": "string",
"description": "The secret key used to encrypt this file, base64Url-encoded"
},
"encryptionType": {
"type": "string",
"description": "Which algorithm is used to encrypt and decrypt this file",
"examples": [
"AEAD_XCHACHA20_POLY1305"
]
},
"chunkSize": {
"type": "integer",
"description": "maxiumum size of every unencrypted file chunk in bytes",
"exclusiveMinimum": 0,
"examples": [
16777216
]
},
"hash": {
"$ref": "https://skystandards.hns.siasky.net/draft-01/hash.schema.json",
"description": "Multihash of the unencrypted file, starts with 1220 for sha256"
},
"ts": {
"type": "integer",
"description": "Unix timestamp (in milliseconds) when this version was added to the FileSystem DAC",
"minimum": 0
}
},
"required": [
"url",
"key",
"encryptionType",
"chunkSize",
"hash",
"ts"
]
}

0 comments on commit a38b6d1

Please sign in to comment.