Skip to content
Snippets Groups Projects
Commit 78c70337 authored by Yordan Kinkov's avatar Yordan Kinkov
Browse files

Update GetloginProofResult function according to changes in OCM client

parent 9d711eba
No related branches found
No related tags found
1 merge request!36Update GetloginProofResult function according to changes in OCM client
Pipeline #52910 passed with stages
in 1 minute and 56 seconds
......@@ -74,8 +74,15 @@ func (of *OcmFuncs) GetLoginProofResult() (*rego.Function, rego.Builtin1) {
return nil, err
}
claims := map[string]interface{}{}
for _, cred := range res.Data.Data {
for cName, cValue := range cred.Claims {
claims[cName] = cValue
}
}
var val ast.Value
val, err = ast.InterfaceToValue(res.Data.Claims)
val, err = ast.InterfaceToValue(claims)
if err != nil {
return nil, err
}
......
......@@ -70,12 +70,20 @@ func TestGetLoginProofResult(t *testing.T) {
expected := `{"family_name":"Doe","name":"John"}`
ocmResponse := `{
"statusCode": 200,
"message": "Proof presentation fetch successfully",
"data": {
"credentialSubject": {
"name":"John",
"family_name":"Doe"
}
"state": "done",
"data": [
{
"credentialSubject": {
"family_name":"Doe"
}
},
{
"credentialSubject": {
"name":"John"
}
}
]
}
}`
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment