Skip to content

Commit

Permalink
support W3C DID (#452)
Browse files Browse the repository at this point in the history
* Add support for readonly and on-chain identities. Initial work on parsing of DIDs with other DID methods

* Create new type w3c did  wich is a wrapper around github.com/build-trust/did compatible with old DID type

* Make Decompose method a separate function

* Removed CoreID method from DID and replace id with helper function CoreIDFromDID

* Remove NetworkID & Blockchain DID methods. Use Decompose method instead.

* Refactor working with method byte, remove some redundant ID methods.

* return error from IDFromDID if we know the DID method, but still can't parse ID

* Getting rid of unknown ID type

* Fix encoding ethereum address to/from genesis

* move W3C did to separate package

* remove dependency on onChainMethods dict

* make readonly networkID empty string

* remove unneeded public constant

* Rename did package to w3c. Rename did.Parse function to w3c.ParseDID. Rename IdGenesisFromIdenState func to NewIDFromIdenState. Rename DIDGenesisFromIdenState to NewDIDFromIdenState. Rename DIDFromGenesis to NewDID.

* add sepolia testnet (#453)

---------

Co-authored-by: Oleksandr Brezhniev <[email protected]>
  • Loading branch information
olomix and OBrezhniev authored Jul 27, 2023
1 parent 3a5bf00 commit 49ea9a4
Show file tree
Hide file tree
Showing 9 changed files with 2,142 additions and 280 deletions.
7 changes: 2 additions & 5 deletions claim_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import (

"github.com/iden3/go-iden3-crypto/poseidon"
"github.com/iden3/go-iden3-crypto/utils"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)

Expand Down Expand Up @@ -389,8 +388,7 @@ func TestNewSchemaHashFromHex(t *testing.T) {
exp, err := hex.DecodeString(hash)
require.NoError(t, err)

assert.Equal(t, exp[:], got[:])

require.Equal(t, exp[:], got[:])
}

func TestSchemaHash_BigInt(t *testing.T) {
Expand All @@ -402,8 +400,7 @@ func TestSchemaHash_BigInt(t *testing.T) {

got := schema.BigInt()

assert.Equal(t, exp, got)

require.Equal(t, exp, got)
}

func TestGetIDPosition(t *testing.T) {
Expand Down
Loading

0 comments on commit 49ea9a4

Please sign in to comment.