func (c *ConnectionStoreImpl) SaveDID(did string, keys ...string) error {
	for _, key := range keys {
		err := c.saveDID(did, key)
		if err != nil {
			return fmt.Errorf("saving DID in did map: %w", err)
		}
	}
	return nil
}
SaveDID saves a DID, indexed using the given public keys.
package did
import (
	"encoding/json"
	"errors"
	"fmt"
	"github.com/hyperledger/aries-framework-go/pkg/didcomm/common/service"
	diddoc "github.com/hyperledger/aries-framework-go/pkg/doc/did"
	"github.com/hyperledger/aries-framework-go/pkg/framework/aries/api/vdr"
	"github.com/hyperledger/aries-framework-go/spi/storage"
)
const StoreName = "didconnection"
var ErrNotFound = errors.New("did not found under given key")
type ConnectionStore interface {
	GetDID(key string) (string, error)
	SaveDID(did string, keys ...string) error
	SaveDIDFromDoc(doc *diddoc.Doc) error
	SaveDIDByResolving(did string, keys ...string) error
}
type ConnectionStoreImpl struct {
	store storage.Store
	vdr   vdr.Registry
}
type didRecord struct {
	DID string `json:"did,omitempty"`
}
type connectionProvider interface {
	StorageProvider() storage.Provider
	VDRegistry() vdr.Registry
}
func NewConnectionStore(ctx connectionProvider) (*ConnectionStoreImpl, error) {
	store, err := ctx.StorageProvider().OpenStore(StoreName)
	if err != nil {
		return nil, err
	}
	return &ConnectionStoreImpl{store: store, vdr: ctx.VDRegistry()}, nil
}
func (c *ConnectionStoreImpl) saveDID(did, key string) error {
	data := didRecord{
		DID: did,
	}
	bytes, err := json.Marshal(data)
	if err != nil {
		return err
	}
	return c.store.Put(key, bytes)
}