Diplad (BeLawyer)
Sample code uses ES6 language features such as arrow functions and promises. For compatibility with IE11, code written with these features must be either transpiled using tools like Babel or refactored accordingly using callbacks.

Introduction

Each lawyer in Belgium registered at the balie is obliged since 1/1/2018 to have an electronic lawyer card. This is declared in atr. 193bis of the Codex Deontologie voor Advocaten:
“De advocaat moet voor zijn identificatie en voor de authenticatie beschikken over de elektronische CCBE-advocatenkaart.”

Interface

Module

1
export interface AbstractEidDiplad {
2
allData(filters: string[] | Options, callback?: (error: T1CLibException, data: TokenAllDataResponse) => void): Promise<TokenAllDataResponse>;
3
allCerts(parseCerts?: boolean, filters?: string[] | Options, callback?: (error: T1CLibException, data: TokenAllCertsResponse) => void): Promise<TokenAllCertsResponse>;
4
biometric(callback?: (error: T1CLibException, data: TokenBiometricDataResponse) => void): Promise<TokenBiometricDataResponse>;
5
tokenData(callback?: (error: T1CLibException, data: TokenDataResponse) => void): Promise<TokenDataResponse>;
6
address(callback?: (error: T1CLibException, data: TokenAddressResponse) => void): Promise<TokenAddressResponse>;
7
picture(callback?: (error: T1CLibException, data: TokenPictureResponse) => void): Promise<TokenPictureResponse>;
8
rootCertificate(parseCerts?: boolean, callback?: (error: T1CLibException, data: TokenCertificateResponse) => void): Promise<TokenCertificateResponse>;
9
intermediateCertificates(parseCerts?: boolean, callback?: (error: T1CLibException, data: TokenCertificateResponse) => void): Promise<TokenCertificateResponse>;
10
authenticationCertificate(parseCerts?: boolean, callback?: (error: T1CLibException, data: TokenCertificateResponse) => void): Promise<TokenCertificateResponse>;
11
nonRepudiationCertificate(parseCerts?: boolean, callback?: (error: T1CLibException, data: TokenCertificateResponse) => void): Promise<TokenCertificateResponse>;
12
encryptionCertificate(parseCerts?: boolean, callback?: (error: T1CLibException, data: TokenCertificateResponse) => void): Promise<TokenCertificateResponse>;
13
verifyPin(body: TokenVerifyPinData, callback?: (error: T1CLibException, data: TokenVerifyPinResponse) => void): Promise<TokenVerifyPinResponse>;
14
authenticate(body: TokenAuthenticateOrSignData, callback?: (error: T1CLibException, data: TokenAuthenticateResponse) => void): Promise<TokenAuthenticateResponse>;
15
sign(body: TokenAuthenticateOrSignData, bulk?: boolean, callback?: (error: T1CLibException, data: TokenSignResponse) => void): Promise<TokenSignResponse>;
16
allAlgoRefs(callback?: (error: T1CLibException, data: TokenAlgorithmReferencesResponse) => void): Promise<TokenAlgorithmReferencesResponse>
17
resetBulkPin(callback?: (error: T1CLibException, data: BoolDataResponse) => void): Promise<BoolDataResponse>;
18
}
Copied!

Models

All model information can be found in the Token typings model page

Examples

Initializing Diplad Module

1
T1cSdk.initialize(config).then(res => {
2
const diplad = res.client.createEidDiplad(readerId);
3
}, err => {
4
console.error(error)
5
});
Copied!

All Data

