alan-turing-institute / trustchain

Trustworthy decentralised PKI
https://alan-turing-institute.github.io/trustchain/
Apache License 2.0
9 stars 4 forks source link

Update to recent SSI #127

Closed sgreenbury closed 11 months ago

sgreenbury commented 11 months ago

Closes #85.

edchapman88 commented 11 months ago

Do we have an approach to deciding whether to add contextLoader and other pass through variables with or without an Option wrapper?

pros for wrapper:

cons for wrapper:

sgreenbury commented 11 months ago

Yes good point, open to modifying this if the current integration can be improved.

Adding a few specific options for including the ContextLoader in the API (other variants possible too) here:

  1. context_loader: &mut ContextLoader: as used in the SSI-VC API (e.g. here)
  2. context_loader: Option<&mut ContextLoader> : with option wrapping mut ref
  3. context_loader: Option<ContextLoader>: with option wrapping moved context loader.

The current integration uses option 1. as it matches the SSI API directly and where no context loader is available adding a &mut ContextLoader::default() seemed not too much of a problem. On the mutable reference issue, we might face a challenge with a shared ContextLoader in the HTTP crate integrating it within the AppState (can be covered as part of #128), but we can wrap in a Mutex in this case (though should consider whether this would cause any performance issues, RwLock would probably be better as writing would probably not be required during operation).