Skip to content

ScramService

Method LWM2M request Description
getHashIteration GET /1024//42
alias: /scram/hash-iteration
Get scram hash iteration counter
initialize GET /1024//47
alias: /scram/initialize
Start scram communication
login GET /1024//40
alias: /scram/login
First command to initiate scram login, for client to send login and nonce to IoTize, and IoTize to return user salt, user iteration counter (j) and combined nonce
loginProof GET /1024//41
alias: /scram/login-proof
Scram login proof
putHashIteration PUT /1024//42
alias: /scram/hash-iteration
Set scram hash iteration counter
send GET /1024//48
alias: /scram/com-send-receive
Communication channel
sendWithIV GET /1024//44
alias: /scram/send-with-iv
Communication channel with encryption initialization vectory
setInitializationVector GET /1024//45
alias: /scram/initialization-vector
Give encryption initialization vector to the device. The device returns its own initialization vector

getHashIteration

Minimal Tap Firmware version: >= 1.11

Get scram hash iteration counter

Scram conf iteration counter (i) to be read by client before starting scram login process

Example

let myService = new ScramService();

try {
  let call = myService.getHashIteration();
  let value = (await call).body();
  console.log(`getHashIteration: ${value}`);
} catch (ex) {
  // No response from device / response error (ie: device is not connected or request timeout)
  console.error(ex);
}
import .ScramService;

ServiceFactory serviceFactory = ...;
ScramService myService = serviceFactory.create(ScramService.class);


try {
    Call<Integer> call = myService.getHashIteration();
    Response<Integer> response = call.execute();
    if (response.isSuccessful()){
        System.out.println(response.body());
    }
    else{
        System.out.println(DeviceResponseError.createErrorMessage(response));
    }
} catch (ApiException e) {
    System.err.println("Exception when calling ScramService#getHashIteration");
    e.printStackTrace();
}
import TapDeviceClient
let tap: TapDevice = // ...

let ApiResponse<Integer> = try tap.service.scram.getHashIteration();
print("Response:" + response.body())

Parameters

This endpoint does not need any parameter.

Return type

Integer

Authorization

No authorization required

initialize

Minimal Tap Firmware version: >= 1.11

Start scram communication

Demande d'une clé aléatoire et initiation d'une session CCOM cryptée utilisant ce RNG comme clé de cryptage. Accessible uniquement en NFC.

Example

let myService = new ScramService();

try {
  let call = myService.initialize();
  let value = (await call).body();
  console.log(`initialize: ${value}`);
} catch (ex) {
  // No response from device / response error (ie: device is not connected or request timeout)
  console.error(ex);
}
import .ScramService;

ServiceFactory serviceFactory = ...;
ScramService myService = serviceFactory.create(ScramService.class);


try {
    Call<Bytes> call = myService.initialize();
    Response<Bytes> response = call.execute();
    if (response.isSuccessful()){
        System.out.println(response.body());
    }
    else{
        System.out.println(DeviceResponseError.createErrorMessage(response));
    }
} catch (ApiException e) {
    System.err.println("Exception when calling ScramService#initialize");
    e.printStackTrace();
}
import TapDeviceClient
let tap: TapDevice = // ...

let ApiResponse<Bytes> = try tap.service.scram.initialize();
print("Response:" + response.body())

Parameters

This endpoint does not need any parameter.

Return type

Bytes

Authorization

No authorization required

login

Minimal Tap Firmware version: >= 1.0

First command to initiate scram login, for client to send login and nonce to IoTize, and IoTize to return user salt, user iteration counter (j) and combined nonce

First command to initiate scram login, for client to send login and nonce to IoTize, and IoTize to return user salt, user iteration counter (j) and combined nonce

Example

let myService = new ScramService();
let params = ; // ScramLoginParams |

try{
    let call = myService.login(params);
    let value = (await call).body();
    console.log(`login: ${value}`);
}
catch (ex){
    // No response from device / response error (ie: device is not connected or request timeout)
    console.error(ex);
}
import .ScramService;

