blob: 4d2cfb4ee3b9e1e1d93b781f5e4ba3da4cf8b356 [file] [log] [blame]
<!DOCTYPE html><html lang="en"><head><meta charSet="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><title>D-TA Plugins Developers Guide · Apache Milagro</title><meta name="viewport" content="width=device-width, initial-scale=1.0"/><meta name="generator" content="Docusaurus"/><meta name="description" content="We have provided a template plugin that provides the same functionality as out-of-the-box milagro."/><meta name="docsearch:language" content="en"/><meta property="og:title" content="D-TA Plugins Developers Guide · Apache Milagro"/><meta property="og:type" content="website"/><meta property="og:url" content="https://milagro.apache.org/"/><meta property="og:description" content="We have provided a template plugin that provides the same functionality as out-of-the-box milagro."/><meta name="twitter:card" content="summary"/><link rel="shortcut icon" href="/img/favicon.ico"/><link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/default.min.css"/><link rel="alternate" type="application/atom+xml" href="https://milagro.apache.org/blog/atom.xml" title="Apache Milagro Blog ATOM Feed"/><link rel="alternate" type="application/rss+xml" href="https://milagro.apache.org/blog/feed.xml" title="Apache Milagro Blog RSS Feed"/><script type="text/javascript" src="https://buttons.github.io/buttons.js"></script><script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js?config=TeX-MML-AM_CHTML"></script><script src="/js/scrollSpy.js"></script><link rel="stylesheet" href="/css/main.css"/><script src="/js/codetabs.js"></script></head><body class="sideNavVisible separateOnPageNav"><div class="fixedHeaderContainer"><div class="headerWrapper wrapper"><header><a href="/"><img class="logo" src="/img/milagro.svg" alt="Apache Milagro"/><h2 class="headerTitleWithLogo">Apache Milagro</h2></a><div class="navigationWrapper navigationSlider"><nav class="slidingNav"><ul class="nav-site nav-site-internal"><li class=""><a href="/docs/milagro-intro" target="_self">Docs</a></li><li class=""><a href="/docs/support" target="_self">Support</a></li><li class=""><a href="/docs/contributor-guide" target="_self">Contributing</a></li><li class=""><a href="/docs/downloads" target="_self">Downloads</a></li><li class=""><a href="/blog/" target="_self">Status</a></li></ul></nav></div></header></div></div><div class="navPusher"><div class="docMainWrapper wrapper"><div class="container mainContainer docsContainer"><div class="wrapper"><div class="post"><header class="postHeader"><h1 id="__docusaurus" class="postHeaderTitle">D-TA Plugins Developers Guide</h1></header><article><div><span><p>We have provided a template plugin that provides the same functionality as out-of-the-box milagro.</p>
<h2><a class="anchor" aria-hidden="true" id="developer-notes"></a><a href="#developer-notes" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Developer Notes</h2>
<p>You need to install protobufs</p>
<p>If you change the portobufs definition run</p>
<p>$ protoc -I=. --go_out=. ./docs.proto</p>
<p>To add a new endpoint to the goKit Microservices framework</p>
<ol>
<li>First define the contract in milagro/pkg/milagroservice/proto.go</li>
</ol>
<p>Add structs for http transport
Add responses to milagro/swagger/swagger.config,yaml</p>
<ol start="2">
<li>Add and endpoint definition</li>
</ol>
<p>milagro/pkg/milagroendpoints/endpoints.go</p>
<ol start="3">
<li>Create a handler factory</li>
</ol>
<p><strong>Thise instructions still aren't perfect</strong></p>
<ol>
<li>Clone the repo and make sure that it works by following the <a href="/docs/dta-details/quickstart">Quick Start</a> instructions</li>
<li>Copy the plugin template</li>
</ol>
<pre><code class="hljs"><span class="hljs-keyword">cp</span> -r pkg/plugintemplate pkg/encryptastring
</code></pre>
<ol start="3">
<li>Rename the package and service
on a mac you could do this...</li>
</ol>
<pre><code class="hljs">sed -<span class="hljs-selector-tag">i</span> <span class="hljs-string">""</span> <span class="hljs-string">"s/template/encryptastring/g"</span> pkg/encryptastring/service<span class="hljs-selector-class">.go</span>
</code></pre>
<ol start="4">
<li>Now create a plugin regsitration file</li>
</ol>
<pre><code class="hljs">sed -<span class="hljs-selector-tag">i</span> <span class="hljs-string">""</span> <span class="hljs-string">"s/plugintemplate/encryptastring/g"</span> plugins/encryptastring<span class="hljs-selector-class">.go</span>
sed -<span class="hljs-selector-tag">i</span> <span class="hljs-string">""</span> <span class="hljs-string">"s/pluginTemplate/encryptAString/g"</span> plugins/encryptastring<span class="hljs-selector-class">.go</span>
</code></pre>
<ol start="5">
<li>Update the Config File</li>
</ol>
<pre><code class="hljs"><span class="hljs-attr">nano</span> <span class="hljs-string">~/.milagro/config.yaml</span>
<span class="hljs-attr">update....</span>
<span class="hljs-attr">plugins</span>:<span class="hljs-string"></span>
<span class="hljs-attr">service</span>: <span class="hljs-string">encryptastring</span>
</code></pre>
<ol start="6">
<li>See your plugin in action!</li>
</ol>
<pre><code class="hljs">go build -o target<span class="hljs-built_in">/service </span>github.com/apache/incubator-milagro-dta/cmd<span class="hljs-built_in">/service
</span>target<span class="hljs-built_in">/service
</span></code></pre>
<p>Point your browser at:
<a href="http://localhost:5555/status">http://localhost:5555/status</a></p>
<p>you should see</p>
</span></div></article></div><div class="docs-prevnext"></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#developer-notes">Developer Notes</a></li></ul></nav></div><footer class="nav-footer" id="footer"><section class="sitemap"><a href="/" class="nav-home"><img src="/img/milagro.svg" alt="Apache Milagro" width="50" height="100"/></a><div><h5>Docs</h5><a href="/docs/milagro-intro.html">Milagro Intro</a><a href="/docs/amcl-overview.html">Apache Milagro Crypto Library</a><a href="/docs/d-ta-overview.html">Decentralized Trust Authority</a><a href="/docs/zkp-mfa-overview.html">Zero Knowledge Proof MFA</a></div><div><h5>Community</h5><a href="../docs/support">Support</a><a href="../docs/contributor-guide">Contributing</a><a href="https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=115529045" target="_blank" rel="noreferrer noopener">Developer Wiki</a><a href="https://twitter.com/apachemilagro?lang=en" target="_blank" rel="noreferrer noopener">Twitter</a></div><div><h5>More</h5><a href="/blog">Status</a><a href="https://github.com/apache/incubator-milagro-crypto-c">GitHub</a><a class="github-button" href="https://github.com/apache/incubator-milagro" data-icon="octicon-star" data-count-href="/apache/incubator-milagro-crypto/stargazers" data-show-count="true" data-count-aria-label="# stargazers on GitHub" aria-label="Star this project on GitHub">Star</a></div></section><a href="https://apache.org" target="_blank" rel="noreferrer noopener" class="fbOpenSource"><img src="/img/oss_logo.png" alt="Apache Incubator" width="170" height="45"/></a><section class="copyright"><div>Apache Milagro is an effort undergoing incubation at The Apache Software Foundation (ASF), sponsored by the Apache Incubator. Incubation is required of all newly accepted projects until a further review indicates that the infrastructure, communications, and decision making process have stabilized in a manner consistent with other successful ASF projects. While incubation status is not necessarily a reflection of the completeness or stability of the code, it does indicate that the project has yet to be fully endorsed by the ASF.</div></section><p></p><section class="copyright">Copyright © 2022 The Apache Software Foundation. Apache Milagro, Milagro, Apache, the Apache feather, and the Apache Milagro project logo are either registered trademarks or trademarks of the Apache Software Foundation.</section></footer></div></body></html>