decentralized-identity / ion-sdk

TypeScript SDK for ION
Apache License 2.0
29 stars 14 forks source link

Clarifying Purpose of Ion SDK vs. decentralized-identity/sidetree reference implementation #9

Closed dleve123 closed 3 years ago

dleve123 commented 3 years ago

Hello!

I'm working on a small service that resolves ION DIDs according to the sidetree spec to support a Verifiable Credentials implementation. I'm trying to avoid re-writing as much TS code as possible considering it seems like there's a lot of support out there with this (1) codebase and (2) the reference implementation at decentralized-identity/sidetree.

Is (2) a reference implementation for just a sidetree node and this codebase a reference implementation for a service that is interfacing with the ION system (i.e. a verifiable credential wallet application using ION for identity)? Generally, is there guidance/documentation on how a ION client developer like myself should approach such a task?

To be super concrete, here's a preliminary description of behavior I'm trying to implement:

import { resolveDid } from "./resolver"
import OperationGenerator from "@decentralized-identity/sidetree/dist/tests/generators/OperationGenerator"

describe("DID Resolution", () => {
  describe("when the DID is poorly constructed", () => {
    it("returns an error", () => {})
  })

  describe("when the DID is long-form", () => {
    describe("when the did is not found on the blockchain", () => {
      it("returns a DID document from the long-form DID", async () => {
        const didString = await OperationGenerator.generateLongFormDid()
        const resolvedDid = resolveDid(didString.longFormDid)

        expect(resolvedDid).toEqual("foo")
      })
    })
  })
  describe("when the DID is short-form", () => {
    it("returns the DID document if it is found on the blockchain", () => {})
    it("returns a not found response", () => {})
  })
})

Thank you so much for the assistance!

cc/ @thehenrytsai @isaacJChen

thehenrytsai commented 3 years ago

Sorry for the late response, only noticed this question now.

You are right in that the sidetree repo contains reference code that anyone can use to spin up their own instance of an sidetree network, ION being one of them. This sdk is written to interface with ION, while in reality it most likely can interface with any sidetree compliant network, the SDK will not be concerned with other networks if incompatibility arises.

The current ION SDK is still limited in functionality (e.g. it only supports create ops now), but going forward, one should use this SDK for interfacing with ION over the OperationGenerator class found in sidetree reference implimentation as that class is purely intended for testing purposes.

dleve123 commented 3 years ago

Gotcha - thanks for the clarification. Closing for now.