Welcome to our new developer portal! Use the "Ask" button to chat with our AI Agent.

iOSの初期化

Overview

D1Task is the main entry point to D1 SDK. It should be called as soon as the application is launched or at the earliest possible time. D1Task.Components is used to set a one-time configuration. The values can be retrieved from Thales delivery team.

Configure the D1 SDK

1

Create a D1Task instance

In SceneDelegate scene(:willConnectTo:options:), create a D1Task instance. Alternatively, in applications that do not use SceneDelegate, D1Task instance can be created in AppDelegate application(:didFinishLaunchingWithOptions:)

2

Configure the SDK

After setting up D1Task, issuer application can call the configure API to initialize the SDK. There are certain parameters that are required to be provided by the issuer application, for example consumerID.

3

Use multi-issuer tokens

The issuer application can create multiple D1Tasks using multi-issuer tokens under the following conditions:

  • Each issuer token may include multiple consumerID as the SUB (subject) for the same issuer.

  • A single login can be performed by providing all the issuer tokens which may include multiple consumerID separated by spaces. Subsequently, additional operations can then be carried out across different D1Tasks.

Example

SceneDelegate.swift
var d1Task: D1Task!

let PUBLIC_KEY_EXPONENT: [UInt8] = [0x00, 0xa0] // Modulus bytes array
let PUBLIC_KEY_MODULUS: [UInt8] = [0x00, 0x00] // Exponent bytes array

var comp = D1Task.Components()
comp.d1ServiceURLString = ""
comp.issuerID = ""
comp.d1ServiceRSAExponent = Data(bytes: PUBLIC_KEY_EXPONENT, count: PUBLIC_KEY_EXPONENT.count)
comp.d1ServiceRSAModulus = Data(bytes: PUBLIC_KEY_MODULUS, count: PUBLIC_KEY_MODULUS.count)
comp.digitalCardURLString = ""
d1Task = comp.task()

// Initialize required SDKs
// Issuer application is required to provide consumerID
let consumerID = "" // obtained e.g. from server
let coreConfig = ConfigParams.coreConfig(consumerID: consumerID)
// required for Card Processing & Wallet Pay
let cardConfig = ConfigParams.cardConfig()

d1Task.configure([coreConfig, cardConfig]) { (errors) in
    if let errors = errors {
        for error in errors {
            // Check error details to see whose config cause the errors, refer to D1 SDK Integration – Error Management section
        }
    }
}

最終更新

役に立ちましたか?