Skip to content
This repository has been archived by the owner on Apr 5, 2023. It is now read-only.

Commit

Permalink
feat: WACI issuance integration with DIDComm v2
Browse files Browse the repository at this point in the history
Signed-off-by: Filip Burlacu <[email protected]>
  • Loading branch information
Filip Burlacu committed Feb 2, 2022
1 parent fb839b3 commit de5972c
Show file tree
Hide file tree
Showing 17 changed files with 258 additions and 164 deletions.
2 changes: 1 addition & 1 deletion cmd/adapter-rest/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ require (
github.com/cenkalti/backoff v2.2.1+incompatible
github.com/google/uuid v1.3.0
github.com/gorilla/mux v1.8.0
github.com/hyperledger/aries-framework-go v0.1.8-0.20220119221523-d82510cb10e8
github.com/hyperledger/aries-framework-go v0.1.8-0.20220201232540-7beafac2076e
github.com/hyperledger/aries-framework-go-ext/component/storage/mongodb v0.0.0-20211117223600-626fe1bae44d
github.com/hyperledger/aries-framework-go-ext/component/storage/mysql v0.0.0-20210909220549-ce3a2ee13e22
github.com/hyperledger/aries-framework-go/component/storageutil v0.0.0-20220106195936-a9d6794663ed
Expand Down
4 changes: 2 additions & 2 deletions cmd/adapter-rest/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -814,8 +814,8 @@ github.com/hyperledger/aries-framework-go v0.1.7-0.20210816113201-26c0665ef2b9/g
github.com/hyperledger/aries-framework-go v0.1.7/go.mod h1:uve8/q23AUnq4EM0vBkEr1lKZRC67q5RcaHXh0ZOt0Y=
github.com/hyperledger/aries-framework-go v0.1.8-0.20211201185059-733a3370f501/go.mod h1:uve8/q23AUnq4EM0vBkEr1lKZRC67q5RcaHXh0ZOt0Y=
github.com/hyperledger/aries-framework-go v0.1.8-0.20211217135421-f68d5698237a/go.mod h1:rBMOJVwyHyYbOqbb3IB/ExBkHyvFLht/W81s24GmjcE=
github.com/hyperledger/aries-framework-go v0.1.8-0.20220119221523-d82510cb10e8 h1:FoH1H76vXjMykGED1hjBeMBTvqHBEhyhx6dKu0asMjk=
github.com/hyperledger/aries-framework-go v0.1.8-0.20220119221523-d82510cb10e8/go.mod h1:rBMOJVwyHyYbOqbb3IB/ExBkHyvFLht/W81s24GmjcE=
github.com/hyperledger/aries-framework-go v0.1.8-0.20220201232540-7beafac2076e h1:MB91IEWpu1p+xftEMw5xIw//Q4gugKHkI1QzTHvaCAY=
github.com/hyperledger/aries-framework-go v0.1.8-0.20220201232540-7beafac2076e/go.mod h1:rBMOJVwyHyYbOqbb3IB/ExBkHyvFLht/W81s24GmjcE=
github.com/hyperledger/aries-framework-go-ext/component/storage/couchdb v0.0.0-20210909220549-ce3a2ee13e22/go.mod h1:FtlFhPHMyLORgrPpvWSmEQSNhLiwAQ4V6rqNPfuDj0o=
github.com/hyperledger/aries-framework-go-ext/component/storage/mongodb v0.0.0-20210909220549-ce3a2ee13e22/go.mod h1:aiO9mXZBykIEwmgp9sSdpMuTw0P7b+ZFUltcIB9ZccY=
github.com/hyperledger/aries-framework-go-ext/component/storage/mongodb v0.0.0-20211117223600-626fe1bae44d h1:h91rxhZkAjxcIwY08RxUTE+B8WxfiWbRHNl5X98+ziA=
Expand Down
2 changes: 1 addition & 1 deletion cmd/adapter-rest/startcmd/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -1177,7 +1177,7 @@ func readCMOutputDescriptorFile(outputDescriptorsFile string) (cmOutputDescripto
}

for _, outputDescriptorsValues := range cmOutputDescriptors {
err = cm.Validate(outputDescriptorsValues)
err = cm.ValidateOutputDescriptors(outputDescriptorsValues)
if err != nil {
return nil, fmt.Errorf("aries-framework - failed to validate output descriptors: %w", err)
}
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ require (
github.com/coreos/go-oidc v2.2.1+incompatible
github.com/google/uuid v1.3.0
github.com/gorilla/mux v1.8.0
github.com/hyperledger/aries-framework-go v0.1.8-0.20220119221523-d82510cb10e8
github.com/hyperledger/aries-framework-go v0.1.8-0.20220201232540-7beafac2076e
github.com/hyperledger/aries-framework-go-ext/component/vdr/orb v0.1.4-0.20211219215001-23cd75276fdc
github.com/hyperledger/aries-framework-go/component/storageutil v0.0.0-20220106195936-a9d6794663ed
github.com/hyperledger/aries-framework-go/spi v0.0.0-20220106195936-a9d6794663ed
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -809,8 +809,8 @@ github.com/hyperledger/aries-framework-go v0.1.7-0.20210816113201-26c0665ef2b9/g
github.com/hyperledger/aries-framework-go v0.1.7/go.mod h1:uve8/q23AUnq4EM0vBkEr1lKZRC67q5RcaHXh0ZOt0Y=
github.com/hyperledger/aries-framework-go v0.1.8-0.20211201185059-733a3370f501/go.mod h1:uve8/q23AUnq4EM0vBkEr1lKZRC67q5RcaHXh0ZOt0Y=
github.com/hyperledger/aries-framework-go v0.1.8-0.20211217135421-f68d5698237a/go.mod h1:rBMOJVwyHyYbOqbb3IB/ExBkHyvFLht/W81s24GmjcE=
github.com/hyperledger/aries-framework-go v0.1.8-0.20220119221523-d82510cb10e8 h1:FoH1H76vXjMykGED1hjBeMBTvqHBEhyhx6dKu0asMjk=
github.com/hyperledger/aries-framework-go v0.1.8-0.20220119221523-d82510cb10e8/go.mod h1:rBMOJVwyHyYbOqbb3IB/ExBkHyvFLht/W81s24GmjcE=
github.com/hyperledger/aries-framework-go v0.1.8-0.20220201232540-7beafac2076e h1:MB91IEWpu1p+xftEMw5xIw//Q4gugKHkI1QzTHvaCAY=
github.com/hyperledger/aries-framework-go v0.1.8-0.20220201232540-7beafac2076e/go.mod h1:rBMOJVwyHyYbOqbb3IB/ExBkHyvFLht/W81s24GmjcE=
github.com/hyperledger/aries-framework-go-ext/component/storage/couchdb v0.0.0-20210909220549-ce3a2ee13e22/go.mod h1:FtlFhPHMyLORgrPpvWSmEQSNhLiwAQ4V6rqNPfuDj0o=
github.com/hyperledger/aries-framework-go-ext/component/storage/mongodb v0.0.0-20210909220549-ce3a2ee13e22/go.mod h1:aiO9mXZBykIEwmgp9sSdpMuTw0P7b+ZFUltcIB9ZccY=
github.com/hyperledger/aries-framework-go-ext/component/storage/mongodb v0.0.0-20211117223600-626fe1bae44d h1:h91rxhZkAjxcIwY08RxUTE+B8WxfiWbRHNl5X98+ziA=
Expand Down
13 changes: 12 additions & 1 deletion pkg/did/trustbloc_did_creator.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ func (p *TrustblocDIDCreator) newKey() (crypto.PublicKey, error) {
func (p *TrustblocDIDCreator) templateV2() (*did.Doc, error) {
didDoc := did.Doc{}

auth, err := p.createVerification("#key-1", p.keyType, did.Authentication)
auth, err := p.createVerification( /*"#key-1"*/ "", p.keyType, did.Authentication)
if err != nil {
return nil, fmt.Errorf("creating did doc Authentication: %w", err)
}
Expand All @@ -167,6 +167,13 @@ func (p *TrustblocDIDCreator) templateV2() (*did.Doc, error) {

didDoc.KeyAgreement = append(didDoc.KeyAgreement, *kagr)

assrt, err := p.createVerification( /*"#key-3"*/ "", p.keyType, did.AssertionMethod)
if err != nil {
return nil, fmt.Errorf("creating did doc AssertionMethod: %w", err)
}

didDoc.AssertionMethod = append(didDoc.AssertionMethod, *assrt)

didDoc.Service = []did.Service{{
ID: uuid.NewString(),
ServiceEndpoint: p.didcommInboundURL,
Expand All @@ -192,6 +199,10 @@ func (p *TrustblocDIDCreator) createVerificationMethod(id string, kt kms.KeyType
return nil, fmt.Errorf("creating public key: %w", err)
}

if id == "" {
id = "#" + kid
}

var j *jwk.JWK

if kt == kms.ED25519Type {
Expand Down
2 changes: 2 additions & 0 deletions pkg/profile/issuer/profile.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ type ProfileData struct {
LinkedWalletURL string `json:"linkedWallet,omitempty"`
IssuerID string `json:"issuerID,omitempty"`
CMStyle cm.Styles `json:"styles,omitempty"`
PublicDID string `json:"publicDID,omitempty"`
IsDIDCommV2 bool `json:"isDIDCommV2,omitempty"`
}

// OIDCClientParams optional set of oidc client parameters that the issuer may set, for static client registration.
Expand Down
23 changes: 12 additions & 11 deletions pkg/restapi/issuer/operation/models.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ package operation
import (
"encoding/json"

"github.com/hyperledger/aries-framework-go/pkg/client/outofband"
"github.com/hyperledger/aries-framework-go/pkg/doc/cm"
"github.com/hyperledger/aries-framework-go/pkg/wallet"

adaptervc "github.com/trustbloc/edge-adapter/pkg/vc"
)
Expand All @@ -28,6 +28,7 @@ type ProfileDataRequest struct {
OIDCClientParams *OIDCClientParams `json:"oidcParams,omitempty"`
CredentialScopes []string `json:"credScopes,omitempty"`
LinkedWalletURL string `json:"linkedWallet,omitempty"`
IsDIDCommV2 bool `json:"isDIDCommV2,omitempty"`
// Issuer ID identifies who is the issuer of the credential manifests being issued.
IssuerID string `json:"issuerID,omitempty"`
// CMStyle represents an entity styles object as defined in credential manifest spec.
Expand All @@ -49,20 +50,20 @@ type WalletConnect struct {
// txnData contains session data.
type txnData struct {
// Todo #580 rename IssuerID to ProfileID
IssuerID string `json:"issuerID,omitempty"`
State string `json:"state,omitempty"`
DIDCommInvitation *outofband.Invitation `json:"didCommInvitation,omitempty"`
Token string `json:"token,omitempty"`
CredScope string `json:"cred,omitempty"`
IssuerID string `json:"issuerID,omitempty"`
State string `json:"state,omitempty"`
DIDCommInvitation *wallet.GenericInvitation `json:"didCommInvitation,omitempty"`
Token string `json:"token,omitempty"`
CredScope string `json:"cred,omitempty"`
}

// CredentialHandlerRequest wallet chapi request.
type CredentialHandlerRequest struct {
Query *CHAPIQuery `json:"query,omitempty"`
DIDCommInvitation *outofband.Invitation `json:"invitation,omitempty"`
Credentials []json.RawMessage `json:"credentials,omitempty"`
WACI bool `json:"waci,omitempty"`
WalletRedirect string `json:"walletRedirect,omitempty"`
Query *CHAPIQuery `json:"query,omitempty"`
DIDCommInvitation *wallet.GenericInvitation `json:"invitation,omitempty"`
Credentials []json.RawMessage `json:"credentials,omitempty"`
WACI bool `json:"waci,omitempty"`
WalletRedirect string `json:"walletRedirect,omitempty"`
}

// CHAPIQuery chapi query type data.
Expand Down
Loading

0 comments on commit de5972c

Please sign in to comment.