ElanHR added a comment.

  For illustration purposes, I put together some demo schema based on the 
original proposal by @Lydia_Pintscher.
  
  - Item of Signing Authority <https://test.wikidata.org/wiki/Property:P95711>
  - URL of Signing Authority <https://test.wikidata.org/wiki/Property:P95712>
  - Claim hash <https://test.wikidata.org/wiki/Property:P95705>
  - revision id of subject/signed item 
<https://test.wikidata.org/wiki/Property:P95707>
  - revision id of object value <https://test.wikidata.org/wiki/Property:P95708>
  - PGP public key <https://test.wikidata.org/wiki/Property:P95709> (should 
probably be available on the signing authorities website, added this for 
convenience/illustrative purposes)
  
  And some example items using this schema:
  
  - Example Item <https://test.wikidata.org/wiki/Q214700> (claims in JSON 
format <https://test.wikidata.org/w/api.php?action=wbgetclaims&entity=Q214700>)
  - Example authoritative source <https://test.wikidata.org/wiki/Q214701>
  
  
  
  > Create a normalized serialization of the Statement's main snak and 
qualifiers (excluding rank and references, with normalized field order, 
escaping, whitespace, etc)
  
  As a first draft for this, I would propose the following:
  
  - Remove irrelevant fields ("hash", "rank", etc.) as well as other references 
aside from the new signing statement
  - Sort JSON by field names alphabetically
  
  For example, in order to sign and upload the claim "Q214700 
<https://test.wikidata.org/wiki/Q214700> is an 
<https://test.wikidata.org/wiki/Property:P204> instructor 
<https://test.wikidata.org/wiki/Q11>  for the field of work 
<https://test.wikidata.org/wiki/Property:P128> wikipedia 
<https://test.wikidata.org/wiki/Q11>", the claim would be serialized as follows:
  
    {
      "id": "Q214700$4ef81e12-4396-820f-cd8f-46498d66d380",
      "mainsnak": {
        "datatype": "wikibase-item",
        "datavalue": {
          "type": "wikibase-entityid",
          "value": {
            "entity-type": "item",
            "id": "Q40742",
            "numeric-id": 40742
          }
        },
        "property": "P204",
        "snaktype": "value"
      },
      "qualifiers": {
        "P128": [
          {
            "datatype": "wikibase-item",
            "datavalue": {
              "type": "wikibase-entityid",
              "value": {
                "entity-type": "item",
                "id": "Q11",
                "numeric-id": 11
              }
            },
            "property": "P128",
            "snaktype": "value"
          }
        ]
      },
      "qualifiers-order": [
        "P128"
      ],
      "references": [
        {
          "snaks": {
            "P95707": [
              {
                "datatype": "string",
                "datavalue": {
                  "type": "string",
                  "value": "538357"
                },
                "property": "P95707",
                "snaktype": "value"
              }
            ],
            "P95708": [
              {
                "datatype": "string",
                "datavalue": {
                  "type": "string",
                  "value": "Q40742/123060"
                },
                "property": "P95708",
                "snaktype": "value"
              },
              {
                "datatype": "string",
                "datavalue": {
                  "type": "string",
                  "value": "Q11/520357"
                },
                "property": "P95708",
                "snaktype": "value"
              }
            ],
            "P95711": [
              {
                "datatype": "wikibase-item",
                "datavalue": {
                  "type": "wikibase-entityid",
                  "value": {
                    "entity-type": "item",
                    "id": "Q214701",
                    "numeric-id": 214701
                  }
                },
                "property": "P95711",
                "snaktype": "value"
              }
            ],
            "P95712": [
              {
                "datatype": "url",
                "datavalue": {
                  "type": "string",
                  "value": "https://test-signed-statement.org";
                },
                "hash": "973eada670474c62af0ae00db9b56c87926b8483",
                "property": "P95712",
                "snaktype": "value"
              }
            ]
          },
          "snaks-order": [
            "P95707",
            "P95708",
            "P95711",
            "P95712",
            "P95705"
          ]
        }
      ],
      "type": "statement"
    }
  
  This serialized JSON would be used to generate the statement hash which is 
then added under the `references.snaks` as so:
  
    "P95705": [
              {
                "datatype": "string",
                "datavalue": {
                  "type": "string",
                  "value": "this-is-also-a-fake-hash"
                },
                "property": "P95705",
                "snaktype": "value"
              }
            ]
  
  Note: In order to avoid potential vandalism in the signing reference itself I 
believe all reference properties aside from the hash itself should be part of 
the serialization.
  
  This signed statement could then be uploaded via wbsetclaim 
<https://www.wikidata.org/w/api.php?action=help&modules=wbsetclaim> (with a 
minor modification to merge with existing references).
  
  Happy to hear any ideas/comments/suggestions to improve this approach - this 
is admittedly a rather rough draft. :)

TASK DETAIL
  https://phabricator.wikimedia.org/T138708

EMAIL PREFERENCES
  https://phabricator.wikimedia.org/settings/panel/emailpreferences/

To: ElanHR
Cc: Bugreporter, ElanHR, Addshore, Lokal_Profil, Ayack, jeblad, CalebMoses, 
Fliptrail, Cirdan, Salgo60, AndrewSu, Mineo, Hjfocs, Scott_WorldUnivAndSch, 
Jan_Dittrich, RazShuty, Joshi-Jay-31, Jonas, rosalieper, EddyAfful, BamLifa, 
MichaelSchoenitzer, psinghal20, Nikhil-nk, Liuxinyu970226, BVershbow_WMF, 
PDrouin-WMF, Astinson, Ramsey-WMF, Quoth, Daniel_Mietchen, Tpt, 
Glorian_Yapinus, iecetcwcpggwqpgciazwvzpfjpwomjxn, Jane023, DarTar, Abbe98, 
I9606, YULdigitalpreservation, Tallerone, abian, Scott_WUaS, johl, jayvdb, 
tfmorris, Spinster, TomT0m, Denny, Eloquence, JanZerebecki, T.seppelt, 
Aklapper, daniel, Zppix, Lydia_Pintscher, maantietaja, NavinRizwi, Akuckartz, 
Dinadineke, DannyS712, Nandana, tabish.shaikh91, Lahi, Gq86, GoranSMilovanovic, 
Soteriaspace, Jayprakash12345, JakeTheDeveloper, QZanden, merbst, LawExplorer, 
_jensen, Wikidata-bugs, aude, Dinoguy1000, TheDJ, Mbch331
_______________________________________________
Wikidata-bugs mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikidata-bugs

Reply via email to