HttpApiSecurity overview
Added in v1.0.0
Table of contents
annotations
annotate
Signature
export 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
}
Added in v1.0.0
annotateMerge
Signature
export declare const annotateMerge: {
<I>(context: Context.Context<I>): <A extends HttpApiSecurity>(self: A) => A
<A extends HttpApiSecurity, I>(self: A, context: Context.Context<I>): A
}
Added in 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
.
Signature
export declare const apiKey: (options: {
readonly key: string
readonly in?: "header" | "query" | "cookie" | undefined
}) => ApiKey
Added in v1.0.0
authorization
Signature
export declare const authorization: (scheme: string) => Authorization
Added in v1.0.0
basic
Signature
export declare const basic: Basic
Added in v1.0.0
bearer
Create an Bearer token security scheme.
You can implement some api middleware for this security scheme using HttpApiBuilder.middlewareSecurity
.
Signature
export declare const bearer: Authorization
Added in v1.0.0
models
And (interface)
Signature
export interface And<A extends HttpApiSecurity, B extends HttpApiSecurity>
extends HttpApiSecurity.Proto<readonly [HttpApiSecurity.Type<A>, HttpApiSecurity.Type<B>]> {
readonly _tag: "And"
readonly first: A
readonly second: A
}
Added in v1.0.0
ApiKey (interface)
Signature
export interface ApiKey extends HttpApiSecurity.Proto<Redacted> {
readonly _tag: "ApiKey"
readonly in: "header" | "query" | "cookie"
readonly key: string
}
Added in v1.0.0
Authorization (interface)
Signature
export interface Authorization extends HttpApiSecurity.Proto<Redacted> {
readonly _tag: "Authorization"
readonly scheme: string
}
Added in v1.0.0
Basic (interface)
Signature
export interface Basic extends HttpApiSecurity.Proto<Credentials> {
readonly _tag: "Basic"
}
Added in v1.0.0
Credentials (interface)
Signature
export interface Credentials {
readonly username: string
readonly password: Redacted
}
Added in v1.0.0
HttpApiSecurity (type alias)
Signature
export type HttpApiSecurity =
| HttpApiSecurity.Base
| Optional<HttpApiSecurity>
| Or<HttpApiSecurity, HttpApiSecurity>
| And<HttpApiSecurity, HttpApiSecurity>
Added in v1.0.0
HttpApiSecurity (namespace)
Added in v1.0.0
Proto (interface)
Signature
export interface Proto<out A> extends Pipeable {
readonly [TypeId]: {
readonly _A: Covariant<A>
}
readonly annotations: Context.Context<never>
}
Added in v1.0.0
Base (type alias)
Signature
export type Base = Authorization | ApiKey | Basic
Added in v1.0.0
Type (type alias)
Signature
export type Type<A extends HttpApiSecurity> = A extends Proto<infer Out> ? Out : never
Added in v1.0.0
Optional (interface)
Signature
export interface Optional<A extends HttpApiSecurity>
extends HttpApiSecurity.Proto<Option.Option<HttpApiSecurity.Type<A>>> {
readonly _tag: "Optional"
readonly security: A
}
Added in v1.0.0
Or (interface)
Signature
export interface Or<A extends HttpApiSecurity, B extends HttpApiSecurity>
extends HttpApiSecurity.Proto<HttpApiSecurity.Type<A> | HttpApiSecurity.Type<B>> {
readonly _tag: "Or"
readonly first: A
readonly second: B
}
Added in v1.0.0
type ids
TypeId
Signature
export declare const TypeId: typeof TypeId
Added in v1.0.0
TypeId (type alias)
Signature
export type TypeId = typeof TypeId
Added in v1.0.0
utils
SecurityDecodeError (class)
Signature
export declare class SecurityDecodeError
Added in v1.0.0
and
Signature
export declare const and: {
<B extends HttpApiSecurity>(second: B): <A extends HttpApiSecurity>(first: A) => Or<A, B>
<A extends HttpApiSecurity, B extends HttpApiSecurity>(first: A, second: B): Or<A, B>
}
Added in v1.0.0
optional
Signature
export declare const optional: <A extends HttpApiSecurity>(security: A) => Optional<A>
Added in v1.0.0
or
Signature
export declare const or: {
<B extends HttpApiSecurity>(second: B): <A extends HttpApiSecurity>(first: A) => Or<A, B>
<A extends HttpApiSecurity, B extends HttpApiSecurity>(first: A, second: B): Or<A, B>
}
Added in v1.0.0