Token
The type is designed to store the JWT and the user it is related to.
public struct Token: Decodable, Equatable, ExpressibleByStringLiteral
Inheritance
Decodable
, Equatable
, ExpressibleByStringLiteral
Initializers
init(stringLiteral:)
Created a new Token
instance.
public init(stringLiteral value: StringLiteralType)
Parameters
value
: The JWT string value. It must be in valid format and containuser_id
in payload.
init(rawValue:)
Creates a Token
instance from the provided rawValue
if it's valid.
public init(rawValue: String) throws
Parameters
rawValue
: The token string in JWT format.
Throws
ClientError.InvalidToken
will be thrown if token string is invalid.
init(from:)
public init(from decoder: Decoder) throws
Properties
rawValue
public let rawValue: String
userId
public let userId: UserId
expiration
public let expiration: Date?
isExpired
public var isExpired: Bool
anonymous
The token that can be used when user is unknown.
static var anonymous: Self
Is used by anonymous
token provider.
Methods
development(userId:)
The token which can be used during the development.
static func development(userId: UserId) -> Self
Is used by development(userId:)
token provider.