signing a Transfer

I've been looking to try and sign a transfer using the web payments spec.

The transfer would look something like this in JSON LD:

  {
    "@id": "ni:///sha-256;b55be329d380416148577d826b5a5274ad39e757477f50642c4f349a01b76522",
    "@type": "https://w3id.org/commerce#Transfer",
    "https://w3id.org/commerce#source": { "@id" :
"bitcoin:n3LaNorTreXuKaCgqibEpm7GzgRycyZ7bQ" },
    "https://w3id.org/commerce#destination": { "@id" :
"bitcoin:miJHHEv94TWjGH6UDbPPf5RQ3LR9sfYHf7" },
    "https://w3id.org/commerce#amount": { "@value" : "0.5" , "@type" :
"http://www.w3.org/2001/XMLSchema#decimal" },
    "https://w3id.org/commerce#currency": { "@id" :
"http://coin.data.fm/rwwcoin#this" }  ,
    "http://purl.org/dc/terms/created":     {
      "@type": "http://www.w3.org/2001/XMLSchema#dateTime",
      "@value" : "2014-04-14T17:43:22.000Z"
    }
  }


In nomalized ntriples would be

<ni:///sha-256;b55be329d380416148577d826b5a5274ad39e757477f50642c4f349a01b76522>
<http://purl.org/dc/terms/created>
"2014-04-14T17:43:22.000Z"^^<http://www.w3.org/2001/XMLSchema#dateTime>
.
   <ni:///sha-256;b55be329d380416148577d826b5a5274ad39e757477f50642c4f349a01b76522>
<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>
<https://w3id.org/commerce#Transfer> .
   <ni:///sha-256;b55be329d380416148577d826b5a5274ad39e757477f50642c4f349a01b76522>
<https://w3id.org/commerce#amount>
"0.5"^^<http://www.w3.org/2001/XMLSchema#decimal> .
   <ni:///sha-256;b55be329d380416148577d826b5a5274ad39e757477f50642c4f349a01b76522>
<https://w3id.org/commerce#currency>
<http://coin.data.fm/rwwcoin#this> .
   <ni:///sha-256;b55be329d380416148577d826b5a5274ad39e757477f50642c4f349a01b76522>
<https://w3id.org/commerce#destination>
<bitcoin:miJHHEv94TWjGH6UDbPPf5RQ3LR9sfYHf7> .
   <ni:///sha-256;b55be329d380416148577d826b5a5274ad39e757477f50642c4f349a01b76522>
<https://w3id.org/commerce#source>
<bitcoin:n3LaNorTreXuKaCgqibEpm7GzgRycyZ7bQ> .


And a PEM version of the signature would look like:

   -----BEGIN BITCOIN SIGNED MESSAGE-----
   <ni:///sha-256;b55be329d380416148577d826b5a5274ad39e757477f50642c4f349a01b76522>
<http://purl.org/dc/terms/created>
"2014-04-14T17:43:22.000Z"^^<http://www.w3.org/2001/XMLSchema#dateTime>
.
   <ni:///sha-256;b55be329d380416148577d826b5a5274ad39e757477f50642c4f349a01b76522>
<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>
<https://w3id.org/commerce#Transfer> .
   <ni:///sha-256;b55be329d380416148577d826b5a5274ad39e757477f50642c4f349a01b76522>
<https://w3id.org/commerce#amount>
"0.5"^^<http://www.w3.org/2001/XMLSchema#decimal> .
   <ni:///sha-256;b55be329d380416148577d826b5a5274ad39e757477f50642c4f349a01b76522>
<https://w3id.org/commerce#currency>
<http://coin.data.fm/rwwcoin#this> .
   <ni:///sha-256;b55be329d380416148577d826b5a5274ad39e757477f50642c4f349a01b76522>
<https://w3id.org/commerce#destination>
<bitcoin:miJHHEv94TWjGH6UDbPPf5RQ3LR9sfYHf7> .
   <ni:///sha-256;b55be329d380416148577d826b5a5274ad39e757477f50642c4f349a01b76522>
<https://w3id.org/commerce#source>
<bitcoin:n3LaNorTreXuKaCgqibEpm7GzgRycyZ7bQ> .
   -----BEGIN SIGNATURE-----
   n3LaNorTreXuKaCgqibEpm7GzgRycyZ7bQ
   G9Rv2T5uNzpdeBeOz36EeleB/H+aqr1nHv87YT4ibzKouTXhgFoO7xbVejGtJLzGTk2EvKNZIUgp2+/yb77l9IA=
   -----END BITCOIN SIGNED MESSAGE-----


How would I create a signature object in JSON LD using the security spec?

I am assuming it would look something like:

     "https://w3id.org/security#signature":
     {
       "@id" : "#sig <https://testcoin.data.fm/tx/1#sig>",
       "@type": "https://w3id.org/security#GraphSignature2012",
       "http://purl.org/dc/terms/creator": { "@id" :
"bitcoin:n3LaNorTreXuKaCgqibEpm7GzgRycyZ7bQ" },
       "https://w3id.org/security#signatureAlgorithm": "ecdsa-secp256k1",
       "https://w3id.org/security#signatureValue":
"n3LaNorTreXuKaCgqibEpm7GzgRycyZ7bQG9Rv2T5uNzpdeBeOz36EeleB/H+aqr1nHv87YT4ibzKouTXhgFoO7xbVejGtJLzGTk2EvKNZIUgp2+/yb77l9IA="
     }


Do I have the fields for signatureAlgorithm and creator correct, or have I
misunderstood something?

Received on Monday, 14 April 2014 18:12:10 UTC