create static method

Future<CanvasRegisterClockModel> create({
  1. required String canvasId,
  2. required String objectId,
  3. required CanvasRegisterName registerName,
  4. required String conversationKey,
  5. required String hlcTimestamp,
  6. String? registerJson,
  7. bool? isDeleted,
})

Signs a register clock with the current device's signing key.

Implementation

static Future<CanvasRegisterClockModel> create({
  required String canvasId,
  required String objectId,
  required CanvasRegisterName registerName,
  required String conversationKey,
  required String hlcTimestamp,
  String? registerJson,
  bool? isDeleted,
}) async {
  final actorDeviceKey = Signing.instance.publicKey;
  final valueDigest = await digestFor(
    registerName: registerName,
    registerJson: registerJson,
    isDeleted: isDeleted,
  );
  final message = getMessage(
    canvasId: canvasId,
    objectId: objectId,
    registerName: registerName,
    conversationKey: conversationKey,
    actorDeviceKey: actorDeviceKey,
    hlcTimestamp: hlcTimestamp,
    valueDigest: valueDigest,
  );
  final signature = await Signing.instance.signDeviceMessage(message);

  return CanvasRegisterClockModel(
    canvasId: canvasId,
    objectId: objectId,
    registerName: registerName,
    conversationKey: conversationKey,
    actorDeviceKey: actorDeviceKey,
    hlcTimestamp: hlcTimestamp,
    signature: signature,
  );
}