Skip to main content

knowa_patch_format 2.2.0 copy "knowa_patch_format: ^2.2.0" to clipboard
knowa_patch_format: ^2.2.0 copied to clipboard

The signed container a Knowa code-push patch travels in, and the key revocation record: one byte layout shared by the Knowa toolchain and knowa_sdk.

example/example.dart

// Builds a patch container and reads it back.
//
// Patches are normally built and signed by the Knowa CLI and read on the
// device by knowa_sdk. This example shows the format on its own. Its signer
// returns a placeholder; a real signer returns an Ed25519 signature, for
// example from package:cryptography or a hardware token.
import 'dart:typed_data';

import 'package:knowa_patch_format/knowa_patch_format.dart';

void main() {
  final payload = Uint8List.fromList([1, 2, 3, 4]);

  final container = encodePatch(
    metadata: PatchMetadata(
      appId: 'com.example.app',
      baseRelease: '1.0.0+1',
      sequence: 1,
      channel: 'stable',
      payloadSha256: sha256OfPayload(payload),
      createdAt: DateTime.now().toUtc().toIso8601String(),
    ),
    payload: payload,
    signer: (signedBytes) => List<int>.filled(signatureLength, 0),
  );

  final patch = decodePatch(container);
  print('${container.length} bytes: ${patch.metadata}');
  print('payload digest matches: ${patch.payloadDigestMatches}');
}
0
likes
160
points
537
downloads

Documentation

API reference

Publisher

verified publisherknowalabs.com

Weekly Downloads

The signed container a Knowa code-push patch travels in, and the key revocation record: one byte layout shared by the Knowa toolchain and knowa_sdk.

Homepage

Topics

#code-push #ota-updates #ed25519 #signing

License

BSD-3-Clause (license)

Dependencies

crypto

More

Packages that depend on knowa_patch_format