JwtGenerator

@objc(VSSJwtGenerator)
open class JwtGenerator : NSObject

Class responsible for JWT generation

  • Api Private Key for signing generated tokens

    Note

    Can be taken here

    Declaration

    Swift

    @objc
    public let apiKey: VirgilPrivateKey
  • Public Key identifier of Api Key

    Declaration

    Swift

    @objc
    public private(set) var apiPublicKeyIdentifier: String { get }
  • Implementation of AccessTokenSigner for signing generated tokens

    Declaration

    Swift

    @objc
    public let crypto: VirgilCrypto
  • Application Id

    Note

    Can be taken here

    Declaration

    Swift

    @objc
    public let appId: String
  • ttl

    Lifetime of generated tokens

    Declaration

    Swift

    @objc
    public let ttl: TimeInterval
  • Default JWT ttl

    Declaration

    Swift

    @objc
    public static let defaultTtl: TimeInterval
  • Initializer

    Throws

    Rethrows from VirgilCrypto

    Declaration

    Swift

    @objc
    public init(apiKey: VirgilPrivateKey,
                apiPublicKeyIdentifier: String,
                crypto: VirgilCrypto,
                appId: String,
                ttl: TimeInterval = JwtGenerator.defaultTtl) throws

    Parameters

    apiKey

    Api Private Key for signing generated tokens

    apiPublicKeyIdentifier

    Public Key identifier of Api Key

    crypto

    VirgilCrypto

    appId

    Application Id

    ttl

    Lifetime of generated tokens

  • Generates new JWT

    Throws

    Rethrows from JwtHeaderContent, JwtBodyContent, Jwt, AccessTokenSigner

    Declaration

    Swift

    @objc
    public func generateToken(identity: String, additionalData: [String : String]? = nil) throws -> Jwt

    Parameters

    identity

    Identity to generate with

    additionalData

    Dictionary with additional data

    Return Value

    Generated and signed Jwt