This repository has been archived by the owner on Dec 12, 2024. It is now read-only.
generated from TBD54566975/tbd-project-template
-
Notifications
You must be signed in to change notification settings - Fork 55
Added did ion deactivation endpoint. #646
Open
andresuribe87
wants to merge
11
commits into
TBD54566975:main
Choose a base branch
from
andresuribe87:issue_340_deactivate
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
a733333
Added did ion deactivation endpoint.
andresuribe87 bc86a11
Feedback
andresuribe87 33d7e10
Merge branch 'main' into issue_340_deactivate
andresuribe87 7c68e3c
Create one DELETE for all.
andresuribe87 1557d1f
Remove deactivate
andresuribe87 78ccbd7
Merge remote-tracking branch 'refs/remotes/origin/issue_340_deactivat…
andresuribe87 badc1ff
Missed one bit
andresuribe87 da81f3d
Merge branch 'main' into issue_340_deactivate
decentralgabe 2c99916
Merge branch 'main' into issue_340_deactivate
andresuribe87 43f2006
Merge branch 'main' into issue_340_deactivate
andresuribe87 c64dffc
Merge branch 'main' into issue_340_deactivate
andresuribe87 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package did | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
"time" | ||
|
||
"github.com/TBD54566975/ssi-sdk/did/resolution" | ||
"github.com/sirupsen/logrus" | ||
) | ||
|
||
func resolve(ctx context.Context, id string, storage *Storage) (*resolution.Result, error) { | ||
gotDID, err := storage.GetDIDDefault(ctx, id) | ||
if err != nil { | ||
return nil, fmt.Errorf("error getting DID: %s", id) | ||
} | ||
if gotDID == nil { | ||
return nil, fmt.Errorf("did with id<%s> could not be found", id) | ||
} | ||
|
||
createdAt, err := time.Parse(time.RFC3339, gotDID.CreatedAt) | ||
if err != nil { | ||
logrus.WithError(err).Errorf("parsing created at") | ||
} | ||
updatedAt, err := time.Parse(time.RFC3339, gotDID.UpdatedAt) | ||
if err != nil { | ||
logrus.WithError(err).Errorf("parsing created at") | ||
} | ||
|
||
const XMLFormat = "2006-01-02T15:04:05Z" | ||
|
||
return &resolution.Result{ | ||
Context: "https://w3id.org/did-resolution/v1", | ||
Document: gotDID.DID, | ||
DocumentMetadata: &resolution.DocumentMetadata{ | ||
Created: createdAt.Format(XMLFormat), | ||
Updated: updatedAt.Format(XMLFormat), | ||
Deactivated: gotDID.SoftDeleted, | ||
}, | ||
}, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this can be more restful as a delete to
/v1/dids/{method}/{id}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We already have a that taken by
SoftDelete
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hm, I see. awkward because we both need to handle the service's concept of deletion and the did methods
I'm inclined to merge the two...
Something lke -- if the DID method supports deactivation, the
DELETE
to/v1/dids/{method}/{id}
does both delete and deactivation. If the DID method does not support deactivation, we just do a delete.Reason being, it's more confusing to support both separately. What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like that, will update.