Skip to content

Commit

Permalink
New error codes for credential status check
Browse files Browse the repository at this point in the history
  • Loading branch information
olomix committed Oct 9, 2024
1 parent 705ef17 commit 7b3602c
Show file tree
Hide file tree
Showing 7 changed files with 416 additions and 113 deletions.
13 changes: 10 additions & 3 deletions caching_rev_status_resolver.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@ import (
"github.com/iden3/iden3comm/v2/resolvers"
)

type CredentialStatusOwner uint8

const (
CredentialStatusOwnerUnset CredentialStatusOwner = iota
CredentialStatusOwnerIssuer CredentialStatusOwner = iota
CredentialStatusOwnerUser CredentialStatusOwner = iota
)

var revStatusCacheMutex sync.RWMutex

const issuerStateTTL = 5 * time.Minute
Expand Down Expand Up @@ -99,15 +107,14 @@ func resolveRevStatus(ctx context.Context, chainCfg PerChainConfig,

if regBuilder == nil {
return verifiable.RevocationStatus{},
errors.New("registry builder is null")
errors.New("[assertion] registry builder is null")
}

if userDID == nil {
return verifiable.RevocationStatus{}, errors.New("user DID is null")
}

resolversRegistry, registryCleanupFn, err := regBuilder(ctx,
chainCfg)
resolversRegistry, registryCleanupFn, err := regBuilder(ctx, chainCfg)
if err != nil {
return verifiable.RevocationStatus{}, err
}
Expand Down
2 changes: 1 addition & 1 deletion caching_rev_status_resolver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ func TestCachedResolve(t *testing.T) {

_, err = cachedResolve(ctx, PerChainConfig{}, issuerDID, nil,
verifiable.CredentialStatus{}, nil)
require.EqualError(t, err, "registry builder is null")
require.EqualError(t, err, "[assertion] registry builder is null")

credStatus := verifiable.CredentialStatus{
ID: "id1",
Expand Down
Loading

0 comments on commit 7b3602c

Please sign in to comment.