Skip to content

Commit

Permalink
feat: vc wallet EDV storage
Browse files Browse the repository at this point in the history
- if wallet user provides EDV settings during profile creationfor
storage then wallet will create internal EDV client instance for storing
wallet contents
- for now, encryption and MAC key IDs has to be provided by client user
during profile creation/update
- closes hyperledger-archives#2757

Signed-off-by: sudesh.shetty <sudesh.shetty@securekey.com>
  • Loading branch information
sudeshrshetty committed Apr 27, 2021
1 parent 9321eeb commit a105f6c
Show file tree
Hide file tree
Showing 12 changed files with 726 additions and 180 deletions.
24 changes: 12 additions & 12 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,20 @@ require (
github.com/PaesslerAG/jsonpath v0.1.1
github.com/VictoriaMetrics/fastcache v1.5.7
github.com/bluele/gcache v0.0.0-20190518031135-bc40bd653833
github.com/btcsuite/btcd v0.20.1-beta
github.com/btcsuite/btcutil v1.0.1
github.com/btcsuite/btcd v0.21.0-beta
github.com/btcsuite/btcutil v1.0.2
github.com/cenkalti/backoff/v4 v4.0.2
github.com/golang/mock v1.4.4
github.com/golang/protobuf v1.4.2
github.com/golang/protobuf v1.5.2
github.com/google/tink/go v1.5.0
github.com/google/uuid v1.1.2
github.com/gorilla/mux v1.7.3
github.com/hyperledger/aries-framework-go/component/storageutil v0.0.0-20210422133815-2ef2d99cb692
github.com/hyperledger/aries-framework-go/spi v0.0.0-20210422133815-2ef2d99cb692
github.com/hyperledger/aries-framework-go/component/storage/edv v0.0.0-20210426170825-9321eebd7637
github.com/hyperledger/aries-framework-go/component/storageutil v0.0.0-20210426170825-9321eebd7637
github.com/hyperledger/aries-framework-go/spi v0.0.0-20210426170825-9321eebd7637
github.com/jinzhu/copier v0.0.0-20190924061706-b57f9002281a
github.com/kawamuray/jsonpath v0.0.0-20201211160320-7483bafabd7e
github.com/kilic/bls12-381 v0.0.0-20201104083100-a288617c07f1
github.com/minio/sha256-simd v0.1.1 // indirect
github.com/kilic/bls12-381 v0.1.0
github.com/mitchellh/mapstructure v1.1.2
github.com/multiformats/go-multibase v0.0.1
github.com/multiformats/go-multihash v0.0.13
Expand All @@ -31,14 +31,14 @@ require (
github.com/rs/cors v1.7.0
github.com/square/go-jose/v3 v3.0.0-20200630053402-0a67ce9b0693
github.com/stretchr/testify v1.7.0
github.com/teserakt-io/golang-ed25519 v0.0.0-20200315192543-8255be791ce4
github.com/teserakt-io/golang-ed25519 v0.0.0-20210104091850-3888c087a4c8
github.com/tidwall/gjson v1.6.7
github.com/tidwall/sjson v1.1.4
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect
github.com/xeipuuv/gojsonschema v1.2.0
golang.org/x/crypto v0.0.0-20201002170205-7f63de1d35b0
golang.org/x/sys v0.0.0-20201211090839-8ad439b19e0f // indirect
google.golang.org/protobuf v1.25.0
golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b
golang.org/x/sys v0.0.0-20210426230700-d19ff857e887 // indirect
google.golang.org/protobuf v1.26.0
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
nhooyr.io/websocket v1.8.3
)

Expand Down
54 changes: 54 additions & 0 deletions go.sum

Large diffs are not rendered by default.

23 changes: 9 additions & 14 deletions pkg/wallet/contents.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,29 +100,24 @@ var (

// contentStore is store for wallet contents for given user profile.
type contentStore struct {
provider storage.Provider
storeID string
provider *storageProvider
open storeOpenHandle
close storeCloseHandle
lock sync.RWMutex
}

// newContentStore returns new wallet content store instance.
func newContentStore(p storage.Provider, pr *profile) (*contentStore, error) {
err := p.SetStoreConfig(pr.ID, storage.StoreConfiguration{TagNames: []string{
Collection.Name(), Credential.Name(), Connection.Name(), DIDResolutionResponse.Name(), Connection.Name(), Key.Name(),
}})
if err != nil {
return nil, fmt.Errorf("failed to set store config for user '%s' : %w", pr.User, err)
}

return &contentStore{open: storeLocked, close: noOp, provider: p, storeID: pr.ID}, nil
// will use underlying storage provider as content storage if profile doesn't have edv settings.
func newContentStore(p storage.Provider, pr *profile) *contentStore {
return &contentStore{open: storeLocked, close: noOp, provider: newWalletStorageProvider(pr, p)}
}

func (cs *contentStore) Open() error {
store, err := cs.provider.OpenStore(cs.storeID)
func (cs *contentStore) Open(auth string) error {
store, err := cs.provider.OpenStore(auth, storage.StoreConfiguration{TagNames: []string{
Collection.Name(), Credential.Name(), Connection.Name(), DIDResolutionResponse.Name(), Connection.Name(), Key.Name(),
}})
if err != nil {
return fmt.Errorf("failed to open store : %w", err)
return err
}

cs.lock.Lock()
Expand Down
Loading

0 comments on commit a105f6c

Please sign in to comment.