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

Signing a request without sending #485

Open
samdeleu opened this issue Feb 18, 2022 · 2 comments
Open

Signing a request without sending #485

samdeleu opened this issue Feb 18, 2022 · 2 comments
Labels
enhancement 💡 New feature or request

Comments

@samdeleu
Copy link

Hi,
I am quite impressed with this library.
For a project i need to send a signed request to another server that will use this request to execute the signed request.
Is there a possibility to sign a request (new_request) only, without sending?

I saw there is a Signer, but it is not exported.

Thank you in advance

@davidkretch
Copy link
Member

Thanks! I would like to work on this but unfortunately don't have the time right now, sorry to say, but hopefully one of the items below may help.

A couple questions:

  1. Do you have an example of how to do this with another SDK, e.g. the Python AWS SDK?

  2. First idea: Could you send all the arguments to the other server and then have the other server call the function, e.g. store the function arguments in args and then on the other server, call do.call(my_aws_function, args)? Or does the other server not have the right credentials?

  3. Second idea: monkey patch send_request to return the signed request to you. See the example below. The internal implementation is unlikely to change any time soon so this is likely to work for the forseeable future. You'll have to monkey patch it again on the sending server to take the signed request and send it.

# Monkey patch paws to get the signed request.
# See https://dlukes.github.io/monkey-patching-in-r.html
paws.common <- getNamespace("paws.common")
unlockBinding("send_request", paws.common)
send_request <- with(paws.common, {
  function(request) {
    request <- sign(request)
    return(request)
  }
})
paws.common$send_request <- send_request
lockBinding("send_request", paws.common)

# Get the signed request.
s3 <- paws::s3()
signed_request <- s3$list_buckets()

@samdeleu
Copy link
Author

Ok, that will do for me. Thank you very much

@davidkretch davidkretch added the enhancement 💡 New feature or request label Feb 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement 💡 New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants