Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New error codes for credential status check #83

Merged
merged 1 commit into from
Oct 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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