Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[1.x] Externalize KeyPackageStorage and update key package generation API #207

Open
Tracked by #211
tomleavy opened this issue Nov 6, 2024 · 0 comments
Open
Tracked by #211

Comments

@tomleavy
Copy link
Contributor

tomleavy commented Nov 6, 2024

Background:

Part of #211

Key Package Generation API

When creating a key package there are several options that can be set:

  • LeafNode extensions
  • KeyPackage extensions
  • NotBefore time
  • NotAfter time

These options should be configured via a new KeyPackageBuilder instead of the current combination of client configuration + properties passed directly to the generate_key_package_message function

Before (0.x)

Creating Key Packages

// Make a key package store that conforms to the KeyPackageStorage trait
let key_package_store = MyKeyPackageStore::new();

let client = Client::builder() 
        .key_package_repo(key_package_store) // Transfer the ownership of the key package repo to a client via the ClientBuilder
        .key_package_lifetime(1000) // All generated key packages are valid for 1000 seconds
        ....
        .build();

// Generate the key package and provide extensions as Default
let key_package = client.generate_key_package_message(Default::default(), Default::default()).unwrap();

After (1.x)

Creating Key Packages

// MyKeyPackageStore no longer needs to conform to KeyPackageStorage (trait no longer exists)
let key_package_store = MyKeyPackageStore::new();

let client = Client::builder()
        .... // No key package specific configuration 
        .build();
        
// Generate a key package and private data
let (kp_message, private_kp_data) = client.key_package_builder()
        .valid_for_sec(1000) // Key package is valid for 1000 seconds
        .with_package_extension(ext1) // Add first extension
        .with_package_extension(ext2) // Add second extension
        .with_leaf_extension(some_leaf_extension) // Add leaf node extension
        .build()
        .unwrap();
        
// Independently store the generated secret keys in MyKeyPackageStore
key_package_store.write(private_kp_data).unwrap();
@tomleavy tomleavy changed the title [WIP] [1.x] Externalize KeyPackageStorage and update key package generation API [1.x] Externalize KeyPackageStorage and update key package generation API Nov 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant