Skip to content

Commit

Permalink
defined typedDataTypes
Browse files Browse the repository at this point in the history
  • Loading branch information
daveroga committed Sep 2, 2024
1 parent 62a3dd9 commit f414b42
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions pkg/services/did.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ func (d *DidDocumentServices) GetDidDocument(ctx context.Context, did string, op
return didResolution, nil
}

func getTypedData(typeDataType TypedDataType, did w3c.DID, identityState IdentityState) (apitypes.TypedData, error) {
func getTypedData(typedDataType TypedDataType, did w3c.DID, identityState IdentityState) (apitypes.TypedData, error) {
id, err := core.IDFromDID(did)
if err != nil {
return apitypes.TypedData{},
Expand All @@ -195,9 +195,10 @@ func getTypedData(typeDataType TypedDataType, did w3c.DID, identityState Identit

var apiTypes apitypes.Types
var message apitypes.TypedDataMessage
primaryType := ""
var primaryType string

if typeDataType == IdentityStateType {
switch typedDataType {
case IdentityStateType:
primaryType = "IdentityState"
apiTypes = apitypes.Types{
"IdentityState": []apitypes.Type{
Expand All @@ -223,7 +224,7 @@ func getTypedData(typeDataType TypedDataType, did w3c.DID, identityState Identit
"replacedAtTimestamp": replacedAtTimestamp,
}

} else {
case GlobalStateType:
primaryType = "GlobalState"
apiTypes = apitypes.Types{
"GlobalState": []apitypes.Type{
Expand All @@ -248,6 +249,8 @@ func getTypedData(typeDataType TypedDataType, did w3c.DID, identityState Identit
"root": root,
"replacedAtTimestamp": replacedAtTimestamp,
}
default:
return apitypes.TypedData{}, fmt.Errorf("typedDataType %d not defined", typedDataType)
}

typedData := apitypes.TypedData{
Expand Down

0 comments on commit f414b42

Please sign in to comment.