MapkitJS.Token (mapkit_js v0.3.0)

Copy Markdown View Source

MapKit JS token generation.

MapKit JS uses the JWT directly as its authorization token. Tokens are signed with an ES256 private key and may optionally include an origin claim.

Summary

Functions

Returns a JWT token (same as generate_jwt for direct use).

Generate a JWT and return it with the expiration timestamp.

Generate a fresh ES256 JWT for MapKit JS authorization.

Types

jwt()

@type jwt() :: String.t()

Functions

access_token(opts \\ [])

@spec access_token(keyword()) :: {:ok, String.t()} | {:error, term()}

Returns a JWT token (same as generate_jwt for direct use).

access_token_with_expiry(opts \\ [])

@spec access_token_with_expiry(keyword()) ::
  {:ok, String.t(), integer()} | {:error, term()}

Generate a JWT and return it with the expiration timestamp.

generate_jwt(opts \\ [])

@spec generate_jwt(keyword()) :: {:ok, jwt()} | {:error, term()}

Generate a fresh ES256 JWT for MapKit JS authorization.