Skip to content

Commit

Permalink
feat: add Auth#revokeTokens specs
Browse files Browse the repository at this point in the history
  • Loading branch information
owenpearson committed Apr 28, 2023
1 parent 2c384c9 commit b903f90
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions textile/features.textile
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,13 @@ h3(#rest-auth). Auth
** @(RSA16b)@ If the library is provided with a token without the corresponding @TokenDetails@, then this holds a @TokenDetails@ instance in which only the @token@ attribute is populated with that token string
** @(RSA16c)@ Is set with the current token (if applicable) on instantiation and each time it is replaced, whether the result of an explicit @Auth#authorize@ operation, or a library-initiated renewal resulting from expiry or a token error response
** @(RSA16d)@ Is @null@ if there is no current token, including after a previous token has been determined to be invalid or expired, or if the library is using basic auth
* @(RSA17)@ @Auth#revokeTokens@ function:
** @(RSA17a)@ Takes a @TokenRevocationTarget@ or an array of @TokenRevocationTarget@s and sends them in a POST request to /keys/{API_KEY_NAME}/revokeTokens, with the newBatchResponse query param set to "true", where @API_KEY_NAME@ is the API key obtained from @AuthOptions#key@
** @(RSA17b)@ The @TokenRevocationTarget@s should be mapped to strings by joining the @type@ and @value@ with a ":" character and sent in the @targets@ field of the request body
** @(RSA17c)@ When called with a single @TokenRevocationTarget@, returns a @BatchResult<TokenRevocationResult>@, otherwise returns an array of @BatchResult<TokenRevocationResult>@s
** @(RSA17d)@ If called from a client using token authentication, should raise an @ErrorInfo@ with a @40162@ error code
** @(RSA17e)@ If an @issuedBefore@ timestamp is supplied, it should be included in the @issuedBefore@ field of the request body
** @(RSA17f)@ If an @allowReauthMargin@ boolean is supplied, it should be included in the @allowReauthMargin@ field of the request body

h3(#rest-channels). Channels

Expand Down Expand Up @@ -1532,6 +1539,22 @@ h4. BatchPresenceResult
** @(BGR2b)@ @presence@ @PresenceMessage[]@ - an optional array containing all members present on the channel if the request succeeded
** @(BGR2c)@ @error@ @ErrorInfo@ - an optional @ErrorInfo@ indicating the reason the presence request failed for the given channel, if unsuccessful

h4. TokenRevocationTarget

* @(TRT1)@ Contains information used to specify a token revocation target
* @(TRT2)@ The attributes of @TokenRevocationTarget@ consist of:
** @(TRT2a)@ @type@ string - either "clientId" or "revocationKey"
** @(TRT2b)@ @value@ string - the value of the token revocation target specifier

h4. TokenRevocationResult

* @(TRR1)@ Contains information about the result of a token revocation request for a single target
* @(TRR2)@ The attributes of @TokenRevocationTargetResult@ consist of:
** @(TRR2a)@ @target@ string - the target specifier
** @(TRR2b)@ @appliesAt@ number - an optional timestamp at which the token revocation will take effect, if successful
** @(TRR2c)@ @issuedBefore@ number - an optional timestamp for which tokens previously issued will be revoked, if successful
** @(TRR2d)@ @error@ @ErrorInfo@ - an optional @ErrorInfo@ indicating the reason the token revocation request failed for the given specified, if unsuccessful

h4. MessageFilter
* @(MFI1)@ Supplies filter options to subscribe as defined in #RTL22
* @(MFI2)@ Contains the following attributes:
Expand Down Expand Up @@ -1841,6 +1864,8 @@ class Auth: // RSA*
createTokenRequest(TokenParams?, AuthOptions?) => io TokenRequest // RSA9
requestToken(TokenParams?, AuthOptions?) => io TokenDetails // RSA8
tokenDetails: TokenDetails? // RSA16
revokeTokens(TokenRevocationTarget, issuedBefore number?, allowReauthMargin boolean?) => io BatchResult<TokenRevocationResult> // RSA17
revokeTokens(TokenRevocationTarget[], issuedBefore number?, allowReauthMargin boolean?) => io BatchResult<TokenRevocationResult>[] // RSA17

class TokenDetails: // TD*
+fromJson(String | JsonObject) -> TokenDetails // TD7
Expand Down Expand Up @@ -2386,6 +2411,16 @@ class BatchPresenceResult:
channel: string // BGR2a
presence?: [PresenceMessage] // BGR2b
error?: ErrorInfo // BGR2c

class TokenRevocationTarget:
type: string // TRT2a
value: string // TRT2b

class TokenRevocationResult:
target: string // TRR2a
appliesAt?: number // TRR2b
issuedBefore?: number // TRR2c
error?: ErrorInfo // TRR2d
</pre>

h2(#old-specs). Old specs
Expand Down

0 comments on commit b903f90

Please sign in to comment.