Comments (6)
My suggestion would be to go for approach 2. I may have a high-level view, but I think would be good practice to apply a Builder pattern here, where atomically a scheme is created without an intermediate state, and I get back as a result an immutable object that later I'll publish to the ledger.
I imagine something like that :
schema schema_object = schema.buildSchema(anoncreds.buildId(), param1(), param2(), etc..)
ledger.publish(schema_object)
from anoncreds-rs.
@swcurran @blu3beri @victormartinez-work @dkulic Any thoughts on which approach would work best you think? I think approach 2 should be fine as you can almost always generate the identifier before you create the object, but curious to hear what you think.
For approach 1 the flow (in ACA-Py, AFJ) would be something like:
- create schema without
id
property - call anoncreds method implementation to generate identifier
- publish schema to ledger, get back schema object with
id
property
For approach 2 the flow would be something like:
- call anoncreds method implementation to generate identifier
- call create schema with id property
- publish schema to ledger
I think the flow for approach 1 would be a bit cleaner as you don't have to go method specific -> generic -> method specific, but rather go generic -> method specific. However going with approach 2 makes the internal handling a lot easier as you don't have to make id
an optional property on the schema model.
Edit: also tagging @andrewwhitehead
from anoncreds-rs.
One small, or big I am not too sure, benefit of the first approach is that we can easily reuse the anoncreds object to register it at different ledgers with different identifiers. If we take approach two we bind the id to the anoncreds object and therefore we cannot change it later, we have to regenerate it.
I am very unaware if this is a common use case, if it is it might be worth considering, but if it is not, I do not see a reason why we should not do Approach 2.
from anoncreds-rs.
Not sure what is the impact in case @blu3beri mentioned, but to me Approach 2 seams simpler and avoid confusion of having objects with and without an id.
from anoncreds-rs.
Approach 2 seems better to me, so that when you resolve the object you have a reference in it to where it was found. However, to resolve an object, you must already have its ID, so not really needed.
I assume we are thinking that whatever approach we use extends to all of the objects - CredDef, RevRegDef, RevRegEntry. In each, in theory, only the objects that reference another object must have the ID -- e.g. the CredDef must reference the ID of the schema, RevRegDef the CredDef, so in theory both work.
The identifier must be resolvable, so it's not like a database where you want content-less IDs that can be generated as the object is created. The IDs must be properly formed for resolution.
Sorry I'm not much help on this one...
from anoncreds-rs.
Discussed WG 2022-11-07:
- Id property is not needed in data model
- With some methods the id is generated during publishing (to the ledger), so approach 2 wouldn't work in that case
Proposed solution: do not include id in models, create objects without identifier (as the data model doesn't require an id)
from anoncreds-rs.
Related Issues (20)
- Look into WASM support HOT 8
- Add example application to the React Native wrapper for anoncreds
- Can't build project HOT 1
- Remove unused methods and models
- Correctly transform jsi value to `ByteBuffer`
- Credential Request Entropy HOT 5
- Generate binary for linux-aarch64 HOT 1
- Usage of timestamp override HOT 2
- [Bug] Python Wrapper LinkSecret Invalid object handle HOT 3
- Instead of having iOS XC framework, making it a universal XC Framework HOT 2
- Zeroing the Link Secret HOT 1
- Ursa EOL HOT 3
- Installation issue on windows HOT 11
- 'anoncreds.h' file not found with <angled> include; use "quotes" instead HOT 7
- `tailsLocation` is pulling double duty HOT 6
- Update object finalizers and add keepalives - from indy-shared-rs HOT 1
- Replace the current ursa dependency with AnonCreds clsignatures HOT 2
- Full revocation status list is actually required for revocable credential issuance? HOT 3
- Update JS wrapper HOT 1
- Strings not freed in the JS wrapper? HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from anoncreds-rs.