affinidi_tdk_vault_edge_drift_provider 1.1.0 copy "affinidi_tdk_vault_edge_drift_provider: ^1.1.0" to clipboard
affinidi_tdk_vault_edge_drift_provider: ^1.1.0 copied to clipboard

A library to manage Vault CRUD operations on a Drift database

Affinidi TDK - Vault Edge Drift Provider #

The Affinidi TDK - Vault Edge Drift Provider package implements the Drift database to persist and manage user profiles, including related credentials and files.

Key Features #

  • Manage profiles

    • Create a new profile
    • List all available profiles
    • Update an existing profile
    • Delete an existing profile
  • Manage files related to a profile

    • Create a file
    • Create folders to organise files
    • List contents of a folder
    • Get the content of a file
  • Manage credentials related to a profile

    • Save a credential
    • Delete a credential
    • Get the credential data

Requirements #

  • Dart SDK version ^3.6.0

Installation #

Run:

dart pub add affinidi_tdk_vault_edge_drift_provider

or manually add the package to your pubspec.yaml file:

dependencies:
  affinidi_tdk_vault_edge_drift_provider: ^<version_number>

and then run the command below to install the package:

dart pub get

For more information, visit the pub.dev install page of the package.

Usage #

After successfully installing the package, import it into your code.

import 'dart:typed_data';

import 'package:affinidi_tdk_vault_edge_drift_provider/affinidi_tdk_vault_edge_drift_provider.dart';
import 'package:drift/drift.dart';

void main() async {
  // Create an in-memory database directly
  final database = Database(NativeDatabase.memory());

  // Create repositories
  final profileRepository = EdgeDriftProfileRepository(database: database);
  String? currentProfileId;

  // Create a profile
  print('Adding a new profile');
  await profileRepository.createProfile(
    name: 'My Profile',
    description: 'A test profile',
    accountIndex: 1,
  );

  final profiles = await profileRepository.listProfiles();
  print('Profiles: ${profiles.map((p) => p.name).join(', ')}');
  currentProfileId = profiles.first.id;

  // Close the database
  await database.close();
}

For more sample usage, go to the example folder.

Regenerate Database Classes #

The package uses drift code generation. To regenerate database classes, run:

dart run build_runner build --delete-conflicting-outputs

Support & feedback #

If you face any issues or have suggestions, please don't hesitate to contact us using this link.

Reporting technical issues #

If you have a technical issue with the package's codebase, you can also create an issue directly in GitHub.

  1. Ensure the bug was not already reported by searching on GitHub under Issues.

  2. If you're unable to find an open issue addressing the problem, open a new one. Be sure to include a title and clear description, as much relevant information as possible, and a code sample or an executable test case demonstrating the expected behaviour that is not occurring.

Contributing #

Want to contribute?

Head over to our CONTRIBUTING guidelines.