Ability to restore Eth Identity from without Signer#79
Ability to restore Eth Identity from without Signer#79panpansh wants to merge 1 commit intoorbitdb-archive:mainfrom
Conversation
panpansh
commented
Apr 2, 2022
```js
import path from "path";
import ODBKeystore from "orbit-db-keystore";
import Identities from "orbit-db-identity-provider";
const account = accounts[0];
const odbIdentitykeysPath = path.join("./orbitdb", "identity", "identitykeys");
const keystore = new ODBKeystore(odbIdentitykeysPath);
// if account exist in IDB: restore else sign
const identity = await keystore.hasKey(account)
? await Identities.createIdentity({
type: "orbitdb",
id: account,
})
: await Identities.createIdentity({
type: "ethereum",
wallet: provider.getSigner(),
});
```
|
https://github.com/orbitdb/orbit-db-identity-provider/blob/main/src/identities.js#L58-L64 to be clear the create works fine, the problem is when i want to restore my identity, actually in the code in my case i want "identityProvider.getId" as Ethereum but i want "identityProvider.signIdentity" as Orbitdb. Because if a wallet is not specified when he getId as ethereum, he create a new one and return the new one https://github.com/orbitdb/orbit-db-identity-provider/blob/main/src/ethereum-identity-provider.js#L18 And giving the id like that as createIdentity param, I dont need this transformation as orbitdb https://github.com/orbitdb/orbit-db-identity-provider/blob/main/src/orbit-db-identity-provider.js#L26 |
|
I'm certainly wrong, I can't restore the identity without asking for the signature after refreshing the page |