-
Notifications
You must be signed in to change notification settings - Fork 35
RPC Delete intent #563
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
RPC Delete intent #563
Conversation
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.
Let's add DeleteIntent
to the pkg/client-sdk/client
service interface and related grpc and rest impls
Let's also add the second way of deleting an intent: if the user forgot the intent id, they can provide a new bip322 proof spending any of the inputs spent by the registered intent to prove the ownership and the right to execute the operation. |
@altafan please review. |
if err != nil { | ||
return err | ||
} | ||
var idsToDelete []string |
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.
should be a map to prevent duplicates
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.
Done
if in.Txid == op.Hash.String() && in.VOut == op.Index { | ||
idsToDelete = append(idsToDelete, req.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.
the idea is to allow deleting only one intent at a time, not many. So, shall we break once we found the id to delete?
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.
not sure about this, as user can craft proof with vtxos belonging to diff intents, maybe delete all? @altafan
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.
yeah
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.
small change for the proto
@@ -119,6 +125,12 @@ message RegisterIntentResponse { | |||
string request_id = 1; | |||
} | |||
|
|||
message DeleteIntentRequest { | |||
string request_id = 1; |
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.
these should be oneOf. EIther you provide the intentid (which is a user secret) , or you provide an input (a single input is enough) in a bip322. The reasoning is that intent id is trivial and straightforward, but in the case of a wallet recovery where you only have a private key, the bip322 option works.
requestID := req.GetRequestId() | ||
bip322Signature := req.GetBip322Signature() | ||
|
||
if requestID != "" { |
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.
AH i see it's already in the code as I described. Just needs the proto to use the oneof style?
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.
Can we also please get a test added?
This adds DeleteIntent RPC.
This closes #557
@altafan please review.