From c15351b793622080610d0b8865a73d1bcd0b65c0 Mon Sep 17 00:00:00 2001 From: El RIDO Date: Mon, 17 Dec 2018 19:43:16 +0100 Subject: [PATCH] designing v2 paste & comment format --- js/comment.jsonld | 34 ++++++++++++---- js/commentmeta.jsonld | 41 +++++++++++++++++-- js/paste.jsonld | 44 ++++++++++++++------ js/pastemeta.jsonld | 56 ++++++++++++++++++++++--- js/types.jsonld | 95 +++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 239 insertions(+), 31 deletions(-) create mode 100644 js/types.jsonld diff --git a/js/comment.jsonld b/js/comment.jsonld index 3ce0a4df..fa6958c2 100644 --- a/js/comment.jsonld +++ b/js/comment.jsonld @@ -1,16 +1,32 @@ { "@context": { "so": "https://schema.org/", - "status": "so:Integer", - "id": "so:name", - "parentid": "so:name", - "url: { - "@id": "so:url", - "@type": "@id" + "pb": "?jsonld=types#", + "cm": "?jsonld=commentmeta#", + "status": { + "@type": "so:Integer" + }, + "id": { + "@type": "so:name" + }, + "parentid": { + "@type": "so:name" + }, + "url": { + "@type": "so:url" + }, + "v": { + "@type": "so:Integer", + "@value": 2 + }, + "ct": { + "@type": "pb:CipherText" + }, + "adata": { + "@type": "cm:AuthenticatedData" }, - "data": "so:Text", "meta": { - "@id": "?jsonld=commentmeta" - } + "@type": "cm:MetaData" + }, } } \ No newline at end of file diff --git a/js/commentmeta.jsonld b/js/commentmeta.jsonld index 4b74cb96..1dde0c2f 100644 --- a/js/commentmeta.jsonld +++ b/js/commentmeta.jsonld @@ -1,8 +1,43 @@ { "@context": { "so": "https://schema.org/", - "postdate": "so:Integer", - "nickname": "so:Text", - "vizhash": "so:Text" + "pb": "?jsonld=types#" + }, + "AuthenticatedData": { + "@container": "@list", + "@value": [ + { + "@type": "pb:InitializationVector" + }, + { + "@type": "pb:Salt" + }, + { + "@type": "pb:Iterations" + }, + { + "@type": "pb:KeySize" + }, + { + "@type": "pb:TagSize" + }, + { + "@type": "pb:Algorithm" + }, + { + "@type": "pb:Mode" + }, + { + "@type": "pb:Compression" + } + ] + }, + "MetaData": { + "created": { + "@type": "CreationTime" + }, + "icon": { + "@type": "so:url" + } } } \ No newline at end of file diff --git a/js/paste.jsonld b/js/paste.jsonld index a6d05752..bf8b8b68 100644 --- a/js/paste.jsonld +++ b/js/paste.jsonld @@ -1,24 +1,42 @@ { "@context": { "so": "https://schema.org/", - "status": {"@id": "so:Integer"}, - "id": {"@id": "so:name"}, - "deletetoken": {"@id": "so:Text"}, - "url": { - "@type": "@id", - "@id": "so:url" + "pb": "?jsonld=types#", + "pm": "?jsonld=pastemeta#", + "status": { + "@type": "so:Integer" + }, + "id": { + "@type": "so:name" + }, + "deletetoken": { + "@type": "so:Text" + }, + "url": { + "@type": "so:url" + }, + "v": { + "@type": "so:Integer", + "@value": 2 + }, + "ct": { + "@type": "pb:CipherText" + }, + "adata": { + "@type": "pm:AuthenticatedData" }, - "data": {"@id": "so:Text"}, - "attachment": {"@id": "so:Text"}, - "attachmentname": {"@id": "so:Text"}, "meta": { - "@id": "?jsonld=pastemeta" + "@type": "pm:MetaData" }, "comments": { - "@id": "?jsonld=comment", + "@type": "?jsonld=comment", "@container": "@list" }, - "comment_count": {"@id": "so:Integer"}, - "comment_offset": {"@id": "so:Integer"} + "comment_count": { + "@type": "so:Integer" + }, + "comment_offset": { + "@type": "so:Integer" + } } } \ No newline at end of file diff --git a/js/pastemeta.jsonld b/js/pastemeta.jsonld index 75bbbddf..2c4efc5e 100644 --- a/js/pastemeta.jsonld +++ b/js/pastemeta.jsonld @@ -1,11 +1,55 @@ { "@context": { "so": "https://schema.org/", - "formatter": {"@id": "so:Text"}, - "postdate": {"@id": "so:Integer"}, - "opendiscussion": {"@id": "so:True"}, - "burnafterreading": {"@id": "so:True"}, - "expire_date": {"@id": "so:Integer"}, - "remaining_time": {"@id": "so:Integer"} + "pb": "?jsonld=types#" + }, + "AuthenticatedData": { + "@container": "@list", + "@value": [ + { + "@type": "pb:InitializationVector" + }, + { + "@type": "pb:Salt" + }, + { + "@type": "pb:Iterations" + }, + { + "@type": "pb:KeySize" + }, + { + "@type": "pb:TagSize" + }, + { + "@type": "pb:Algorithm" + }, + { + "@type": "pb:Mode" + }, + { + "@type": "pb:Compression" + }, + { + "@type": "pb:Formatter" + }, + { + "@type": "pb:OpenDiscussion" + }, + { + "@type": "pb:BurnAfterReading" + }, + { + "@type": "pb:Expire" + } + ] + }, + "MetaData": { + "created": { + "@type": "pb:CreationTime" + }, + "time_to_live": { + "@type": "pb:RemainingSeconds" + } } } \ No newline at end of file diff --git a/js/types.jsonld b/js/types.jsonld new file mode 100644 index 00000000..be4279ad --- /dev/null +++ b/js/types.jsonld @@ -0,0 +1,95 @@ +{ + "@context": { + "so": "https://schema.org/", + "dp": "http://dbpedia.org/resource/", + "pb": "?jsonld=types#" + }, + "Base64": { + "@type": "so:Text" + }, + "CipherText": { + "@type": "pb:Base64" + }, + "PasteCipherMessage": { + "paste": { + "@type": "so:Text" + }, + "attachment": { + "@type": "so:MediaObject" + }, + "attachment_name": { + "@type": "so:Text" + } + }, + "CommentCipherMessage": { + "comment": { + "@type": "so:Text" + }, + "nickname": { + "@type": "so:Text" + } + }, + "InitializationVector": { + "@type": "pb:Base64" + }, + "Salt": { + "@type": "pb:Base64" + }, + "Iterations": { + "@type": "so:Integer", + "@minimum": 1 + }, + "KeySize": { + "@type": "so:Integer", + "@value": 256, + "@minimum": 128, + "@maximum": 256, + "@enum": [128, 196, 256] + }, + "TagSize": { + "@type": "so:Integer", + "@value": 128, + "@minimum": 32, + "@maximum": 128, + "@enum": [32, 64, 96, 104, 112, 120, 128] + }, + "Algorithm": { + "@type": "so:Text", + "@value": "aes" + }, + "Mode": { + "@type": "so:Text", + "@value": "gcm", + "@enum": ["ctr", "cbc", "gcm"] + }, + "Compression": { + "@type": "so:Text", + "@value": "zlib", + "@enum": ["zlib", "none"] + }, + "Formatter": { + "@type": "so:Text", + "@value": "plaintext", + "@enum": ["plaintext", "syntaxhighlighting", "markdown"] + }, + "Expire": { + "@type": "so:Text", + "@value": "1week", + "@enum": ["5min", "10min", "1hour", "1day", "1week", "1month", "1year", "never"] + }, + "OpenDiscussion": { + "@type": "so:Boolean", + "@enum": [false, true] + }, + "BurnAfterReading": { + "@type": "so:Boolean", + "@enum": [false, true] + }, + "CreationTime": { + "@type": "dp:Unix_time" + }, + "RemainingSeconds": { + "@type": "dp:Second", + "@minimum": 1 + } +} \ No newline at end of file