1"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[3485],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>m});var r=n(7294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function s(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?i(Object(n),!0).forEach((function(t){o(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function a(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var c=r.createContext({}),l=function(e){var t=r.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):s(s({},t),e)),n},p=function(e){var t=l(e.components);return r.createElement(c.Provider,{value:t},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},y=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,i=e.originalType,c=e.parentName,p=a(e,["components","mdxType","originalType","parentName"]),u=l(n),y=o,m=u["".concat(c,".").concat(y)]||u[y]||d[y]||i;return n?r.createElement(m,s(s({ref:t},p),{},{components:n})):r.createElement(m,s({ref:t},p))}));function m(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var i=n.length,s=new Array(i);s[0]=y;var a={};for(var c in t)hasOwnProperty.call(t,c)&&(a[c]=t[c]);a.originalType=e,a[u]="string"==typeof e?e:o,s[1]=a;for(var l=2;l<i;l++)s[l]=n[l];return r.createElement.apply(null,s)}return r.createElement.apply(null,n)}y.displayName="MDXCreateElement"},1447:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>c,default:()=>m,frontMatter:()=>a,metadata:()=>l,toc:()=>u});var r=n(7462),o=n(3366),i=(n(7294),n(3905)),s=["components"],a={title:"Setup"},c=void 0,l={unversionedId:"sdk/general/connectivity/guides/setup",id:"sdk/general/connectivity/guides/setup",title:"Setup",description:"The following guides describe interactive operations that can occur within the Elastos decentralized world, in addition to several ways to customize the Connectivity SDK according to your needs.",source:"@site/../docs/7.sdk/general/connectivity/guides/setup.md",sourceDirName:"7.sdk/general/connectivity/guides",slug:"/sdk/general/connectivity/guides/setup",permalink:"/sdk/general/connectivity/guides/setup",draft:!1,editUrl:"https://github.com/elastos/Elastos.Wiki/edit/master/website/../docs/7.sdk/general/connectivity/guides/setup.md",tags:[],version:"current",lastUpdatedBy:"racollette",lastUpdatedAt:1676425989,formattedLastUpdatedAt:"Feb 15, 2023",frontMatter:{title:"Setup"},sidebar:"sdkSidebar",previous:{title:"Introduction",permalink:"/sdk/general/connectivity/introduction"},next:{title:"Decentralized Identity",permalink:"/sdk/general/connectivity/guides/did"}},p={},u=[{value:"Connectivity SDK Setup",id:"connectivity-sdk-setup",level:2},{value:"Setup the SDK",id:"setup-the-sdk",level:3},{value:"Register at Least One Connector",id:"register-at-least-one-connector",level:3}],d={toc:u},y="wrapper";function m(e){var t=e.components,n=(0,o.Z)(e,s);return(0,i.kt)(y,(0,r.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("p",null,"The following guides describe ",(0,i.kt)("strong",{parentName:"p"},"interactive operations")," that can occur within the Elastos decentralized world, in addition to several ways to ",(0,i.kt)("strong",{parentName:"p"},"customize")," the Connectivity SDK according to your needs."),(0,i.kt)("h2",{id:"connectivity-sdk-setup"},"Connectivity SDK Setup"),(0,i.kt)("h3",{id:"setup-the-sdk"},"Setup the SDK"),(0,i.kt)("p",null,"Start by installing the SDK for your platform."),(0,i.kt)("p",null,"Because ",(0,i.kt)("strong",{parentName:"p"}
1,"the Connectivity SDK requires at least one connector to work with"),", we'll use the Elastos Essentials connector for this guide. For more information about this connector, refer to the ",(0,i.kt)("a",{parentName:"p",href:"https://essentials-docs.trinity-tech.io/"},"Elastos Essentials documentation"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"# Connectivity SDK\nnpm install @elastosfoundation/elastos-connectivity-sdk-js\n\n# Use at least one connector\nnpm install @elastosfoundation/essentials-connector-client-browser\n\n# Use the DID SDK as it's needed for most interactive operations\nnpm install @elastosfoundation/did-js-sdk\n")),(0,i.kt)("h3",{id:"register-at-least-one-connector"},"Register at Least One Connector"),(0,i.kt)("p",null,"Let's register the Elastos Essentials Connector as an initial example. You can choose to use one or more connectors in your application."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},'import { connectivity } from "@elastosfoundation/elastos-connectivity-sdk-js";\n\nlet essentialsConnector = new EssentialsConnector();\n\n// Let the connectivity SDK know that we are willing to use this connector.\nconnectivity.registerConnector(essentialsConnector);\n')),(0,i.kt)("admonition",{title:"Note on using multiple connectors",type:"tip"},(0,i.kt)("p",{parentName:"admonition"},"In case multiple connectors are registered, interactive operations first prompt users to choose their preferred connector to execute the operation.")))}m.isMDXComponent=!0}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.