Animo Solutions
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Write
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Versions and GitHub Sync Note Insights Sharing URL Help
Menu
Options
Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Write
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       owned this note    owned this note      
    Published Linked with GitHub
    Subscribed
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    Subscribe
    # Modular AFJ Although Aries Framework JavaScript is structured as a monorepo, %99 of the code stil lives in one big `@aries-framework/core` package. This documents describes the design of a more modular AFJ, so people with different use case can use the framework. ## Motivation With more and more usage of AFJ in different environments, with different restrictions and different business requirements it's becoming more of an issue to work with the fat `@aries-framework/core` package. The Node.JS and React Native specific code have been ectracted from the core a while ago but with the addition of multipile storage implementations, multiple wallets and multiple credential formats it's becoming harder to work with the single core package. A more modular AFJ would allow different restrictions in terms of use case, environment, credential formats, etc.. to be managed by different packages, while still providing an powerfull core module. ## Pluggable Components Although it's already possible to write custom modules for AFJ (see [Extension Module example](https://github.com/hyperledger/aries-framework-javascript/tree/main/samples/extension-module)), for a lot of parts of the framework it's not possible yet to configure it to different needs. This sections lists all components that should be configurable and pluggable. - Did methods (both resolver and registrar) - Should be able to plug in dif did resolver (we already use it internally for e.g. did:web) - Credential formats - Modules - Protocols - Storage - Wallet ## Plugin System Extracting components from the core into separate modules would require better support for plugins. The idea is to add support for plugins to the agent initialization config. Plugins can be any class that implements the `Plugin` interface. ```typescript import { Agent } from '@aries-framework/core' import { CredentialModule } from '@aries-framework/module-credentials' const myAgent = Agent.create({ modules: { credentials: new CredentialsModule({ autoAcceptCredentials: true, credentialProtocols: [V1CredentialProtocol], credentialFormats: [IndyCredentialFormat] }), dids: new DidsModule({ resolvers: [SovDidResolver, WebDidResolver, KeyDidResolver, PeerDidResolver], registrars: [SovDidRegistrar, WebDidRegistrar, KeyDidRegistrar, PeerDidRegistrar] }), } }) await myAgent.initialize() // fully typed const record = myAgent.credentials.offerCredentials({ /* the config */ }) ``` ```typescript= interface CredentialsModuleConfig { autoAcceptCredentials: boolean, CredentialProtocols: CredentialProtocol[], CredentialFormats: CredentialFormat[] } class CredentialsModule<CredentialFormats, CredentialProtocols> implements Module { public config: CredentialsModuleConfig // define modules this class needs (so we can infer whether all required modules are registered) public needsModules = [ConnectionsModule] // Api defines the public api on the agent instance (optional) public api = CredentialsApi<CredentialFormats, CredentialProtocols> public constructor(config: CredentialsModuleConfig) { this.config = config } public register(dependencyManager: DependencyManager) { dependencyManager.registerSingleton(CredentialsRepository) // Register this class, so we can inject it and use the config later on dependencyManager.registerSingleton(CredentialModule, this) // Dynamically register credential protocols based on user config for (const CredentialProtocol of this.config.credentialProtocols) { // Token is to be defined. probably CredentialService.token (stratic property on the abstract class) dependencyManager.registerSingleton("CredentialProtocol", CredentialProtocol) } // Dynamically register credential formats based on user config for (const CredentialFormat of this.config.credentialFormats) { // Token is to be defined. probably Credentialformat.token (stratic property on the abstract class) dependencyManager.registerSingleton("CredentialFormat", CredentialFormat) } } } ``` ## Packages Not looking to split in so much packages, but this is basically a separation of different components. Whether some of them are internal to core is tbd later, but to get the mental model right. Sepearting into multiple packages will also help with boundaries between different packages. ### Core * `@aries-framework/core` * Can run in any environment -- no environment specific dependencies * Defines StorageService, Wallet, FileSystem interfaces * defines DidResolver, DidRegistrar ### Node.JS * `@aries-framework/node` * Provides common Node.JS dependencies ### React Native * `@aries-framework/react-native` * Provides common React Native dependencies * `@aries-framework/file-system-rnfs` * Implements FileSystem * We can later add a `@aries-framework/file-system-expo` ### Credentials * `@aries-framework/module-credentials` * `@aries-framework/protocol-issue-credential-v2` ### Proofs * `@aries-framework/module-proofs` * `@aries-framework/protocol-present-proof-v2` ### Indy * `@aries-framework/credential-anoncreds` * Interfaces for AnonCredsHolderService, AnonCredsVerifierService, AnonCredsIssuerService, AnonCredsRevocationService, AnonCredsResourceService * Implementation of ProofFormatService (AnonCredsProofFormatService) -- or should this still be IndyProofFormatService? In that case it shouldn't be in the AnonCreds package * Implementation of CredentialFormatService (AnonCredsCredentialFormatService) -- or should this still be IndyCredentialFormatService? In that case it shouldn't be in the AnonCreds package * Implementation of ProofService (V1ProofService) * Implementation of CredentialService (V1CredentialService) * Implementation of the `SovDidResolver`, `SovDidRegistrar`, `IndyDidResolver` and `IndyDidRegistrar` * `@aries-framework/indy-sdk` * Implementation of AnonCredsHolderService, AnonCredsVerifierService, AnonCredsIssuerService, AnonCredsRevocationService, AnonCredsResourceService * Implementation of StorageService, Wallet * Depends on the `Indy` interface defined in `@types/indy-sdk` which can be fulfilled using either `indy-sdk` or `indy-sdk-react-native` * `@aries-framework/indy-vdr` -- we could combine this with indy-credx, just have to make sure the binaries are not required to import, and only to use the specific classes. You must be able to to use indy-vdr for dids without indy-credx * Implementation of AnonCredsResourceService * Depends on the interfaces from `indy-vdr-shared` which can be fulfilled using either `indy-vdr-react-native` or `indy-vdr-nodejs` * `@aries-framework/indy-credx` * Implementation of AnonCredsHolderService, AnonCredsVerifierService, AnonCredsIssuerService, AnonCredsRevocationService * Depends on the interfaces from `indy-credx-shared` which can be fulfilled using either `indy-credx-react-native` or `indy-credx-nodejs` ### W3C Credentials * `@aries-framework/credential-w3c` * Adds support for the `W3cCredentialService`, `W3cCredentialRecord` * Adds support for the `JsonLdCredentialFormatService` * Adds support for the `PresentationExchangeProofFormatService` * Adds support for the `Ed25519Signature2018` signature suite (no heavy native dependencies) * Defines `SignatureSuiteRegistry` so signature suites can be dynamically registered * `@aries-framework/bbs-signatures` * Depends on `@mattrglobal/bbs-signatures` (`@animo-id/react-native-bbs-signatures` in React Native environment) * Adds support for the `BbsBlsSignature2020` and `BbsBlsSignatureProof2020` signature suites * Will be dynamically registered in the `SignatureSuiteRegistry` * Adds support for the `Bls12381g2SigningProvider` * Will be dynamically register in the `SigningProviderRegistry` ### Askar * `@aries-framework/askar` * Adds `AskarStorageService` and `AskarWallet` * Depends on `aries-askar-shared` which can be fulfilled using either `aries-askar-react-native` or `aries-askar-nodejs` ### 0.3.0 As 0.3.0 will still depend on the indy-sdk, there's no need to extract all dependencies out of core yet. The most important part is to extract the bbs dependencies and make them optional. With the addition of the `SignatureSuiteRegistry` and the `SigningProviderRegistry` we can move all bbs dependencies to the `@aries-framework/bbs-signatures` package. Over time we can make sure the other parts are extracted from the core. ```typescript import { BbsSignaturesModule } from '@aries-framework/bbs-signatures' const agent = new Agent({ modules: { // This will add support for creating bbs keys, and signing/verifying/deriving BbsBlsSignature(Proof)2020 jsonld credentials // As there is no public api, the `bbs` key won't be added to the `agent` instance. bbs: BbsSignaturesModule }, }) ```

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully