zeroxkey_core 0.1.0 copy "zeroxkey_core: ^0.1.0" to clipboard
zeroxkey_core: ^0.1.0 copied to clipboard

Platform-agnostic core for the ZeroXKey SDK (domain, data, network, providers, DI).

zeroxkey_core #

Platform-agnostic core for the ZeroXKey SDK. Pure Dart (no Flutter imports) so it can be unit-tested in isolation and reused across runtimes.

It houses the architectural layers that sit between the generated protocol client (zeroxkey_http) and the Flutter presentation layer (zeroxkey_sdk_flutter):

  • errors - ZeroXKeyException hierarchy (NetworkException, TimeoutException, ApiException, AuthException, SigningException, StateException). The wire-level ZeroXKeyRequestError is mapped to ApiException at the data boundary.
  • config / provider - immutable ZeroXKeyConfiguration, NetworkOptions, and the BackendProvider adapter (ZeroXKeyBackendProvider defaults to api.0xkey.io / authproxy.0xkey.io and the 0xkey_hpke info string).
  • network - MiddlewareHttpTransport decorates any HttpTransport with request tracing (X-Trace-Id), exponential-backoff RetryPolicy (connection errors only; timeouts are never retried), bounded timeouts, and ApiErrorMapper.
  • signing - Signer and KeyStore strategy ports.
  • domain / data - entities, repository interfaces, use cases (SignMessageUseCase), and their implementations backed by ZeroXKeyClient.
  • di - ZeroXKeyContainer, a hand-written composition root (no third-party DI).

Usage #

zeroxkey_core is consumed by zeroxkey_sdk_flutter; most apps do not depend on it directly. To assemble the graph:

import 'package:zeroxkey_core/zeroxkey_core.dart';

final container = ZeroXKeyContainer(
  configuration: const ZeroXKeyConfiguration(
    backend: ZeroXKeyBackendProvider(),
  ),
  clientResolver: () => myActiveZeroXKeyClient,
);

// Inject the decorated transport into the generated client:
final client = ZeroXKeyClient(
  config: THttpConfig(baseUrl: 'https://api.0xkey.io'),
  stamper: mySigner, // any Signer (a TStamper)
  transport: container.transport,
);

// Delegate domain operations:
final wallets = await container.walletRepository
    .fetchWallets(organizationId: 'org-id');

Tests #

dart test
0
likes
140
points
124
downloads

Documentation

API reference

Publisher

verified publisher0xkey.io

Weekly Downloads

Platform-agnostic core for the ZeroXKey SDK (domain, data, network, providers, DI).

Repository (GitHub)
View/report issues

License

Apache-2.0 (license)

Dependencies

http, zeroxkey_api_key_stamper, zeroxkey_crypto, zeroxkey_encoding, zeroxkey_http

More

Packages that depend on zeroxkey_core