-
Notifications
You must be signed in to change notification settings - Fork 45
feat(sdk): add credentials-based API for DPNS registerName #2989
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
base: v3.0-dev
Are you sure you want to change the base?
Conversation
…provided Previously, documentCreate() would throw an error if the Document didn't have entropy set. This was a breaking change for SDKs that create documents via fromObject(), fromJSON(), or fromBytes() which don't auto-generate entropy. Now entropy is auto-generated at the wasm-sdk level when not provided, making it truly optional while maintaining backward compatibility. Co-Authored-By: Claude Opus 4.5 <[email protected]>
Instead of generating entropy in wasm-sdk, pass None to rs-sdk when entropy is not set. This lets rs-sdk handle both entropy generation and document ID regeneration correctly. Co-Authored-By: Claude Opus 4.5 <[email protected]>
Add convenience method that accepts simple credentials (identityId, publicKeyId, privateKey) instead of requiring pre-constructed typed objects (Identity, IdentityPublicKey, IdentitySigner). This simplifies the API for common use cases where the caller has credentials but doesn't need full control over object construction. Changes: - simple-signer: Add from_wif(), from_private_key(), add_key_from_wif() helper methods; update doc to reflect production use - rs-sdk: Add register_dpns_name_with_credentials() convenience method - wasm-sdk: Support both parameter styles in dpnsRegisterName() - js-evo-sdk: Add JSDoc documentation for both styles Co-Authored-By: Claude Opus 4.5 <[email protected]>
✅ gRPC Query Coverage Report |
📝 WalkthroughWalkthroughThe PR adds simplified DPNS name registration by introducing credential-based registration flows across the SDK stack. SimpleSigner is expanded with WIF parsing and convenience constructors. The WASM and JavaScript SDKs are updated to support dual-style parameter handling, while Rust SDK gains a credential-focused registration method. Document creation entropy handling becomes optional. Changes
Sequence DiagramsequenceDiagram
participant TS as TypeScript App
participant JSFacade as JS Facade
participant WasmSDK as WASM SDK
participant RustSDK as Rust SDK
participant Signer as SimpleSigner
TS->>JSFacade: registerName(options)
JSFacade->>WasmSDK: dpns_register_name(options)
alt Style B: Simple Credentials
WasmSDK->>WasmSDK: Extract identityId, publicKeyId, privateKey
WasmSDK->>RustSDK: register_dpns_name_with_credentials(label, identity_id, public_key_id, private_key)
RustSDK->>RustSDK: Fetch identity from platform
RustSDK->>Signer: Create SimpleSigner with private key
Signer->>Signer: Store private key mapped to public key
RustSDK->>RustSDK: Call register_dpns_name with signer
else Style A: Typed Objects
WasmSDK->>WasmSDK: Extract identity, identityKey, signer
WasmSDK->>RustSDK: register_dpns_name(RegisterDpnsNameInput)
end
RustSDK->>WasmSDK: RegisterDpnsNameResult
WasmSDK->>JSFacade: Promise resolves
JSFacade->>TS: RegisterDpnsNameResult
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧹 Recent nitpick comments
📜 Recent review detailsConfiguration used: defaults Review profile: CHILL Plan: Pro ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (6)
🧰 Additional context used📓 Path-based instructions (3)**/*.rs📄 CodeRabbit inference engine (CLAUDE.md)
Files:
**/*.{js,jsx,ts,tsx}📄 CodeRabbit inference engine (AGENTS.md)
Files:
packages/**/!(node_modules)/**/*.{js,jsx,ts,tsx}📄 CodeRabbit inference engine (AGENTS.md)
Files:
🧠 Learnings (19)📓 Common learnings📚 Learning: 2024-10-06T16:11:34.946ZApplied to files:
📚 Learning: 2024-10-21T01:03:42.458ZApplied to files:
📚 Learning: 2024-11-20T16:05:40.200ZApplied to files:
📚 Learning: 2024-10-29T10:42:00.521ZApplied to files:
📚 Learning: 2025-09-03T16:37:11.605ZApplied to files:
📚 Learning: 2025-03-11T09:39:23.071ZApplied to files:
📚 Learning: 2024-10-18T15:39:51.172ZApplied to files:
📚 Learning: 2025-01-19T07:36:46.042ZApplied to files:
📚 Learning: 2025-11-25T13:10:23.481ZApplied to files:
📚 Learning: 2024-11-20T20:43:41.185ZApplied to files:
📚 Learning: 2025-07-28T20:00:08.502ZApplied to files:
📚 Learning: 2025-09-03T14:41:16.196ZApplied to files:
📚 Learning: 2025-09-03T14:42:29.958ZApplied to files:
📚 Learning: 2025-09-03T19:33:21.688ZApplied to files:
📚 Learning: 2024-09-29T13:13:54.230ZApplied to files:
📚 Learning: 2024-10-29T14:40:54.727ZApplied to files:
📚 Learning: 2025-10-01T08:37:32.168ZApplied to files:
📚 Learning: 2025-07-28T20:00:24.323ZApplied to files:
🧬 Code graph analysis (3)packages/rs-sdk/src/platform/dpns_usernames/mod.rs (2)
packages/simple-signer/src/signer.rs (1)
packages/wasm-sdk/src/dpns.rs (3)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (16)
🔇 Additional comments (13)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
shumkov
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The idea is that eventually Evo SDK will keep in context with user identities, data contracts, and signer, so these params become optional in all methods. We have this one in our TODO list. Currently, we aligned all interfaces and remove implicit fetching of data inside methods. I'm not sure that patching of one specific method is the right way to move.
Issue being fixed or feature implemented
Many SDK APIs changed from simple credential parameters to requiring pre-constructed typed objects, making the API more complex for common use cases. This PR adds convenience methods that accept simple credentials (identityId, publicKeyId, privateKey) for DPNS registerName as a proof of concept for the pattern.
Old API Style (dev.9):
Current API Style (requires pre-construction):
What was done?
Added support for both parameter styles in DPNS registerName:
simple-signer:
from_wif(),from_private_key(),add_key_from_wif()helper methodsrs-sdk:
simple-signeras dependencyregister_dpns_name_with_credentials()convenience methodwasm-sdk:
DpnsRegisterNameOptionsTypeScript interface to accept both stylesjs-evo-sdk:
New simple credentials style:
The existing typed objects style continues to work unchanged.
How Has This Been Tested?
cargo check -p simple-signer --features state-transitions✅cargo check -p dash-sdk✅cargo check -p wasm-sdk✅Future PRs will add functional tests as part of expanding this pattern to other methods.
Breaking Changes
None. This is purely additive - the existing typed objects API continues to work unchanged.
Checklist:
🤖 Generated with Claude Code
Summary by CodeRabbit
Release Notes
✏️ Tip: You can customize this high-level summary in your review settings.