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

Add an RBS signature for sigv4 #3152

Merged
Merged
Show file tree
Hide file tree
Changes from 9 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
2 changes: 2 additions & 0 deletions gems/aws-sigv4/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
Unreleased Changes
------------------

* Feature - Add RBS signature files to support static type checking

1.10.1 (2024-10-21)
------------------

Expand Down
13 changes: 13 additions & 0 deletions gems/aws-sigv4/sig/errors.rbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
module Aws
module Sigv4
module Errors
class MissingCredentialsError < ArgumentError
def initialize: (?String msg) -> void
end

class MissingRegionError < ArgumentError
def initialize: (*untyped) -> void
end
end
end
end
25 changes: 25 additions & 0 deletions gems/aws-sigv4/sig/request.rbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
module Aws
module Sigv4
class Request
def initialize: (
http_method: String,
alextwoods marked this conversation as resolved.
Show resolved Hide resolved
endpoint: String | untyped,
?headers: Hash[String, String],
?body: String | IO
) -> void
| (Hash[Symbol, untyped]) -> void

def http_method=: (String http_method) -> void
def http_method: () -> String

def endpoint: () -> (untyped)
def endpoint=: (String | untyped endpoint) -> void

def headers=: (Hash[String, String] headers) -> void
def headers: () -> Hash[String, String]

def body=: (String | IO body) -> void
def body: () -> (String | IO)
end
end
end
12 changes: 12 additions & 0 deletions gems/aws-sigv4/sig/signature.rbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module Aws
module Sigv4
class Signature
attr_accessor headers: Hash[String, String]
attr_accessor canonical_request: String
attr_accessor string_to_sign: String
attr_accessor content_sha256: String
attr_accessor signature: String
attr_accessor extra: Hash[untyped, untyped]
end
end
end
50 changes: 50 additions & 0 deletions gems/aws-sigv4/sig/signer.rbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
module Aws
module Sigv4
class Signer
def initialize: (
service: String,
region: String,
?access_key_id: String,
?secret_access_key: String,
?session_token: String,
?credentials: untyped,
?credentials_provider: untyped,
jterapin marked this conversation as resolved.
Show resolved Hide resolved
?unsigned_headers: Array[String],
?uri_escape_path: bool,
?apply_checksum_header: bool,
?signing_algorithm: :sigv4 | :sigv4a | :'sigv4-s3express',
?omit_session_token: bool,
?normalize_path: bool,
) -> void
jterapin marked this conversation as resolved.
Show resolved Hide resolved

attr_reader service: String
attr_reader region: String
attr_reader credentials_provider: untyped
attr_reader unsigned_headers: Array[String]
attr_reader apply_checksum_header: bool

def sign_request: (
http_method: String,
url: String | untyped,
?headers: Hash[String, String],
?body: String | IO,
) -> Signature

def sign_event: (
prior_signature: String,
payload: String,
encoder: untyped
) -> [Hash[String, untyped], String]

def presign_url: (
http_method: String,
url: String | untyped,
?headers: Hash[String, String],
?expires_in: Integer,
?body: String | IO,
?body_digest: String,
?time: Time,
) -> (untyped)
end
end
end
Loading