Thursday, January 28, 2021

Links dumped for working with HashTable

 https://developer.mozilla.org/en-US/docs/Tools/Debugger/How_to/Set_a_breakpoint

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Working_with_Objects

https://www.tutorialspoint.com/Creating-a-hash-table-using-Javascript

https://developer.mozilla.org/en-US/docs/Tools/Debugger/How_to/Set_a_breakpoint

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/values

https://www.tutorialspoint.com/Creating-a-hash-table-using-Javascript

https://www.educative.io/blog/data-strucutres-hash-table-javascript

https://careerkarma.com/blog/javascript-object-keys/

https://usefulangle.com/post/189/javascript-array-intersection-difference

https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Objects/Object_prototypes

https://gist.github.com/bshambaugh/9d8095a6491dfb32bf8328bd21627e60

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map

https://usefulangle.com/post/189/javascript-array-intersection-difference

https://github.com/bshambaugh/BlinkyProject/blob/master/CubeCellandHeltecESP32_try5/esp8266_shop_websockets/custom/hashTable/HashTable.js

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/entries

https://www.javascripttutorial.net/javascript-return-multiple-values/

https://www.tutorialspoint.com/Search-Element-in-an-Javascript-Hash-Table

https://www.tutorialspoint.com/Remove-elements-from-Javascript-Hash-Table

https://www.freecodecamp.org/news/how-to-implement-a-simple-hash-table-in-javascript-cb3b9c1f2997/

https://en.wikipedia.org/wiki/Hash_table

https://www.geeksforgeeks.org/how-to-create-hash-from-string-in-javascript/




Sunday, January 3, 2021

DID document to try

 DID document to try:

{
  "@context": "https://www.w3.org/ns/did/v1",
  "id": "did:example:F9C36F8964623378BDC068D4BCE07ED17C8FA486F9AC0C2613CA3C8C306D7BB6",
  "authentication": [{
    


    "id": "did:example:F9C36F8964623378BDC068D4BCE07ED17C8FA486F9AC0C2613CA3C8C306D7BB#keys-1",
    "type": "JsonWebKey2020",
    "controller": "did:example:F9C36F8964623378BDC068D4BCE07ED17C8FA486F9AC0C2613CA3C8C306D7BB6",
     "publicKeyJwk": {
        "kty": "EC",
        "crv": "P-256",
        "x": "F9C36F8964623378BDC068D4BCE07ED17C8FA486F9AC0C2613CA3C8C306D7BB6",
        "y": "1CD36717B8AC5E4FEA8AD23DC8D0783C2318EE4AD7A80DB6E0026AD0B072A24F"
    }
  }],
  "service": [{
    
    "id":"did:example:F9C36F8964623378BDC068D4BCE07ED17C8FA486F9AC0C2613CA3C8C306D7BB#vcss",
    "type": "VerifiableCredentialService",
    "serviceEndpoint": "https://example.com/vc/"
  }]
}

Possible Workflow. Create DID document with public key,hash with sha256, sign with the private key.
Send signed DID document and unsigned DID document to register with the service endpoint. Use the DID document
to get the public key to decrypt signed messages.

-----------------------------------------------------------------------------------------------------

Create a sha256 hash of this DID document. Sign the sha256 hash with the private key.
Compare the unsigned hash with the signed hash. (like you did with the message).
Figure out DLT later. I am not sure why BigChainDB isn't working.

References: https://www.youtube.com/watch?v=Uu651GJ5YY0
(Adventures in Self-Sovereign Identity: From...- June 28 | Identiverse 2019)

Can I advertise my DID with the device to look up my public key? Is that how it works?


Can I list my DID based on a P-256 key on a public ledger created with Ed25519 keys?

Perhaps it looks like this:

