Giter Club home page Giter Club logo

orbit-db-identity-provider's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

orbit-db-identity-provider's Issues

importing identity

I can't use orbitdb local keystore for stoarge
so I serialize the identity to JSON and save it on another storage
How can I import the saved identity back to orbitdb every time my server starts?

Issue with custom identity provider

Hi,

I am trying to find a way to have an identity that is linked to an Ethereum wallet. I tried the EthereumIdentityProvider, but whenever I connect with the same wallet address, I still get different identities (which makes impossible for a user to access the same app from different devices).

Then I tried to create a custom provider, did the addIdentityProvider, but when I run the createIdentity with the new provider, I consistently get the error "Class constructor Identities cannot be invoked without 'new'". Any idea what am I doing wrong? Or how can I achieve the same result some other way (users being able to connect from multiple devices)?

Also, why isn't the latest version of this package being used in the main orbit-db?

Thanks

did-jwt Module parse failed when importing library

./node_modules/did-jwt/lib/index.module.js 1720:17
Module parse failed: Unexpected token (1720:17)
File was processed with these loaders:
 * ./node_modules/babel-loader/lib/index.js
You may need an additional loader to handle the result of these loaders.
|               // TODO: should be able to use non base58 keys too
|               return key.type === 'X25519KeyAgreementKey2019' && Boolean(key.publicKeyBase58);
>             })) ?? [];
|             if (!pks.length && !controllerEncrypters.length) throw new Error(`no_suitable_keys: Could not find x25519 key for ${did}`);
|             return pks.map(pk => x25519Encrypter(base58ToBytes(pk.publicKeyBase58), pk.id)).concat(...controllerEncrypters);

I am trying to import orbit-db-identity-provider in a create-react-app app but did-jwt module parse fail when I import it.

Does anyone have an idea?

Update dependeces version

npm audit is showing a lot of security warnings, I don't know if any of them would affect this project, but it would be nice to have the npm audit clean.

OrbitDB - Ipfs is not defined Examples Browser

I have had problems in the last days, to run the OrbitDB examples.

The problem that appears in the web browser is the following:

Uncaught ReferenceError: Ipfs is not defined

Specifically in the file "example.js"
// Create IPFS instance const ipfs = new Ipfs({ repo: '/orbitdb/examples/browser/new/ipfs/0.33.1', start: true, preload: { enabled: false }, EXPERIMENTAL: { pubsub: true, }, config: { Addresses: { Swarm: [ // Use IPFS dev signal server // '/dns4/star-signal.cloud.ipfs.team/wss/p2p-webrtc-star', '/dns4/ws-star.discovery.libp2p.io/tcp/443/wss/p2p-websocket-star', // Use local signal server // '/ip4/0.0.0.0/tcp/9090/wss/p2p-webrtc-star', ] }, } })

You can see the problem in the following image:
orbitdb

The problem is due to the fact that there is a new version of the IPFS library, therefore the way to create the IPFS class instance has changed.

Solution:

To solve the problem, the example has been modified to be able to run the program correctly in the browser.

To solve the problem it is necessary to follow the following steps:
1)Modify the file "browser.html", with the dependencies in the correct path.
Before:
before
After:
after

  1. The file "example.js" should be modified, with the new form of the latest version of IPFS.

Before:
1before
After:
2after
Once the previous steps have been carried out, we can now correctly run the example with the latest version of IPFS.
finish
Have a nice day :)

Export Identity class

I have a need to be able to cache the signatures once an identity is initially created, and recreate the identity later without the user having to resign. It appears the only way to create an instance of the Identity class is by using Identities.createIdentity() which causes the IdentityProvider to sign the publicKey+id-signature.

Is there any reason why the Identity class can't be exported along with Identities and the providers? This would allow more flexibility for creating an identity using other methods.

Thanks!

Verify each identity only once

Right now every call to verifyIdentity verifies the signature done by the particular identity. In an ipfs-log with a lot of entries done by the same identity this creates a lot of computational overhead.

An easy way to mitigate this is to maintain a cache of identities that have been verified so that each identity (identity + key) only needs to be verified once.

Identity / IdentityProvider

I was looking at the feat/identity PR again. This is how the Identity looks now on the left and how I imagine it could look on the right (sorry for the horrible handwriting):

image

Key

  • publicKey : String | Buffer
  • privateKey : String | Buffer
  • encoding : String (e.g: hex)