ServiceFactory serviceFactory = ...;
ScramService myService = serviceFactory.create(ScramService.class);


ScramLoginParams params = ; // ScramLoginParams |
try {
    Call<ScramLoginResponseBody> call = myService.login(params);
    Response<ScramLoginResponseBody> response = call.execute();
    if (response.isSuccessful()){
        System.out.println(response.body());
    }
    else{
        System.out.println(DeviceResponseError.createErrorMessage(response));
    }
} catch (ApiException e) {
    System.err.println("Exception when calling ScramService#login");
    e.printStackTrace();
}
import TapDeviceClient
let tap: TapDevice = // ...

let ApiResponse<ScramLoginResponseBody> = try tap.service.scram.login(params);
print("Response:" + response.body())

Parameters

Name Type Description Notes
params ScramLoginParamsScramLoginParams [optional]

Return type

ScramLoginResponseBody

Authorization

No authorization required

loginProof

Minimal Tap Firmware version: >= 1.0

Scram login proof

Second command to finalize scram login, for client to send ClientProof and combined nonce

Example

let myService = new ScramService();
let params = BINARY_DATA_HERE; // Bytes |

try {
  let call = myService.loginProof(params);
  let value = (await call).body();
  console.log(`loginProof: ${value}`);
} catch (ex) {
  // No response from device / response error (ie: device is not connected or request timeout)
  console.error(ex);
}
import .ScramService;

ServiceFactory serviceFactory = ...;
ScramService myService = serviceFactory.create(ScramService.class);


Bytes params = BINARY_DATA_HERE; // Bytes |
try {
    Call<Bytes> call = myService.loginProof(params);
    Response<Bytes> response = call.execute();
    if (response.isSuccessful()){
        System.out.println(response.body());
    }
    else{
        System.out.println(DeviceResponseError.createErrorMessage(response));
    }
} catch (ApiException e) {
    System.err.println("Exception when calling ScramService#loginProof");
    e.printStackTrace();
}
import TapDeviceClient
let tap: TapDevice = // ...

let ApiResponse<Bytes> = try tap.service.scram.loginProof(params);
print("Response:" + response.body())

Parameters

Name Type Description Notes
params BytesBytes [optional]

Return type

Bytes

Authorization

No authorization required

putHashIteration

Minimal Tap Firmware version: >= 1.11

Set scram hash iteration counter

Example

let myService = new ScramService();
let data = 56; // Integer |

try {
  let call = myService.putHashIteration(data);
  let value = (await call).body();
  console.log(`putHashIteration: ${value}`);
} catch (ex) {
  // No response from device / response error (ie: device is not connected or request timeout)
  console.error(ex);
}
import .ScramService;

ServiceFactory serviceFactory = ...;
ScramService myService = serviceFactory.create(ScramService.class);


Integer data = 56; // Integer |
try {
    Call<Void> call = myService.putHashIteration(data);
    Response<Void> response = call.execute();
    if (response.isSuccessful()){
        System.out.println(response.body());
    }
    else{
        System.out.println(DeviceResponseError.createErrorMessage(response));
    }
} catch (ApiException e) {
    System.err.println("Exception when calling ScramService#putHashIteration");
    e.printStackTrace();
}
import TapDeviceClient
let tap: TapDevice = // ...

let ApiResponse<Any> = try tap.service.scram.putHashIteration(data);
print("Response:" + response.body())

Parameters

Name Type Description Notes
data Integer

Return type

null (empty response body)

Authorization

No authorization required

send

Minimal Tap Firmware version: >= 1.11

Communication channel

Encrypted communication ressource, for sending/receiving commands/responses after the SCRAM or CCOM session is established.

Example

let myService = new ScramService();
let data = BINARY_DATA_HERE; // Bytes |

try {
  let call = myService.send(data);
  let value = (await call).body();
  console.log(`send: ${value}`);
} catch (ex) {
  // No response from device / response error (ie: device is not connected or request timeout)
  console.error(ex);
}
import .ScramService;

ServiceFactory serviceFactory = ...;
ScramService myService = serviceFactory.create(ScramService.class);


Bytes data = BINARY_DATA_HERE; // Bytes |
try {
    Call<Bytes> call = myService.send(data);
    Response<Bytes> response = call.execute();
    if (response.isSuccessful()){
        System.out.println(response.body());
    }
    else{
        System.out.println(DeviceResponseError.createErrorMessage(response));
    }
} catch (ApiException e) {
    System.err.println("Exception when calling ScramService#send");
    e.printStackTrace();
}
import TapDeviceClient
let tap: TapDevice = // ...

let ApiResponse<Bytes> = try tap.service.scram.send(data);
print("Response:" + response.body())

Parameters

Name Type Description Notes
data BytesBytes

Return type

Bytes

Authorization

No authorization required

sendWithIV

Minimal Tap Firmware version: >= 1.85

Communication channel with encryption initialization vectory

Encrypted communication ressource with initialization vector, for sending/receiving commands/responses after the SCRAM or CCOM session is established.

Example

let myService = new ScramService();
let data = ; // EncryptedIVCommand |

try{
    let call = myService.sendWithIV(data);
    let value = (await call).body();
    console.log(`sendWithIV: ${value}`);
}
catch (ex){
    // No response from device / response error (ie: device is not connected or request timeout)
    console.error(ex);
}
import .ScramService;

ServiceFactory serviceFactory = ...;
ScramService myService = serviceFactory.create(ScramService.class);


EncryptedIVCommand data = ; // EncryptedIVCommand |
try {
    Call<EncryptedIVResponse> call = myService.sendWithIV(data);
    Response<EncryptedIVResponse> response = call.execute();
    if (response.isSuccessful()){
        System.out.println(response.body());
    }
    else{
        System.out.println(DeviceResponseError.createErrorMessage(response));
    }
} catch (ApiException e) {
    System.err.println("Exception when calling ScramService#sendWithIV");
    e.printStackTrace();
}
import TapDeviceClient
let tap: TapDevice = // ...

let ApiResponse<EncryptedIVResponse> = try tap.service.scram.sendWithIV(data);
print("Response:" + response.body())

Parameters

Name Type Description Notes
data EncryptedIVCommandEncryptedIVCommand

Return type

EncryptedIVResponse

Authorization

No authorization required

setInitializationVector

Minimal Tap Firmware version: >= 1.85

Give encryption initialization vector to the device. The device returns its own initialization vector

Example

let myService = new ScramService();
let data = BINARY_DATA_HERE; // Bytes | 16 bytes initialization vector

try {
  let call = myService.setInitializationVector(data);
  let value = (await call).body();
  console.log(`setInitializationVector: ${value}`);
} catch (ex) {
  // No response from device / response error (ie: device is not connected or request timeout)
  console.error(ex);
}
import .ScramService;

ServiceFactory serviceFactory = ...;
ScramService myService = serviceFactory.create(ScramService.class);


Bytes data = BINARY_DATA_HERE; // Bytes | 16 bytes initialization vector
try {
    Call<Bytes> call = myService.setInitializationVector(data);
    Response<Bytes> response = call.execute();
    if (response.isSuccessful()){
        System.out.println(response.body());
    }
    else{
        System.out.println(DeviceResponseError.createErrorMessage(response));
    }
} catch (ApiException e) {
    System.err.println("Exception when calling ScramService#setInitializationVector");
    e.printStackTrace();
}
import TapDeviceClient
let tap: TapDevice = // ...

let ApiResponse<Bytes> = try tap.service.scram.setInitializationVector(data);
print("Response:" + response.body())

Parameters

Name Type Description Notes
data BytesBytes 16 bytes initialization vector

Return type

Bytes

Authorization

No authorization required