1
diplad.allData().then(res => {
2
}, err => {
3
console.log(err);
4
}
Copied!
Response will look like:
1
{
2
"data": {
3
"biometric": {
4
"cardNumber": "cardNumber",
5
"cardValidityDateEnd": "2021-01-08",
6
"chipNumber": "c57c0a3f-d034-46c9-831e-a208b2e44fb6",
7
"firstNames": "Tom",
8
"name": "Van Cammen",
9
"nationality": "BE",
10
"rawData": "BASE64_ENCODED_CARD_DATA",
11
"version": "1",
12
"issuer": ""
13
},
14
"picture": {
15
"picture": "BASE64_ENCODED_BYTE_ARRAY"
16
}
17
},
18
"success": true
19
}
Copied!

Biometric Data

1
diplad.biometric().then(res => {
2
}, err => {
3
console.log(err);
4
}
Copied!
Response will look like:
1
{
2
"data": {
3
"cardNumber": "cardNumber",
4
"cardValidityDateEnd": "2021-01-08",
5
"chipNumber": "c57c0a3f-d034-46c9-831e-a208b2e44fb6",
6
"firstNames": "Tom",
7
"name": "Van Cammen",
8
"nationality": "BE",
9
"rawData": "BASE64_ENCODED_CARD_DATA",
10
"version": "1",
11
"issuer": ""
12
},
13
"success": true
14
}
Copied!

Picture

1
diplad.picture().then(res => {
2
}, err => {
3
console.log(err);
4
}
Copied!
Response will look like:
1
{
2
"data": {
3
"picture": "BASE64_ENCODED_BYTE_ARRAY"
4
},
5
"success": true
6
}
Copied!

All Certificates

When additional parsing of the certificate is needed you can add a boolean to indicate if you want to parse the certificate or not.
1
const filter = ['rootCertificate', 'authenticationCertificate', 'nonRepudiationCertificate'];
2
diplad.allCerts(parseCertsBoolean, filter).then(res => {
3
}, err => {
4
console.log(err);
5
}
Copied!
The filter is optional
Response will look like:
1
{
2
success: true,
3
data: {
4
authenticationCertificate?: {
5
certificate?: string,
6
certificates?: Array<string>,
7
certificateType?: string,
8
id?: string,
9
parsedCertificate?: Certificate,
10
parsedCertificates?: Array<Certificate>
11
},
12
13
nonRepudiationCertificate?: {
14
certificate?: string,
15
certificates?: Array<string>,
16
certificateType?: string,
17
id?: string,
18
parsedCertificate?: Certificate,
19
parsedCertificates?: Array<Certificate>
20
},
21
rootCertificate?: {
22
certificate?: string,
23
certificates?: Array<string>,
24
certificateType?: string,
25
id?: string,
26
parsedCertificate?: Certificate,
27
parsedCertificates?: Array<Certificate>
28
},
29
}
30
}
Copied!

Root Certificate

When additional parsing of the certificate is needed you can add a boolean to indicate if you want to parse the certificate or not.
1
diplad.rootCertificate(parseCertsBoolean).then(res => {
2
}, err => {
3
console.log(err);
4
}
Copied!
Response will look like:
1
{
2
success: true,
3
data: {
4
certificate?: string,
5
certificates?: Array<string>,
6
certificateType?: string,
7
id?: string,
8
parsedCertificate?: Certificate,
9
parsedCertificates?: Array<Certificate>
10
}
11
}
Copied!

Authentication Certificate

When additional parsing of the certificate is needed you can add a boolean to indicate if you want to parse the certificate or not.
1
diplad.authenticationCertificate(parseCertsBoolean).then(res => {
2
}, err => {
3
console.log(err);
4
}
Copied!
Response will look like:
1
{
2
success: true,
3
data: {
4
certificate?: string,
5
certificates?: Array<string>,
6
certificateType?: string,
7
id?: string,
8
parsedCertificate?: Certificate,
9
parsedCertificates?: Array<Certificate>
10
}
11
}
Copied!

Non-Repudiation Certificate

When additional parsing of the certificate is needed you can add a boolean to indicate if you want to parse the certificate or not.
1
diplad.nonRepudiationCertificate(parseCertsBoolean).then(res => {
2
}, err => {
3
console.log(err);
4
}
Copied!
Response will look like:
1
{
2
success: true,
3
data: {
4
certificate?: string,
5
certificates?: Array<string>,
6
certificateType?: string,
7
id?: string,
8
parsedCertificate?: Certificate,
9
parsedCertificates?: Array<Certificate>
10
}
11
}
Copied!

Verify PIN

    If the card reader has a PIN pad, the PIN must always be entered via the card-reader PIN pad.
    If the card reader has no PIN pad:
      If the osDialog property is set to true, a OS dialog window will be displayed for the user the enter their PIN
      If the pin property is defined, that value is used
      If osDialog is set to false, and pin is undefined, an error will be returned
1
const data = {
2
pin: "1234", // optional
3
osDialog: true // optional
4
}
5
diplad.verifyPin(data).then(res => {
6
}, err => {
7
console.error(err)
8
})
Copied!
Response will look like:
1
{
2
"success": true,
3
"data": {
4
"verified": true
5
}
6
}
Copied!

Sign

To sign data, an algorithm must be specified in the algorithm property (see Supported Algorithms), and a Base64-encoded string representation of the digest bytes of the same algorithm in the data property.
Additionally, it is possible to bulk sign data without having to re-enter the PIN by adding an optional bulk parameter set to true to the request. Subsequent sign requests will not require the PIN to be re-entered until a request with bulk being set to false is sent, or the Bulk PIN Reset method is called.
When using bulk signing, great care must be taken to validate that the first signature request was successful prior to sending subsequent requests. Failing to do this will likely result in the card being blocked.
The PIN can provided/entered in the same way as Verify PIN
1
const data = {
2
algorithm: "sha256",
3
data: "E1uHACbPvhLew0gGmBH83lvtKIAKxU2/RezfBOsT6Vs=",
4
pin: "1234"
5
}
6
const bulk = false;
7
diplad.sign(data, bulk).then(res => {
8
}, err => {
9
console.error(err)
10
})
Copied!
Response will look like:
1
{
2
"success": true,
3
"data": {
4
"data": "..."
5
}
6
}
Copied!

Authenticate

To sign data, an algorithm must be specified in the algorithm property (see Supported Algorithms), and a Base64-encoded string representation of the digest bytes of the same algorithm in the data property.
The PIN can provided/entered in the same way as Verify PIN
1
const data = {
2
algorithm: "sha256",
3
data: "E1uHACbPvhLew0gGmBH83lvtKIAKxU2/RezfBOsT6Vs=",
4
pin: "1234"
5
}
6
diplad.authenticate(data).then(res => {
7
}, err => {
8
console.error(err)
9
})
Copied!
Response will look like:
1
{
2
"success": true,
3
"data": {
4
"data": "..."
5
}
6
}
Copied!

Get Supported Algorithms

1
diplad.allAlgoRefs().then(res => {
2
}, err => {
3
console.error(err)
4
})
Copied!
Response will look like:
1
{
2
"success": true,
3
"data": {
4
"ref": ["sha1", "sha256", "sha512"]
5
}
6
}
Copied!

Bulk PIN Reset

The PIN set for bulk signing can be reset by calling this method.
1
diplad.resetBulkPin().then(res => {
2
}, err => {
3
console.error(err)
4
})
Copied!
Response will look like:
1
{
2
"success": true,
3
"data": true
4
}
Copied!
Last modified 1yr ago