medibloc/vc-sdk

Bump aries-framework-go version `v0.1.6` to `v0.1.8`

Closed this issue · 0 comments

Background

Bump aries-framework-go version v0.1.6 to v0.1.8. You can refer to the change log in this link.

Implement

When applying the v0.1.8 and running the test code, it returns fail. Because the aries-framework-go used a JSON-LD Context API after v0.1.7. So we need to implement a DocumentLoader for credential as following code:

func NewFrameWork() (*FrameWork, error) {
	storeProvider := mem.NewProvider()
	contextStore, err := ldstore.NewContextStore(storeProvider)
	if err != nil {
		return nil, err
	}

	remoteProviderStore, err := ldstore.NewRemoteProviderStore(storeProvider)
	if err != nil {
		return nil, err
	}

	ctx, err := context.New(
		context.WithJSONLDContextStore(contextStore),
		context.WithJSONLDRemoteProviderStore(remoteProviderStore),
	)
	if err != nil {
		return nil, err
	}

	loader, err := ld.NewDocumentLoader(
		ctx,
		ld.WithRemoteDocumentLoader(jsonld.NewDefaultDocumentLoader(&http.Client{})),
	)
	if err != nil {
		return nil, err
	}

	return &FrameWork{
		loader: loader,
	}, nil
}

So, when the user wants to use SignCredential, VerifyPresentation or other method, the user should need to declare an variable with above code.