{
  "@context": "https://www.w3.org/ns/did/v1",
  "id": "did:example:F9C36F8964623378BDC068D4BCE07ED17C8FA486F9AC0C2613CA3C8C306D7BB6",
  "authentication": [{
    "id": "did:example:F9C36F8964623378BDC068D4BCE07ED17C8FA486F9AC0C2613CA3C8C306D7BB#keys-1",
    "type": "JsonWebKey2020",
    "controller": "did:example:F9C36F8964623378BDC068D4BCE07ED17C8FA486F9AC0C2613CA3C8C306D7BB6",
     "publicKeyJwk": {
        "kty": "EC",
        "crv": "P-256",
        "x": "F9C36F8964623378BDC068D4BCE07ED17C8FA486F9AC0C2613CA3C8C306D7BB6",
        "y": "1CD36717B8AC5E4FEA8AD23DC8D0783C2318EE4AD7A80DB6E0026AD0B072A24F"
    }
  }],
  "verificationMethod": [{
    "id": "did:example:F9C36F8964623378BDC068D4BCE07ED17C8FA486F9AC0C2613CA3C8C306D7BB6#keys-2",
    "type": "Ed25519VerificationKey2018",
    "controller": "did:example:F9C36F8964623378BDC068D4BCE07ED17C8FA486F9AC0C2613CA3C8C306D7BB6",
    "publicKeyBase58": "H3C2AVvLMv6gmMNam3uVAjZpfkcJCwDwnZn6z3wXmqPV"
  }],
  "service": [{
    
    "id":"did:example:F9C36F8964623378BDC068D4BCE07ED17C8FA486F9AC0C2613CA3C8C306D7BB#vcss",
    "type": "VerifiableCredentialService",
    "serviceEndpoint": "https://example.com/vc/"
  }]
}

Possible Workflow. Request Ed25519 key from another device, Put Ed25519 key in DID document along with P-256 key.
Sign the document with P-256 private key in program on edge device. Put the DID document on ledger with the Ed25519 key.

Friday, January 1, 2021

minimal did document from did core:::

expanding:

Example 2: Minimal self-managed DID document
(https://www.w3.org/TR/did-core/)


Start with: https://json-ld.org/playground/ :

{
  "@context": "https://www.w3.org/ns/did/v1",
  "id": "did:example:123456789abcdefghi",
  "authentication": [{
    


    "id": "did:example:123456789abcdefghi#keys-1",
    "type": "Ed25519VerificationKey2018",
    "controller": "did:example:123456789abcdefghi",
    "publicKeyBase58": "H3C2AVvLMv6gmMNam3uVAjZpfkcJCwDwnZn6z3wXmqPV"
  }],
  "service": [{
    


    "id":"did:example:123456789abcdefghi#vcs",
    "type": "VerifiableCredentialService",
    "serviceEndpoint": "https://example.com/vc/"
  }]
}

--------------

[
  {
    "https://w3id.org/security#authenticationMethod": [
      {
        "https://w3id.org/security#controller": [
          {
            "@id": "did:example:123456789abcdefghi"
          }
        ],
        "@id": "did:example:123456789abcdefghi#keys-1",
        "https://w3id.org/security#publicKeyBase58": [
          {
            "@value": "H3C2AVvLMv6gmMNam3uVAjZpfkcJCwDwnZn6z3wXmqPV"
          }
        ],
        "@type": [
          "https://w3id.org/security#Ed25519VerificationKey2018"
        ]
      }
    ],
    "@id": "did:example:123456789abcdefghi",
    "https://w3id.org/did#service": [
      {
        "@id": "did:example:123456789abcdefghi#vcs",
        "https://w3id.org/did#serviceEndpoint": [
          {
            "@id": "https://example.com/vc/"
          }
        ],
        "@type": [
          "https://json-ld.org/playground/VerifiableCredentialService"
        ]
      }
    ]
  }
]

------------------------------

https://www.easyrdf.org/converter

leads to::

-----------------------------------

@prefix ns0: <https://w3id.org/did#> .
@prefix ns1: <https://w3id.org/security#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

<did:example:123456789abcdefghi>
  ns0:service <did:example:123456789abcdefghi#vcs> ;
  ns1:authenticationMethod <did:example:123456789abcdefghi#keys-1> .

<did:example:123456789abcdefghi#vcs>
  a <https://json-ld.org/playground/VerifiableCredentialService> ;
  ns0:serviceEndpoint <https://example.com/vc/> .

<did:example:123456789abcdefghi#keys-1>
  a ns1:Ed25519VerificationKey2018 ;
  ns1:controller <did:example:123456789abcdefghi> ;
  ns1:publicKeyBase58 "H3C2AVvLMv6gmMNam3uVAjZpfkcJCwDwnZn6z3wXmqPV"^^xsd:string .