The basic Identity object would look like this:

  • id: String
  • key: Key
  • provider : IdentityProvider (?)
  • type: String (eg. ColonyIdentity, Ethereum address, IPFS PeerID, Dat address, DID, even Twitter can be an IdentityProvider)
  • sign: (e: Object) => { key: Key, signature: String }
  • verify : (e: Entry) => boolean
  • (signature) orbitKeyOwnershipProof : String
  • (pkSignature) externalIdentityOwnershipProof : String

sign and verify would be provided by the IdentityProvider so when we create an identity the object get a hold on whatever the implementation is.

This way we don't need to pass the provider to the log but just the identity object which will be responsible for signing and verifying entries (and to provide the necessary info for the AccessController canAppend method).

How does it sound?

Multiple identities

Hey,
I have an array of strings, each string is unique identifier, based on those as id I want to create identity.

My code looks like this:

  for (let index = 0; index < array.length; index++) {
    const string = array[index];
   await IdentityProvider.createIdentity({ id })
}

The first iteration passed, but the second one throws:

/home/app/node_modules/level-packager/node_modules/levelup/lib/levelup.js:119
      return callback(new OpenError(err))

Error [OpenError]: IO error: lock orbitdb/identity/identitykeys/LOCK: already held by process
    at /home/app/node_modules/level-packager/node_modules/levelup/lib/levelup.js:119:23
    at /home/app/node_modules/level-packager/node_modules/abstract-leveldown/abstract-leveldown.js:38:14
    at /home/app/node_modules/level-packager/node_modules/deferred-leveldown/deferred-leveldown.js:31:21
    at /home/app/node_modules/encoding-down/node_modules/abstract-leveldown/abstract-leveldown.js:38:14
    at /home/app/node_modules/leveldown/node_modules/abstract-leveldown/abstract-leveldown.js:38:14
Emitted 'error' event on LevelUP instance at:
    at /home/app/node_modules/level-packager/node_modules/levelup/lib/levelup.js:60:19
    at /home/app/node_modules/level-packager/node_modules/levelup/lib/levelup.js:119:14
    at /home/app/node_modules/level-packager/node_modules/abstract-leveldown/abstract-leveldown.js:38:14

My goal is to use this identity with ipfs-log, to store additional data, then at later point to get the identity, then the ipfs-log and my data.

I saw Level/levelup#667 but still cant figure out how to fix this one. Any ideas?

IdentityProvider type 'ethereum' is not supported

Following the step-by-step, I can connect to my Metamask provider and sign Identity. However, if I try to connect to Orbit-DB using this identity, this is the error I get in Orbit-DB.

2022-01-25T08:08:11.186Z [ERROR] orbit-db: Error: IdentityProvider type 'ethereum' is not supported
    at getHandlerFor (/root/services/orbitDB/node_modules/orbit-db-identity-provider/src/identities.js:19:11)
    at Identities.verifyIdentity (/root/services/orbitDB/node_modules/orbit-db-identity-provider/src/identities.js:92:30)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async saveToIpfs (/root/services/orbitDB/node_modules/orbit-db-store/src/Store.js:317:25)
    at async pEachSeries (/root/services/orbitDB/node_modules/p-each-series/index.js:8:23)
    at async OrbitDB._onMessage (/root/services/orbitDB/node_modules/orbit-db/src/OrbitDB.js:263:11)

orbit-db: 0.28.1
orbit-db-identity-provider: 0.4.0

Implemented with Node.JS

Trouble connecting metamask to the ethereum-identity-provider

I was working through getting Metamask to connect to orbit and ran into some issues connecting the ethereum-identity-provider.

Here's the code I started with based on some examples I found on the ethers.js project. The provider seems to want a "Wallet" object and I couldn't find any examples on how to get one from a web3 provider.

https://gist.github.com/ptoner/ed4b0a46805c218170b76aaa77ea421c

@shamb0t Helped me in the chat room and I found a solution that worked:

let signer = provider.getSigner(0)

signer.address = await signer.getAddress() // the provider is expecting a variable named 'wallet' that has an address property. Signer only has getAddress() and it's async.

let keystore = Keystore.create(keypath)
const type = EthIdentityProvider.type

const options = {
    type: type,
    keystore: keystore,
    wallet: signer 
}


let identity = await Identities.createIdentity(options)


const orbitdb = await OrbitDB.createInstance(ipfs, {
    directory: "./orbitdb",
    identity: identity
})


let store = await orbitdb.feed("test-post", {
    accessController: {
            write: [orbitdb.identity.id] //the examples say this should be "publicKey" instead but I think that might be outdated. This works. 
    }
})

The main thing that needed to change is 'this.wallet.address' to 'this.wallet.getAddress()' here

I'll put together a PR with this change. I'm unsure if the "orbitdb.identity.id" change would impact other identity providers though.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.