Skip to main content Link Search Menu Expand Document (external link)

HttpApiSecurity.ts overview

Since v1.0.0


Exports Grouped by Category


annotations

annotate

Signature

declare const annotate: {
  <I, S>(tag: Context.Tag<I, S>, value: S): <A extends HttpApiSecurity>(self: A) => A
  <A extends HttpApiSecurity, I, S>(self: A, tag: Context.Tag<I, S>, value: S): A
}

Source

Since v1.0.0

annotateContext

Signature

declare const annotateContext: {
  <I>(context: Context.Context<I>): <A extends HttpApiSecurity>(self: A) => A
  <A extends HttpApiSecurity, I>(self: A, context: Context.Context<I>): A
}

Source

Since v1.0.0

constructors

apiKey

Create an API key security scheme.

You can implement some api middleware for this security scheme using HttpApiBuilder.middlewareSecurity.

To set the correct cookie in a handler, you can use HttpApiBuilder.securitySetCookie.

The default value for in is “header”.

Signature

declare const apiKey: (options: {
  readonly key: string
  readonly in?: "header" | "query" | "cookie" | undefined
}) => ApiKey

Source

Since v1.0.0

basic

Signature

declare const basic: Basic

Source

Since v1.0.0

bearer

Create an Bearer token security scheme.

You can implement some api middleware for this security scheme using HttpApiBuilder.middlewareSecurity.

Signature

declare const bearer: Bearer

Source

Since v1.0.0

models

ApiKey (interface)

Signature

export interface ApiKey extends HttpApiSecurity.Proto<Redacted> {
  readonly _tag: "ApiKey"
  readonly in: "header" | "query" | "cookie"
  readonly key: string
}

Source

Since v1.0.0

Basic (interface)

Signature

export interface Basic extends HttpApiSecurity.Proto<Credentials> {
  readonly _tag: "Basic"
}

Source

Since v1.0.0

Bearer (interface)

Signature

export interface Bearer extends HttpApiSecurity.Proto<Redacted> {
  readonly _tag: "Bearer"
}

Source

Since v1.0.0

Credentials (interface)

Signature

export interface Credentials {
  readonly username: string
  readonly password: Redacted
}

Source

Since v1.0.0

HttpApiSecurity (type alias)

Signature

type HttpApiSecurity = Bearer | ApiKey | Basic

Source

Since v1.0.0

HttpApiSecurity (namespace)

Source

Since v1.0.0

Proto (interface)

Signature

export interface Proto<out A> extends Pipeable {
  readonly [TypeId]: {
    readonly _A: Covariant<A>
  }
  readonly annotations: Context.Context<never>
}

Source

Since v1.0.0

Type (type alias)

Signature

type Type<A> = A extends Proto<infer Out> ? Out : never

Source

Since v1.0.0

type ids

TypeId

Signature

declare const TypeId: unique symbol

Source

Since v1.0.0

TypeId (type alias)

Signature

type TypeId = typeof TypeId

Source

Since v1.0.0