ValidateService

open class ValidateService

An implementation of a the validation API, used to check to validity of credentials and claims.

  • The error that’s returned when the response from the server is invalid.

    Declaration

    Swift

    public static let errMalformedResponse = "Received malformed response."
  • Static reference to the Trusted Key Demo validation API

    Declaration

    Swift

    public static var shared = ValidateService(backendUrl: TRUSTEDKEY_VALIDATE_API_URL)
  • The URL of the backend REST APIs.

    Declaration

    Swift

    public let backendUrl : String
  • Initialize the validate API with the given backend URL.

    Declaration

    Swift

    public init(backendUrl : String)

    Parameters

    backendUrl

    The URL of the backend REST APIs.

  • Validate given claim(s) by calling into the smart contract.

    Declaration

    Swift

    open func validateClaims(claims: [Claim], onSuccess: @escaping (Bool) -> Void, onError: @escaping (String) -> Void)

    Parameters

    serialNumbers

    Array of claim serial numbers.

    onSuccess

    Success callback, invoked on the main thread.

    onError

    Failure callback, invoked on the main thread with the error message.

  • Validate the given credential by calling into the smart contract.

    Declaration

    Swift

    open func validateCredential(credential: Credential, onSuccess: @escaping (Bool) -> Void, onError: @escaping (String) -> Void)

    Parameters

    credential

    Credential to check.

    onSuccess

    Success callback, invoked on the main thread.

    onError

    Failure callback, invoked on the main thread with the error message.

  • The key information structure

    See more

    Declaration

    Swift

    public struct KeyInfo
  • Get all blockchain information for the specified keys.

    Declaration

    Swift

    open func keyInfo(addresses: [String], onSuccess: @escaping ([String:KeyInfo]) -> Void, onError: @escaping (String) -> Void)

    Parameters

    addresses

    Array of claim or credential blockchain addresses.

    onSuccess

    Success callback receiving map of KeyInfo, invoked on the main thread.

    onError

    Failure callback, invoked on the main thread with the error message.