didkit icon indicating copy to clipboard operation
didkit copied to clipboard

Add go package as a submodule

Open w4ll3 opened this issue 3 years ago • 3 comments

This adds a sub module to DIDKit didkit-go. The reason it is being added this way is to make it possible to be used as a module in a Go program. Once this is merged the instructions at didkit-go, which are simpler, will work.

Testing at DIDKit

  • Checkout to this branch
  • Init the submodule
git submodule update --init
  • Make sure to have the C target built
make -C extern/didkit/lib ../target/test/c.stamp
  • Run the tests
cd lib/didkit-go
go test

How to test it on a Go program

git init
  • Add DIDKit and SSI as submodules to your repo. (Since this is not merged yet you have to manually init the sub modules)
go get github.com/spruceid/didkit-go
git submodule add https://github.com/spruceid/didkit.git extern/didkit
git submodule add https://github.com/spruceid/ssi.git extern/ssi
cd extern/didkit
git checkout feature/go-package
git submodule update --init
cd ../ssi
git submodule update --init
cd ../..
  • Build DIDKit C target
make -C extern/didkit/lib ../target/test/c.stamp
  • Update the lib target
go mod edit -replace=github.com/spruceid/didkit-go=./extern/didkit/lib/didkit-go
  • Write some code to test the lib
package main

import (
        "fmt"

        "github.com/spruceid/didkit-go"
)

func main() {
        fmt.Println(didkit.GenerateEd25519Key())
}

Testing example application

  • Checkout to this branch
  • Init the submodule
git submodule update --init
  • Follow the instructions in the example README

w4ll3 avatar Sep 23 '21 19:09 w4ll3