HIP-001: New Hashgraph DID-SDK
Author: |
Jakub Sydor <@Harasz>, Pablo Buitrago <@ChangoBuitrago> |
Working-group: |
Micha Roon <@drgorb>, Pablo Buitrago <@ChangoBuitrago>, Jakub Stasiak <@js-hg>, Jakub Sydor <@Harasz>, Waldemar Trawnicki @wtrawnicki, Gabriele Morelli <@gabomorelli> |
Discussions-to: |
https://github.com/Swiss-Digital-Assets-Institute/hashgraph-did-sdk-js/pull/666 |
Status: |
Draft |
Needs-council-approval: |
No |
Type: |
Informational |
Category: |
Application |
Created: |
2024-09-12 |
Updated: |
2024-09-18 |
Abstract
This proposal introduces an updated Hashgraph DID-SDK to address critical limitations and bugs in the current implementation. The existing SDK suffers from synchronous cryptographic operations, inadequate key management, and a lack of multibase encoding—essential for modern decentralized applications. Additionally, it contains bugs that affect reliability and security. This HIP aims to deliver a more robust, secure, and flexible SDK, enhancing performance, interoperability, and security for Hedera applications.
Motivation
The current DID-SDK faces several critical limitations:
-
Synchronous operations: Some cryptographic operations, including signing, are synchronous, leading to bottlenecks and reduced responsiveness, particularly under high load.
-
Inadequate key management: There is no support for external key management solutions and diverse strategies, being restricted to using
PrivateKey
directly for cryptographic operations. This limitation poses security risks and reduces flexibility. For details onPrivateKey
, refer to the Hedera SDKs and APIs Documentation [7]. -
No multibase encoding: The absence of multibase encoding limits interoperability with other systems.
-
Critical bugs:
-
Messages on topics are not verified for correct association with the requested DID.
-
Messages with invalid signatures can be submitted to topics, compromising data integrity.
-
Subscriptions to non-existent topics are not managed properly.
-
Retrying subscription requests for non-existent topics is not handled correctly during resolution.
-
The
Accept
option in the resolver is not functioning as expected.
-
These limitations compromise the SDK’s performance, flexibility, and security, reducing its effectiveness for decentralized applications.
Rationale
The proposed Hashgraph DID-SDK introduces several design improvements to address key limitations of the current SDK:
-
Asynchronous Cryptographic Operations: Asynchronous operations are essential for handling high-load scenarios efficiently. This design choice is made to prevent performance bottlenecks observed in the existing synchronous model.
-
Flexible Key Management: Support for External Secret Mode and Client-managed Secret Mode enhances security and flexibility. These modes allow for varied key management strategies that align with different security needs. A significant refactor of the existing key management system was evaluated, but it would have introduced complexity and maintenance challenges without fully resolving the limitations. For details on these key management modes, refer to the DID Registration Specification [5].
-
Multibase Encoding: Multibase encoding is included to improve interoperability with diverse systems. The absence of this feature in the current SDK restricts its integration capabilities. Other encoding schemes were considered, but multibase offers the best balance of compatibility and standardization.
-
Critical Bug Fixes: These fixes are crucial for ensuring secure and accurate message handling in decentralized applications.
The design decisions were influenced by the need to address these limitations comprehensively. Community feedback highlighted the importance of these features, and various alternate approaches were evaluated. The proposed solutions reflect a consensus on the most effective way to enhance the SDK’s capabilities while addressing concerns raised during discussions.
User Stories
-
As a developer, I want asynchronous cryptographic operations so that I can achieve better performance and responsiveness in high-demand applications.
-
As a security engineer, I need support for External and Client-managed Secret Modes so that I can implement flexible and secure key management solutions tailored to my application’s needs.
-
As an integrator, I want multibase encoding support so that my application can interact seamlessly with other systems and technologies.
-
As a quality assurance specialist, I need the SDK to address and resolve existing bugs to ensure reliable and accurate functionality in decentralized applications.
Specification
The technical specifications for the new Hashgraph DID-SDK will be detailed in the reference implementation, which includes:
-
Interfaces: Definitions of new and updated interfaces.
-
Data Structures: Descriptions of data models and schemas.
-
Diagrams (Sequence, Class): Visual representations of interactions and structure.
-
Code Examples: Practical usage examples and sample code.
-
Testing Details: Coverage of unit, integration, and security tests.
These details will be available in the reference implementation on the Hashgraph DID-SDK’s GitHub repository, ensuring transparency and community collaboration.
Backwards Compatibility
The introduction of new key management modes and asynchronous cryptographic operations makes backward compatibility impossible. However, all previous functionalities will be preserved in the updated SDK, ensuring that the transition is manageable.
Security Implications
The proposed changes improve security by addressing vulnerabilities in the current SDK. Asynchronous cryptographic operations prevent performance bottlenecks, lowering the risk of denial-of-service attacks and other exploits in high-load scenarios. Introducing flexible key management methods allows for more secure, tailored implementations, reducing risks from single-point failures.
Reference Implementation
A complete reference implementation will be developed, including:
-
Robust Test Coverage: Extensive test coverage with a target of 80%, including unit, integration, security, and performance tests.
-
Comprehensive Documentation: Detailed documentation to help developers understand and use the SDK effectively.
-
Open Source and Collaborative: The implementation will be publicly accessible at Hashgraph DID-SDK’s GitHub repository, allowing for community review and collaboration.
-
Rejected Ideas
Several alternatives were considered:
-
Incremental Fixes: Maintaining the current implementation with incremental fixes was evaluated but deemed inadequate for addressing core performance issues. While quicker to deploy, incremental fixes would not fully resolve the limitations of the existing SDK.
-
Large Refactor: A significant refactor of the existing SDK was considered. Although it might address many issues, it was deemed too complex and risky, with potential backward compatibility issues and higher maintenance costs. This approach would also not provide the flexibility and scalability required by modern applications.
Developing a new SDK from scratch was chosen as it provides a more effective solution for the identified problems and better long-term support.
Open Issues
-
Community Feedback: Ongoing discussions and feedback may result in additional refinements or adjustments.
References
[1] Hedera SDK JavaScript: https://github.com/hashgraph/hedera-sdk-js
[2] DID Core Specification: https://www.w3.org/TR/did-core/
[3] DID Core Properties: https://w3c.github.io/did-core/#core-properties
[4] Universal Resolver: https://github.com/decentralized-identity/universal-resolver
[5] DID Registration Specification: https://identity.foundation/did-registration/
[6] Hedera DID Method GitHub Repository: https://github.com/hashgraph/did-method/
[7] Hedera SDKs and APIs Documentation: https://docs.hedera.com/hedera/sdks-and-apis
[8] Hedera Main Site: https://www.hedera.com/
Copyright/license
This document is licensed under the Apache License, Version 2.0 — see Apache License, Version 2.0