NRFUTIL constructor

NRFUTIL({
  1. NRFUtilMode mode = NRFUtilMode.release,
  2. int hardwareVersion = 0xFFFFFFFF,
  3. int applicationVersion = 0xFFFFFFFF,
  4. int bootloaderVersion = 0xFFFFFFFF,
  5. SoftDeviceTypes softDeviceReqType = SoftDeviceTypes.s132NRF52d611,
  6. List<ValidationType> bootValidationTypeArray = const [ValidationType.validateSHA256],
  7. Signing? signer,
  8. String? applicationFirmware,
  9. String? bootloaderFirmware,
  10. String? softDeviceFirmware,
  11. String? keyFile,
  12. String? comment,
})

Implementation

NRFUTIL({
  this.mode = NRFUtilMode.release,
  this.hardwareVersion = 0xFFFFFFFF,
  this.applicationVersion = 0xFFFFFFFF,
  this.bootloaderVersion = 0xFFFFFFFF,
  this.softDeviceReqType = SoftDeviceTypes.s132NRF52d611,
  //this.softDeviceIdTypes = const [SoftDeviceTypes.s132NRF52d611],
  this.bootValidationTypeArray = const [ValidationType.validateSHA256],
  Signing? signer,
  this.applicationFirmware,
  this.bootloaderFirmware,
  this.softDeviceFirmware,
  this.keyFile,
  // this.manufacturerId = 0,
  // this.imageType = 0,
  this.comment,
}){
  sofDeviceReq = sdTypeInt[softDeviceReqType.index];

  if(signer == null){
    if(keyFile != null){
      String keyString = keyFile!;
      this.signer = Signing(privateKey: keyString);
      if(keyString == this.signer.defaultKey){
        logger?.verbose("Warning your key file is compromised, please generate a new key for signing!");
      }
    }
    else{
      this.signer = Signing();
      logger?.verbose("Warning you are using a default key which is compromised!");
    }
  }
  else{
    this.signer = signer;
  }
}