I have some doubts with how to use hyperledger composer in production.
I need to create apis using hyperledger composer which will be used by our front end application which is not of angular js.
I have rest points authenticated with passport-jwt so I need to
have one card to access the network. So do I need to pass that card
to front end? And how will front end will connect to network with
that card to generate more participants and manage whole
application?
Where do we need to store cards for created users?
In our database or we need to share cards to end user?
How can we
create our own custom api using hyperledger composer?
You need to enable authentication in REST server.
export COMPOSER_CARD=name of your card that will be used to start the REST server
export COMPOSER_AUTHENTICATION=true
export COMPOSER_PROVIDERS='{
"github":{
},
...
}'
Also you need to switch on REST server Multi-user mode.
export COMPOSER_MULTIUSER=true
export COMPOSER_DATASOURCES='{
"db":{
"name":"db",
"host":"hostname",
"port":port number,
"database":"database name",
"user":"login",
"password":"password",
"connector":"mongodb"
}
}'
and then start the REST server
composer-rest-server
Now the composer REST server will start with the card COMPOSER_CARD with authentication and Multi-user enabled.
If you now visit http://localhost:3000 you will find a new set of APIs "Wallet". Here the wallet functions are defined.
Now the steps for the user will be as follows:
System Admin creates your participant card and issue identity. He sends you the .card file to you.Or your application must have a process to send your card file as email attachment.
He/she authenticates himself with Google or some other provider (what is configured in REST server).
Capture the token returned from that OAuth
Use that Token and call the REST web service /wallet/import to upload his card to be stored in the MongoDB. While uploading make sure that the Card name you input is exactly same as your card name.
Now call any other core application Web Services. REST web service will use your uploaded card details to call the web service.
Hence even if you started the REST server with COMPOSER_CARD it is using your actual card to execute Web services.
Hope this clarifies.
Also you can go through the actual document related to this one for better understanding:
https://hyperledger.github.io/composer/latest/tutorials/google_oauth2_rest
Related
I want to build a project where a user will be able to press on a button to authorize my platform to access their data (e.g shopify data). When my platform has access (to their shopify platform) it will send that data to my database.
My questions is:
In order for my rest api to access the data (from e.g shopify platform) i have to give the rest api the api key of the user which is simple if it a single account, but when i have multiple users using the same rest api how should i handle it? How can i give the rest api the access code so it can pull the data (from e.g their shopify platform) for each user? What is the name of the technology that needs to be considered here?
I am a built lost on the terminology of my question which has given me a bit of a headache when trying to google it.
First off, you create an App that Shopify approves, and then your merchant customers would install this App in their store. That approval process by both Shopify and the merchant means you are given permission to access their Shopify data.
Next, you create some value by allowing the merchant to see their data in ways unique to what it is you are doing. So far, your database contains nothing but the name of the store and the access token with permission to access the Shopify API.
How you then proceed in your own App is up to you. Not much else to it really, if you already know what your value add is. Code that part up and you're done!
How should I allow external application users(that do not run nodes on the network) to allow using an hyperledger fabric app ? How are the identified in the network ?
You could provide a REST API as the gateway to the blockchain network. Depending on how much you want to lock down functionality, you could refine the REST URLs to divert to different users in the wallet so that perhaps some might have read only access and others might have higher levels. You can set up the contract code to recognise which user is currently trying to perform an action and take steps to restrict them more. It all depends on your requirements. The external users could be given access to URLs specific to their organisations which would seek to access blockchain through a wallet dedicated to such an organisation. Therefore, there is no possibiity of crossover with other orgnisations.
If you are developing using Node.js, it is very easy and quick to set up an example REST API using Express.
I am learning React Native by creating a clone of Instagram (Strictly Local Development). I want to use the Instagram API to get some real time data for my app. I tried registering as Instagram Developer but its asking me for the website and policy page of the website, which I don't have. Is it possible to use Instagram API for learning purpose, if so can you give me the steps for ding it??
Yes, you can. I think you're already in the right way. All you need to do is just integrate things up and follow all the steps in the Instagram Developer website.
You are not required to have policy page or anything to use the sandbox, but you will need it later on if you want to use the API in the production state of your app.
You will need to create an app in the developer site, and generate your access token. Then, add a sandbox user (your Instagram account) and start to use the User Endpoint to retrieve your user data (such as your bio, follower count, etc.) and media (this is what you want, your Instagram post feed).
Hope this helps.
I have created participants using the node CLI and Business Network Connection. I have also assigned them with an identity.
Now; is it possible to use this identity to launch the composer-rest-server as this participant? E.g. could this be turn into a card that I can import and use? I have the userSecret saved.
see answer here -> How to create participant , there identities via rest api that generated by composer rest server without importing cards via /importwallets?
for more detail.
But yes - you can use that BUSINESS NETWORK card (eg. like: restadmin#my-network) as the 'identity' (because the identity's cert/key are part of the BN card that connects the business network, when you use it to launch your REST server instance). So that would be an administrative id that's used to launch a REST server.
Then (therafter), any standard blockchain identities could come along and USE the REST API client (eg. after authenticating, etc etc) - that's why you've stood up the REST server instance :0-) - each REST client user, will connect to the REST server with their own BN cards (and again, containing its own identity cert/key, and which is mapped to a participant in the Composer business network) and that user's card would be imported into the users REST API Wallet to then use to interact with the deployed business network as that identity.
How do you store permanent data in a Slack Application?
For example, the Opsidian slack app has a command to add your AWS keys. Where does it store those keys and how does it know to use specific keys for specific teams?
Is this on the Opsidian side? If that's the case does it just use the team.info endpoint and use that every command to match it up?
I have searched their documentation and Google with no luck.
A slack app usually consists of program code (e.g. PHP) and a database (e.g. MySQL) that runs on a server and interfaces with Slack through one of the APIs. All Slack team specific information is stored in a custom datadase using the unique team ID as key. The server needs to be accessible from the Internet, so that Slack can communicate with it. The server to run the program code of the app and the custom database for the app is not provided by Slack, but needs to be setup and maintained by the Slack app developer.
Slack itself only stores the basic configuration for an app (everything you see under "Your apps", e.g. Validation token) and some basic configuration per team after installation (e.g. That an app is installed and who installed it). Any other application specific information has to be stored by the app itself in its database.
The Slack app developer also needs to provide a custom website to allow installation of a Slack app for a team. See this answer for more info about the installation process and how to obtain a team specific access token.