diff --git a/pkg/services/did.go b/pkg/services/did.go index 87c64d7..180a0cf 100644 --- a/pkg/services/did.go +++ b/pkg/services/did.go @@ -158,11 +158,16 @@ func (d *DidDocumentServices) GetDidDocument(ctx context.Context, did string, op stateType = GlobalStateType } - if opts.State != nil && identityState.StateInfo == nil { // this case is genesis state + if stateType == IdentityStateType && ((opts.State != nil && identityState.StateInfo == nil) || !isPublished) { // this case is genesis state // fill state info for genesis state to be able to prove it + + state := opts.State + if state == nil { + state = big.NewInt(0) + } identityState.StateInfo = &StateInfo{ ID: *userDID, - State: opts.State, + State: state, ReplacedByState: big.NewInt(0), CreatedAtTimestamp: big.NewInt(0), ReplacedAtTimestamp: big.NewInt(0), diff --git a/tests/e2e/http_nameservice.postman_collection.json b/tests/e2e/http_nameservice.postman_collection.json index db933d3..e058831 100644 --- a/tests/e2e/http_nameservice.postman_collection.json +++ b/tests/e2e/http_nameservice.postman_collection.json @@ -455,13 +455,13 @@ "});", "", "pm.test(\"Proof section is NOT empty\", function () {", - " pm.expect(pm.response.json().proof).to.not.eq(undefined);", + " pm.expect(pm.response.json().vc.proof).to.not.eq(undefined);", "});", "", - "if (pm.response.json().proof.length == 2 ||", + "if (pm.response.json().vc.proof.length == 2 ||", " pm.environment.get(\"retry_count\") > pm.globals.get(\"max_retry\")) { // Some condition to decide if retrying the request is needed", - " pm.expect(pm.response.json().proof[1]).not.eq(undefined);", - " pm.expect(pm.response.json().proof[1].issuerData.state.blockTimestamp).not.eq(undefined);", + " pm.expect(pm.response.json().vc.proof[1]).not.eq(undefined);", + " pm.expect(pm.response.json().vc.proof[1].issuerData.state.blockTimestamp).not.eq(undefined);", " ", " pm.environment.set(\"retry_count\", 1);", " pm.collectionVariables.set(\"age_claim_non_merklized_import\", pm.response.text());",