Git Product home page Git Product logo

Comments (9)

Dinglebarry9 avatar Dinglebarry9 commented on June 18, 2024 1

I have been trying to even get that far for a while now, but always get a bad request. I followed the example on https://didproject.azurewebsites.net/docs/overview.html but I think it is out of date. I have the ion node up and running but I am stuck with the create part. Maybe If you have some time we can collaborate on a create walkthrough PR.

from ion.

orbmis avatar orbmis commented on June 18, 2024

I did a bit more testing on this today, and it seems that older transactions have a different format to the anchorFile, that is, they contain an didUniqueSuffixes property:

{
    "batchFileHash": "EiAWU0PAu-anVbqXrGLoU3Gd26KPRx70YFd6wV-lnpfSuw",
    "merkleRoot": "CN8pvEAsD35vYxh2y-x4FXIvjoboGKpo401YxGbWvYE",
    "didUniqueSuffixes": [
      "EiBR8vuOtZrHqf_reS7GENZF_ertBlozTC-gXAHrTieNOA",
      "EiC7LUJu6IWvpp1_RGIsTMUXlMj21yhK9bWPKZ-r8S54MQ"
    ]
  }

That would answer my initial question, in as far as, it would explain how to resolve the DIDs relating to the operations in the batch file.

However...

The batch files for those older transactions, (any transaction with the "didUniqueSuffixes" property) seem to be missing. I'm just getting a 404 when trying to request them from the CAS endpoint.

Why are those batch files missing? Is it just down to anomalies of a the test network? Perhaps the batch files were not cached or pinned anywhere and the originals have gone?

Also, and more importantly, how can there be sidetree transactions with no didUniqueSuffixes - surely this is incorrect?

from ion.

Dinglebarry9 avatar Dinglebarry9 commented on June 18, 2024

By any chance are you able to create DID's?

from ion.

orbmis avatar orbmis commented on June 18, 2024

Yes I'm able to create a DID, although there is a bit of a delay when trying to resolve the newly created DID from the ION node.

REQUEST:

  {
    "payload": "eyJAY29udGV4dCI6Imh0dHBzOi8vdzNpZC5vcmcvZGlkL3YxIiwicHVibGljS2V5IjpbeyJpZCI6IiNrZXktMSIsInR5cGUiOiJTZWNwMjU2azFWZXJpZmljYXRpb25LZXkyMDE4IiwicHVibGljS2V5SndrIjp7Imt0eSI6IkVDIiwia2lkIjoiI2tleS0xIiwiY3J2IjoiUC0yNTZLIiwieCI6ImZUSFNv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XRpb24iOiJjcmVhdGUiLCJwcm9vZk9mV29yayI6Int9In0"
  }

RESPONSE:

  {
    "@context": "https://w3id.org/did/v1",
    "publicKey": [
      {
        "id": "#key-1",
        "type": "Secp256k1VerificationKey2018",
        "publicKeyJwk": {
          "kty": "EC",
          "kid": "#key-1",
          "crv": "P-256K",
          "x": "fTHSot2RsuYALxuE3dUa4TnAiUXmQgRVWjGrC5oiNZg",
          "y": "-7V5o9gtxkLLzGs7Xbpq09RZ-NkBXCZCI3a-LGmhhEs",
          "use": "verify",
          "defaultEncryptionAlgorithm": "none",
          "defaultSignAlgorithm": "ES256K"
        },
        "usage": "signing"
      },
      {
        "id": "#key-1",
        "type": "Secp256k1VerificationKey2018",
        "publicKeyJwk": {
          "kty": "EC",
          "kid": "#key-1",
          "crv": "P-256K",
          "x": "WoLVRpKS2o72JV4csC0aq5sTmnFbQW_ppeihOyvFMtU",
          "y": "xzj4kwBfFqJo_rBJgyN4AHaxz0X4Cb1moxYASNysqZY",
          "use": "verify",
          "defaultEncryptionAlgorithm": "none",
          "defaultSignAlgorithm": "ES256K"
        },
        "usage": "recovery"
      }
    ],
    "service": [
      {
        "id": "IdentityHub",
        "type": "IdentityHub",
        "serviceEndpoint": {
          "@context": "schema.identity.foundation/hub",
          "@type": "UserServiceEndpoint",
          "instance": ["did:test:hub.id"]
        }
      }
    ],
    "id": "did:ion:test:EiBe8EVPeO87uExfvBlqQgZkuyour3GKL_XmjeVPBho8uw"
  }

from ion.

Dinglebarry9 avatar Dinglebarry9 commented on June 18, 2024

This is the js I am using to make the JWT

async function makeJws() {

    // construct the JWS payload
    const body = {
        "@context": "https://w3id.org/did/v1",
        publicKey: [
            {
                id: jwkPub.kid,
                type: "Secp256k1VerificationKey2018",
                publicKeyJwk: jwkPub,
                "usage": "signing"
            },
            {
                id: jwkPubRecover.kid,
                type: "Secp256k1VerificationKey2018",
                publicKeyJwk: jwkPubRecover,
                "usage": "recovery"
            }
        ],
        service: [
            {
                id: "IdentityHub",
                type: "IdentityHub",
                serviceEndpoint: {
                    "@context": "schema.identity.foundation/hub",
                    "@type": "UserServiceEndpoint",
                    instance: [
                        "did:test:hub.id",
                    ]
                }
            }
        ],
    };

    // Construct the JWS header
    const header = {
        alg: jwkPub.defaultSignAlgorithm,
        kid: jwkPub.kid,
        //operation:'create',
        //proofOfWork:'{}'
    };

    // Sign the JWS
    const cryptoFactory = new didAuth.CryptoFactory([new didAuth.Secp256k1CryptoSuite()]);
    const jwsToken = new didAuth.JwsToken(body, cryptoFactory);
    const signedBody = await jwsToken.signAsFlattenedJson(privateKey, {header}.Protect);
    //const signedBody = await jwsToken.Protect.sign(privateKey, {header});

    // Print out the resulting JWS to the console in JSON format
    console.log(JSON.stringify(signedBody));

}

from ion.

fabianekc avatar fabianekc commented on June 18, 2024

I'm also struggling to create a DID using the information on the Sidetree Protocol Specification. So far I have documented my steps here: https://github.com/OwnYourData/did-ion
Would love to join a collaboration to create a walkthrough!

from ion.

Dinglebarry9 avatar Dinglebarry9 commented on June 18, 2024

@fabianekc, Yes totally I will pull your repo and add some stuff.

from ion.

orbmis avatar orbmis commented on June 18, 2024

Seeing as this issue was originally opened with regards to missing DIDs in the anchor files, I'm going to close it for now, and I will try to resolve the issue offline. I'm happy to help with the issue of creating a DID using ION, and to contribute to some documentation, but lets do it under @fabianekc 's project for now.

from ion.

Dinglebarry9 avatar Dinglebarry9 commented on June 18, 2024

@SimBro one question, what is "did:test:hub.id", do you host it yourself or is it somewhere else, I don't know where to start, all the decentralized-identity repos that concern identity hubs are depreciated.

from ion.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.