Created
October 16, 2024 10:03
-
-
Save sondreb/4aa0067e009f647b2583879cf0cdfad7 to your computer and use it in GitHub Desktop.
Custom DID Method for Web5.connect()
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const customAgentVault = new HdIdentityVault({ | |
keyDerivationWorkFactor: 210_000, | |
store: new LevelStore<string, string>({ location: `DATA/AGENT/VAULT_STORE` }), | |
}); | |
await customAgentVault.unlock({ password }); | |
const didApi = new AgentDidApi({ | |
didMethods: [DidDht, DidJwk, DidStellar], | |
resolverCache: new AgentDidResolverCache({ location: `DATA/AGENT/DID_RESOLVERCACHE` }), | |
store: new DwnDidStore(), | |
}); | |
const agentDid = await customAgentVault.getDid(); | |
const customAgent = await Web5IdentityAgent.create({ didApi, agentDid, agentVault: customAgentVault }); | |
console.log('Connecting to Web5...'); | |
const result = await Web5.connect({ agent: customAgent, connectedDid, password, sync: this.syncInterval }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment