Skip to content

Refactor Auth API #102

@ghost

Description

We need to refactor the auth API so as to:

  1. Provide a simple, synchronous API
  2. Avoid using closures/callbacks for simple computations
  3. Avoid depending on any HTTP framework (remove any reference to http.request, keep only required bits of data)
  4. Provide an 'AwsServiceName' to the signing requests, as this may be included depending on the service.

The planned API is as follows:

auth: {
    client: {
        generateV4Headers: function (query, method, uri, payload, secretKey) -> { headersDict, errorObject },
    },
    server: {
        prepareV2: function (QueryString, Headers) -> { authParamsObject, errorObject },
        prepareV4: function (QueryString, Headers) -> { authParamsObject, errorObject },
        checkV2Signature: function(authParamsObject, secretKeyValue) -> bool,
        checkV4Signature: function(authParamsObject, secretKeyValue) -> bool,
    },
}

This is the general feeling. The Client would use the client API, and the server could use the server API in two steps:

  1. prepare auth params for actual auth
  2. retrieve auth information from whatever storage is used
  3. compute and check signature using results from step 1+2

Admitedly, the current API is missing a potential options object, or at least an AWSServiceName to use.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions