Back
Featured image of post Instalando Indy SDK para Node.js por primera vez en Ubuntu 21.04

Instalando Indy SDK para Node.js por primera vez en Ubuntu 21.04

Guia completa que explica paso a paso cómo instalar y configurar el SDK de Indy por primera vez para el desarrollo de apps en Node.js

Table of Content

Guía completa que explica paso a paso cómo instalar y configurar el SDK de Indy por primera vez.

¿Que es el SDK de Indy?

Indy SDK es el SDK oficial de Hyperledger Indy, que proporciona una base basada en un libro distribuido para la identidad auto-soberana. Indy proporciona un ecosistema de software para la identidad privada, segura y robusta, y el SDK de Indy hace posible diseñar clientes que lo utilicen. El principal artefacto del SDK es una biblioteca que se puede llamar desde diferentes lenguajes de programación como si de una librería en C se tratase; también hay envolturas de conveniencia para varios lenguajes de programación y la herramienta Indy CLI.

Elementos incluidos en este SDK

libindy

El principal artefacto del SDK es una biblioteca invocable en C que proporciona los bloques de construcción básicos para la creación de aplicaciones sobre Hyperledger Indy. Está disponible para las plataformas de escritorio, móviles y de servidor más populares.

Envoltorios o Wrappers de Libindy

Un conjunto de envoltorios libindy para desarrollar aplicaciones basadas en Indy en su lenguaje de programación favorito. El SDK de Indy proporciona envolturas libindy para los siguientes lenguajes de programación y plataformas:

  • Java
  • Python
  • iOS
  • NodeJS
  • .Net
  • Rust

Indy CLI

Indy CLI es la interfaz oficial de línea de comandos que ayuda a los desarrolladores y administradores de Indy.

Libnullpay

Libnullpay es un plugin de libindy que puede ser utilizado para el desarrollo de aplicaciones que utilizan la API de pagos del SDK de Indy.

Libvcx

Libvcx es una librería con capacidad de llamada en c construida sobre libindy que proporciona un protocolo de intercambio de credenciales de alto nivel. Simplifica la creación de aplicaciones de agentes y proporciona una mejor interoperabilidad agente-2-agente para la infraestructura Hyperledger Indy.

Esta biblioteca se encuentra actualmente en estado experimental y no forma parte de las versiones oficiales.

Perfecto!! 👏👏👏. Ahora que conocemos las diferentes partes del SDK, vamos a ver cómo podemos instalarlo en nuestro ordenador desde cero.

Requisitos previos a la instalación

Para la instalación los únicos requisitos serán:

  • Contar con un ordenador/servidor con Linux o algún derivado (Centos, Fedora, Debian, etc)
  • Conexión a Internet.

Como yo ya lo tengo instalado, voy a realizar una instalación limpia dentro de un contenedor docker linux con una imagen base de Ubuntu

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
docker run -it --entrypoint=sh ubuntu:21.04
Unable to find image 'ubuntu:21.04' locally
21.04: Pulling from library/ubuntu
c830499a6a92: Pull complete 
b38f134463e2: Pull complete 
2fd6a415fd8e: Pull complete 
Digest: sha256:be154cc2b1211a9f98f4d708f4266650c9129784d0485d4507d9b0fa05d928b6
Status: Downloaded newer image for ubuntu:21.04
#
root@33d565de992e:~# lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 21.04
Release:	21.04
Codename:	hirsute

Instalación de los requisitos de libindy

Para instalar la librería libindy, en nuestro sistema se requiere ejecutar

1
apt install -y gnupg sudo software-properties-common

Si ya se tienen los paquetes instalados, el paso anterior se puede obviar.

Después de ello, podremos añadir el repositorio oficial de Sovrin a nuestro sistema

1
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys CE7709D068DB5E88

El resultado de añadir la clave correctamente es

1
2
3
4
5
Warning: apt-key is deprecated. Manage keyring files in trusted.gpg.d instead (see apt-key(8)).
Executing: /tmp/apt-key-gpghome.pihgNovR0A/gpg.1.sh --keyserver keyserver.ubuntu.com --recv-keys CE7709D068DB5E88
gpg: key CE7709D068DB5E88: public key "Sovrin-Repo-Master (Master key for repo.sovring.org) <repo@sovrin.org>" imported
gpg: Total number processed: 1
gpg:               imported: 1

Instalación y descarga de libindy

Ahora, una vez que se cumplen con los requisitos, se puede añadir el repositorio y actualizar los índices de los paquetes locales.

1
2
sudo add-apt-repository "deb https://repo.sovrin.org/sdk/deb bionic stable"
sudo apt-get update

Finalmente, se instala libindy

1
sudo apt-get install -y libindy

Verificación de libindy

Si todo se ha instalado correctamente vereis el mensaje

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
...
Unpacking libindy (1.16.0-bionic) ...
Setting up libsodium23:amd64 (1.0.18-1) ...
Setting up libpgm-5.3-0:amd64 (5.3.128~dfsg-2) ...
Setting up libnorm1:amd64 (1.5.9+dfsg-2) ...
Setting up libmd0:amd64 (1.0.3-3build1) ...
Setting up libbsd0:amd64 (0.11.3-1ubuntu2) ...
Setting up libzmq5:amd64 (4.3.4-1) ...
Setting up libindy (1.16.0-bionic) ...
deb https://repo.sovrin.org/sdk/deb hirsute stable
Processing triggers for libc-bin (2.33-0ubuntu5) ...

donde se indica perfectamente que libindy se ha instalado en su version 1.16.0-bionic junto con el resto de dependencias necesarias.

Otra forma que existe de verificar si libindy ha sido instalado correctamente es verificar si la librería se ha instalado en el path /usr/lib/ y que existe el fichero /usr/lib/libindy.so.

1
2
root@33d565de992e:~# ls -alh /usr/lib/libindy.so 
-rw-r--r-- 1 root root 11M Feb 20 18:52 /usr/lib/libindy.so

En mi caso, vemos que la ubicación es correcta y que la librería ocupa 11 Mb. Por lo tanto, todo correcto! 👍👍

Instalación de los requisitos de indy-sdk para Node.js

Para instalar el SDK de NodeJS, se requieren las siguientes dependencias directas e indirectas:

  • curl
  • nvm

Tanto curl como nvm se instalan mediante

1
2
3
apt update
apt install -y curl
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash
1
2
3
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"  # This loads nvm bash_completion

Una vez ambas instaladas, instalamos la versión de node que necesita libindy según su documentación, que indica $node >= 8$

1
2
3
4
5
6
7
8
root@33d565de992e:/# nvm install v8.10.0
Downloading and installing node v8.10.0...
Downloading https://nodejs.org/dist/v8.10.0/node-v8.10.0-linux-x64.tar.gz...
######################################## 100.0%
Computing checksum with sha256sum
Checksums matched!
Now using node v8.10.0 (npm v5.6.0)
Creating default alias: default -> v8.10.0

Si no tenemos la versión v8.10.0 activada, podemos hacerlo con

1
2
root@33d565de992e:/# nvm use v8.10.0
Now using node v8.10.0 (npm v5.6.0)

Una vez instalada, podemos crear un nuevo proyecto de Node e instalar las dependencias necesarias via npm. Para ello:

1
2
3
cd $HOME
mkdir indy-example && cd indy-example
npm init

Después del comando npm init se te pedirá que introduzcas una serie de datos para crear el nuevo proyecto.

Puedes poner datos coherentes, o pulsar ENTER hasta llegar al final.

En cualquier caso, el resultado del contenido del fichero package.json deberá ser similar al siguiente:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
{
  "name": "indy-example",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC"
}

Llegados a este punto podemos proceder a instalar el SDK de indy para Node.js.

Instalar el SDK de Indy para Node.js via indy-sdk

Para instalar indy-sdk de Node.js, podemos hacerlo con el comando

1
npm install --save indy-sdk

Si has llegado hasta aqui, es posible que te de el siguiente error al intentar instalar

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
root@33d565de992e:~# npm install --save indy-sdk
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated har-validator@5.1.5: this library is no longer supported

> indy-sdk@1.15.0-dev-1628 install /root/node_modules/indy-sdk
> node-gyp rebuild

gyp ERR! configure error 
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.
gyp ERR! stack     at PythonFinder.failNoPython (/root/.nvm/versions/node/v8.10.0/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:483:19)
gyp ERR! stack     at PythonFinder.<anonymous> (/root/.nvm/versions/node/v8.10.0/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:397:16)
gyp ERR! stack     at F (/root/.nvm/versions/node/v8.10.0/lib/node_modules/npm/node_modules/which/which.js:68:16)
gyp ERR! stack     at E (/root/.nvm/versions/node/v8.10.0/lib/node_modules/npm/node_modules/which/which.js:80:29)
gyp ERR! stack     at /root/.nvm/versions/node/v8.10.0/lib/node_modules/npm/node_modules/which/which.js:89:16
gyp ERR! stack     at /root/.nvm/versions/node/v8.10.0/lib/node_modules/npm/node_modules/which/node_modules/isexe/index.js:42:5
gyp ERR! stack     at /root/.nvm/versions/node/v8.10.0/lib/node_modules/npm/node_modules/which/node_modules/isexe/mode.js:8:5
gyp ERR! stack     at FSReqWrap.oncomplete (fs.js:152:21)
gyp ERR! System Linux 4.15.0-142-generic
gyp ERR! command "/root/.nvm/versions/node/v8.10.0/bin/node" "/root/.nvm/versions/node/v8.10.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /root/node_modules/indy-sdk
gyp ERR! node -v v8.10.0
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok 
npm WARN root@1.0.0 No description
npm WARN root@1.0.0 No repository field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! indy-sdk@1.15.0-dev-1628 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the indy-sdk@1.15.0-dev-1628 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2021-04-29T19_21_32_586Z-debug.log

El error anterior basicamente significa que te falta por instalar python. Para solucionarlo basta con instalar alguna de las versiones recomendadas por Hyperledger Indy. De momento la version recomendada es Python 2.

Instalar Python 2 para resolver el error

Para resolver el error anterior, instalaremos Python 2 con el comando

1
sudo apt install -y python

Verificar que Python 2 se instala correctamente

Para verificar que Python 2 se ha instalado correctamente

1
2
root@33d565de992e:~# python --version
Python 2.7.18

Una vez instalado Python 2, se ejecuta el proceso de instalación de indy-sdk de nuevo.

Instalar C++ Build tools

Si a pesar de instalar Python 2 se siguen recibiendo errores como este

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
root@33d565de992e:~# npm install --save indy-sdk
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated har-validator@5.1.5: this library is no longer supported

> indy-sdk@1.15.0-dev-1628 install /root/node_modules/indy-sdk
> node-gyp rebuild

gyp ERR! build error 
gyp ERR! stack Error: not found: make
gyp ERR! stack     at getNotFoundError (/root/.nvm/versions/node/v8.10.0/lib/node_modules/npm/node_modules/which/which.js:13:12)
gyp ERR! stack     at F (/root/.nvm/versions/node/v8.10.0/lib/node_modules/npm/node_modules/which/which.js:68:19)
gyp ERR! stack     at E (/root/.nvm/versions/node/v8.10.0/lib/node_modules/npm/node_modules/which/which.js:80:29)
gyp ERR! stack     at /root/.nvm/versions/node/v8.10.0/lib/node_modules/npm/node_modules/which/which.js:89:16
gyp ERR! stack     at /root/.nvm/versions/node/v8.10.0/lib/node_modules/npm/node_modules/which/node_modules/isexe/index.js:42:5
gyp ERR! stack     at /root/.nvm/versions/node/v8.10.0/lib/node_modules/npm/node_modules/which/node_modules/isexe/mode.js:8:5
gyp ERR! stack     at FSReqWrap.oncomplete (fs.js:152:21)
gyp ERR! System Linux 4.15.0-142-generic
gyp ERR! command "/root/.nvm/versions/node/v8.10.0/bin/node" "/root/.nvm/versions/node/v8.10.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /root/node_modules/indy-sdk
gyp ERR! node -v v8.10.0
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok 
npm WARN root@1.0.0 No description
npm WARN root@1.0.0 No repository field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! indy-sdk@1.15.0-dev-1628 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the indy-sdk@1.15.0-dev-1628 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2021-04-29T19_26_03_607Z-debug.log

Será necesario instalar las herramientas de compilacion de C++. Para ello,

1
sudo apt install -y make gcc g++

Una vez instaladas, ahora si, es el momento de instalar definitivamente y sin más errores indy-sdk. Volvemos a lanzar el comando de instalación

1
npm install --save indy-sdk

Este proceso de instalación compila el SDK para vuestra arquitectura y genera como resultado Release/obj.target/indynodejs/src/indy.o. Es por esta razón que durante el proceso de instalación aparecen Warnings del compilador.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated har-validator@5.1.5: this library is no longer supported

> indy-sdk@1.15.0-dev-1628 install /root/node_modules/indy-sdk
> node-gyp rebuild

make: Entering directory '/root/node_modules/indy-sdk/build'
  CXX(target) Release/obj.target/indynodejs/src/indy.o
In file included from /root/.node-gyp/8.10.0/include/node/node.h:63,
                 from ../../nan/nan.h:56,
                 from ../src/indy.cc:4:
/root/.node-gyp/8.10.0/include/node/v8.h: In static member function 'static void v8::V8::SetAllowCodeGenerationFromStringsCallback(v8::DeprecatedAllowCodeGenerationFromStringsCallback)':
/root/.node-gyp/8.10.0/include/node/v8.h:10229:7: warning: cast between incompatible function types from 'v8::DeprecatedAllowCodeGenerationFromStringsCallback' {aka 'bool (*)(v8::Local<v8::Context>)'} to 'v8::FreshNewAllowCodeGenerationFromStringsCallback' {aka 'bool (*)(v8::Local<v8::Context>, v8::Local<v8::String>)'} [-Wcast-function-type]
10229 |       reinterpret_cast<FreshNewAllowCodeGenerationFromStringsCallback>(
      |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
10230 |           callback));
      |           ~~~~~~~~~
/root/.node-gyp/8.10.0/include/node/v8.h: In static member function 'static void v8::V8::RemoveGCPrologueCallback(v8::GCCallback)':
/root/.node-gyp/8.10.0/include/node/v8.h:10275:7: warning: cast between incompatible function types from 'v8::GCCallback' {aka 'void (*)(v8::GCType, v8::GCCallbackFlags)'} to 'v8::Isolate::GCCallback' {aka 'void (*)(v8::Isolate*, v8::GCType, v8::GCCallbackFlags)'} [-Wcast-function-type]
10275 |       reinterpret_cast<Isolate::GCCallback>(callback));
      |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/root/.node-gyp/8.10.0/include/node/v8.h: In static member function 'static void v8::V8::RemoveGCEpilogueCallback(v8::GCCallback)':
/root/.node-gyp/8.10.0/include/node/v8.h:10282:7: warning: cast between incompatible function types from 'v8::GCCallback' {aka 'void (*)(v8::GCType, v8::GCCallbackFlags)'} to 'v8::Isolate::GCCallback' {aka 'void (*)(v8::Isolate*, v8::GCType, v8::GCCallbackFlags)'} [-Wcast-function-type]
10282 |       reinterpret_cast<Isolate::GCCallback>(callback));
      |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ../../nan/nan.h:56,
                 from ../src/indy.cc:4:
../src/indy.cc: At global scope:
/root/.node-gyp/8.10.0/include/node/node.h:475:7: warning: cast between incompatible function types from 'void (*)(Nan::ADDON_REGISTER_FUNCTION_ARGS_TYPE)' {aka 'void (*)(v8::Local<v8::Object>)'} to 'node::addon_register_func' {aka 'void (*)(v8::Local<v8::Object>, v8::Local<v8::Value>, void*)'} [-Wcast-function-type]
  475 |       (node::addon_register_func) (regfunc),                          \
      |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/root/.node-gyp/8.10.0/include/node/node.h:506:3: note: in expansion of macro 'NODE_MODULE_X'
  506 |   NODE_MODULE_X(modname, regfunc, NULL, 0)  // NOLINT (readability/null_usage)
      |   ^~~~~~~~~~~~~
../src/indy.cc:3833:1: note: in expansion of macro 'NODE_MODULE'
 3833 | NODE_MODULE(indynodejs, InitAll)
      | ^~~~~~~~~~~
In file included from /root/.node-gyp/8.10.0/include/node/node.h:63,
                 from ../../nan/nan.h:56,
                 from ../src/indy.cc:4:
/root/.node-gyp/8.10.0/include/node/v8.h: In instantiation of 'void v8::PersistentBase<T>::SetWeak(P*, typename v8::WeakCallbackInfo<P>::Callback, v8::WeakCallbackType) [with P = node::ObjectWrap; T = v8::Object; typename v8::WeakCallbackInfo<P>::Callback = void (*)(const v8::WeakCallbackInfo<node::ObjectWrap>&)]':
/root/.node-gyp/8.10.0/include/node/node_object_wrap.h:85:78:   required from here
/root/.node-gyp/8.10.0/include/node/v8.h:9253:16: warning: cast between incompatible function types from 'v8::WeakCallbackInfo<node::ObjectWrap>::Callback' {aka 'void (*)(const v8::WeakCallbackInfo<node::ObjectWrap>&)'} to 'Callback' {aka 'void (*)(const v8::WeakCallbackInfo<void>&)'} [-Wcast-function-type]
 9253 |                reinterpret_cast<Callback>(callback), type);
      |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/root/.node-gyp/8.10.0/include/node/v8.h: In instantiation of 'void v8::PersistentBase<T>::SetWeak(P*, typename v8::WeakCallbackInfo<P>::Callback, v8::WeakCallbackType) [with P = Nan::ObjectWrap; T = v8::Object; typename v8::WeakCallbackInfo<P>::Callback = void (*)(const v8::WeakCallbackInfo<Nan::ObjectWrap>&)]':
../../nan/nan_object_wrap.h:65:61:   required from here
/root/.node-gyp/8.10.0/include/node/v8.h:9253:16: warning: cast between incompatible function types from 'v8::WeakCallbackInfo<Nan::ObjectWrap>::Callback' {aka 'void (*)(const v8::WeakCallbackInfo<Nan::ObjectWrap>&)'} to 'Callback' {aka 'void (*)(const v8::WeakCallbackInfo<void>&)'} [-Wcast-function-type]
In file included from /usr/include/string.h:519,
                 from /usr/include/c++/10/cstring:42,
                 from ../../nan/nan.h:60,
                 from ../src/indy.cc:4:
In function 'char* strncpy(char*, const char*, size_t)',
    inlined from 'char* copyCStr(const char*)' at ../src/indy.cc:13:12:
/usr/include/x86_64-linux-gnu/bits/string_fortified.h:95:34: warning: 'char* __builtin_strncpy(char*, const char*, long unsigned int)' output truncated before terminating nul copying as many bytes from a string as its length [-Wstringop-truncation]
   95 |   return __builtin___strncpy_chk (__dest, __src, __len,
      |          ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
   96 |       __glibc_objsize (__dest));
      |       ~~~~~~~~~~~~~~~~~~~~~~~~~   
../src/indy.cc: In function 'char* copyCStr(const char*)':
../src/indy.cc:11:24: note: length computed here
   11 |     size_t len = strlen(original);
      |                  ~~~~~~^~~~~~~~~~
  SOLINK_MODULE(target) Release/obj.target/indynodejs.node
  COPY Release/indynodejs.node
make: Leaving directory '/root/node_modules/indy-sdk/build'
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN root@1.0.0 No description
npm WARN root@1.0.0 No repository field.

+ indy-sdk@1.15.0-dev-1628
added 103 packages in 20.884s
root@33d565de992e:~# 

Lo importante es que el proceso acaba correctamente y nos notifica que de indy-sdk se ha instalado en su version 1.15.0-dev-1628

1
2
+ indy-sdk@1.15.0-dev-1628
added 103 packages in 20.884s

Verificación del SDK de Node.js

Para acabar, será necesario comprobar que efectivamente, la librería de libindy y el indy-sdk se cargan correctamente en nuestra aplicación de Node.js. Este funcionamiento lo comprobaremos mediante un sencillo ejemplo. Para ello crearemos un fichero llamado example.js y añadiremos el siguiente contenido:

1
2
3
4
"use strict";

const indy = require('indy-sdk');
console.log(indy);

Si tenemos todo correctamente instalado, a la hora de ejecutar el fichero example.js veremos la siguiente salida por consola

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
{ capi: 
   { issuerCreateSchema: [Function],
     issuerCreateAndStoreCredentialDef: [Function],
     issuerRotateCredentialDefStart: [Function],
     issuerRotateCredentialDefApply: [Function],
     issuerCreateAndStoreRevocReg: [Function],
     issuerCreateCredentialOffer: [Function],
     issuerCreateCredential: [Function],
     issuerRevokeCredential: [Function],
     issuerMergeRevocationRegistryDeltas: [Function],
     proverCreateMasterSecret: [Function],
     proverCreateCredentialReq: [Function],
     proverStoreCredential: [Function],
     proverGetCredentials: [Function],
     proverGetCredential: [Function],
     proverSearchCredentials: [Function],
     proverFetchCredentials: [Function],
     proverCloseCredentialsSearch: [Function],
     proverGetCredentialsForProofReq: [Function],
     proverSearchCredentialsForProofReq: [Function],
     proverFetchCredentialsForProofReq: [Function],
     proverCloseCredentialsSearchForProofReq: [Function],
     proverDeleteCredential: [Function],
     proverCreateProof: [Function],
     verifierVerifyProof: [Function],
     createRevocationState: [Function],
     updateRevocationState: [Function],
     generateNonce: [Function],
     toUnqualified: [Function],
     openBlobStorageReader: [Function],
     openBlobStorageWriter: [Function],
     createKey: [Function],
     setKeyMetadata: [Function],
     getKeyMetadata: [Function],
     cryptoSign: [Function],
     cryptoVerify: [Function],
     cryptoAuthCrypt: [Function],
     cryptoAuthDecrypt: [Function],
     cryptoAnonCrypt: [Function],
     cryptoAnonDecrypt: [Function],
     packMessage: [Function],
     unpackMessage: [Function],
     createAndStoreMyDid: [Function],
     replaceKeysStart: [Function],
     replaceKeysApply: [Function],
     storeTheirDid: [Function],
     keyForDid: [Function],
     keyForLocalDid: [Function],
     setEndpointForDid: [Function],
     getEndpointForDid: [Function],
     setDidMetadata: [Function],
     getDidMetadata: [Function],
     getMyDidWithMeta: [Function],
     listMyDidsWithMeta: [Function],
     abbreviateVerkey: [Function],
     qualifyDid: [Function],
     signAndSubmitRequest: [Function],
     submitRequest: [Function],
     submitAction: [Function],
     signRequest: [Function],
     multiSignRequest: [Function],
     buildGetDdoRequest: [Function],
     buildNymRequest: [Function],
     buildAttribRequest: [Function],
     buildGetAttribRequest: [Function],
     buildGetNymRequest: [Function],
     parseGetNymResponse: [Function],
     buildSchemaRequest: [Function],
     buildGetSchemaRequest: [Function],
     parseGetSchemaResponse: [Function],
     buildCredDefRequest: [Function],
     buildGetCredDefRequest: [Function],
     parseGetCredDefResponse: [Function],
     buildNodeRequest: [Function],
     buildGetValidatorInfoRequest: [Function],
     buildGetTxnRequest: [Function],
     buildPoolConfigRequest: [Function],
     buildPoolRestartRequest: [Function],
     buildPoolUpgradeRequest: [Function],
     buildRevocRegDefRequest: [Function],
     buildGetRevocRegDefRequest: [Function],
     parseGetRevocRegDefResponse: [Function],
     buildRevocRegEntryRequest: [Function],
     buildGetRevocRegRequest: [Function],
     parseGetRevocRegResponse: [Function],
     buildGetRevocRegDeltaRequest: [Function],
     parseGetRevocRegDeltaResponse: [Function],
     buildAuthRuleRequest: [Function],
     buildAuthRulesRequest: [Function],
     buildGetAuthRuleRequest: [Function],
     buildTxnAuthorAgreementRequest: [Function],
     buildDisableAllTxnAuthorAgreementsRequest: [Function],
     buildGetTxnAuthorAgreementRequest: [Function],
     buildAcceptanceMechanismsRequest: [Function],
     buildGetAcceptanceMechanismsRequest: [Function],
     buildLedgersFreezeRequest: [Function],
     buildGetFrozenLedgersRequest: [Function],
     appendTxnAuthorAgreementAcceptanceToRequest: [Function],
     appendRequestEndorser: [Function],
     getResponseMetadata: [Function],
     addWalletRecord: [Function],
     updateWalletRecordValue: [Function],
     updateWalletRecordTags: [Function],
     addWalletRecordTags: [Function],
     deleteWalletRecordTags: [Function],
     deleteWalletRecord: [Function],
     getWalletRecord: [Function],
     openWalletSearch: [Function],
     fetchWalletSearchNextRecords: [Function],
     closeWalletSearch: [Function],
     getSchema: [Function],
     getCredDef: [Function],
     purgeSchemaCache: [Function],
     purgeCredDefCache: [Function],
     isPairwiseExists: [Function],
     createPairwise: [Function],
     listPairwise: [Function],
     getPairwise: [Function],
     setPairwiseMetadata: [Function],
     createPaymentAddress: [Function],
     listPaymentAddresses: [Function],
     addRequestFees: [Function],
     parseResponseWithFees: [Function],
     buildGetPaymentSourcesRequest: [Function],
     buildGetPaymentSourcesWithFromRequest: [Function],
     parseGetPaymentSourcesResponse: [Function],
     parseGetPaymentSourcesWithFromResponse: [Function],
     buildPaymentReq: [Function],
     parsePaymentResponse: [Function],
     preparePaymentExtraWithAcceptanceData: [Function],
     buildMintReq: [Function],
     buildSetTxnFeesReq: [Function],
     buildGetTxnFeesReq: [Function],
     parseGetTxnFeesResponse: [Function],
     buildVerifyPaymentReq: [Function],
     parseVerifyPaymentResponse: [Function],
     createPoolLedgerConfig: [Function],
     getRequestInfo: [Function],
     signWithAddress: [Function],
     verifyWithAddress: [Function],
     openPoolLedger: [Function],
     refreshPoolLedger: [Function],
     listPools: [Function],
     closePoolLedger: [Function],
     deletePoolLedgerConfig: [Function],
     setProtocolVersion: [Function],
     createWallet: [Function],
     openWallet: [Function],
     exportWallet: [Function],
     importWallet: [Function],
     closeWallet: [Function],
     deleteWallet: [Function],
     generateWalletKey: [Function],
     setRuntimeConfig: [Function],
     getCurrentError: [Function],
     setDefaultLogger: [Function],
     setLogger: [Function],
     path: '/root/node_modules/indy-sdk/build/Release/indynodejs.node' },
  setRuntimeConfig: [Function: setRuntimeConfig],
  setDefaultLogger: [Function: setDefaultLogger],
  setLogger: [Function: setLogger],
  issuerCreateSchema: [Function: issuerCreateSchema],
  issuerCreateAndStoreCredentialDef: [Function: issuerCreateAndStoreCredentialDef],
  issuerRotateCredentialDefStart: [Function: issuerRotateCredentialDefStart],
  issuerRotateCredentialDefApply: [Function: issuerRotateCredentialDefApply],
  issuerCreateAndStoreRevocReg: [Function: issuerCreateAndStoreRevocReg],
  issuerCreateCredentialOffer: [Function: issuerCreateCredentialOffer],
  issuerCreateCredential: [Function: issuerCreateCredential],
  issuerRevokeCredential: [Function: issuerRevokeCredential],
  issuerMergeRevocationRegistryDeltas: [Function: issuerMergeRevocationRegistryDeltas],
  proverCreateMasterSecret: [Function: proverCreateMasterSecret],
  proverCreateCredentialReq: [Function: proverCreateCredentialReq],
  proverStoreCredential: [Function: proverStoreCredential],
  proverGetCredentials: [Function: proverGetCredentials],
  proverGetCredential: [Function: proverGetCredential],
  proverSearchCredentials: [Function: proverSearchCredentials],
  proverFetchCredentials: [Function: proverFetchCredentials],
  proverCloseCredentialsSearch: [Function: proverCloseCredentialsSearch],
  proverGetCredentialsForProofReq: [Function: proverGetCredentialsForProofReq],
  proverSearchCredentialsForProofReq: [Function: proverSearchCredentialsForProofReq],
  proverFetchCredentialsForProofReq: [Function: proverFetchCredentialsForProofReq],
  proverCloseCredentialsSearchForProofReq: [Function: proverCloseCredentialsSearchForProofReq],
  proverDeleteCredential: [Function: proverDeleteCredential],
  proverCreateProof: [Function: proverCreateProof],
  verifierVerifyProof: [Function: verifierVerifyProof],
  createRevocationState: [Function: createRevocationState],
  updateRevocationState: [Function: updateRevocationState],
  generateNonce: [Function: generateNonce],
  toUnqualified: [Function: toUnqualified],
  openBlobStorageReader: [Function: openBlobStorageReader],
  openBlobStorageWriter: [Function: openBlobStorageWriter],
  createKey: [Function: createKey],
  setKeyMetadata: [Function: setKeyMetadata],
  getKeyMetadata: [Function: getKeyMetadata],
  cryptoSign: [Function: cryptoSign],
  cryptoVerify: [Function: cryptoVerify],
  cryptoAuthCrypt: [Function: cryptoAuthCrypt],
  cryptoAuthDecrypt: [Function: cryptoAuthDecrypt],
  cryptoAnonCrypt: [Function: cryptoAnonCrypt],
  cryptoAnonDecrypt: [Function: cryptoAnonDecrypt],
  packMessage: [Function: packMessage],
  unpackMessage: [Function: unpackMessage],
  createAndStoreMyDid: [Function: createAndStoreMyDid],
  replaceKeysStart: [Function: replaceKeysStart],
  replaceKeysApply: [Function: replaceKeysApply],
  storeTheirDid: [Function: storeTheirDid],
  keyForDid: [Function: keyForDid],
  keyForLocalDid: [Function: keyForLocalDid],
  setEndpointForDid: [Function: setEndpointForDid],
  getEndpointForDid: [Function: getEndpointForDid],
  setDidMetadata: [Function: setDidMetadata],
  getDidMetadata: [Function: getDidMetadata],
  getMyDidWithMeta: [Function: getMyDidWithMeta],
  listMyDidsWithMeta: [Function: listMyDidsWithMeta],
  abbreviateVerkey: [Function: abbreviateVerkey],
  qualifyDid: [Function: qualifyDid],
  signAndSubmitRequest: [Function: signAndSubmitRequest],
  submitRequest: [Function: submitRequest],
  submitAction: [Function: submitAction],
  signRequest: [Function: signRequest],
  multiSignRequest: [Function: multiSignRequest],
  buildGetDdoRequest: [Function: buildGetDdoRequest],
  buildNymRequest: [Function: buildNymRequest],
  buildAttribRequest: [Function: buildAttribRequest],
  buildGetAttribRequest: [Function: buildGetAttribRequest],
  buildGetNymRequest: [Function: buildGetNymRequest],
  parseGetNymResponse: [Function: parseGetNymResponse],
  buildSchemaRequest: [Function: buildSchemaRequest],
  buildGetSchemaRequest: [Function: buildGetSchemaRequest],
  parseGetSchemaResponse: [Function: parseGetSchemaResponse],
  buildCredDefRequest: [Function: buildCredDefRequest],
  buildGetCredDefRequest: [Function: buildGetCredDefRequest],
  parseGetCredDefResponse: [Function: parseGetCredDefResponse],
  buildNodeRequest: [Function: buildNodeRequest],
  buildGetValidatorInfoRequest: [Function: buildGetValidatorInfoRequest],
  buildGetTxnRequest: [Function: buildGetTxnRequest],
  buildPoolConfigRequest: [Function: buildPoolConfigRequest],
  buildPoolRestartRequest: [Function: buildPoolRestartRequest],
  buildPoolUpgradeRequest: [Function: buildPoolUpgradeRequest],
  buildRevocRegDefRequest: [Function: buildRevocRegDefRequest],
  buildGetRevocRegDefRequest: [Function: buildGetRevocRegDefRequest],
  parseGetRevocRegDefResponse: [Function: parseGetRevocRegDefResponse],
  buildRevocRegEntryRequest: [Function: buildRevocRegEntryRequest],
  buildGetRevocRegRequest: [Function: buildGetRevocRegRequest],
  parseGetRevocRegResponse: [Function: parseGetRevocRegResponse],
  buildGetRevocRegDeltaRequest: [Function: buildGetRevocRegDeltaRequest],
  parseGetRevocRegDeltaResponse: [Function: parseGetRevocRegDeltaResponse],
  buildAuthRuleRequest: [Function: buildAuthRuleRequest],
  buildAuthRulesRequest: [Function: buildAuthRulesRequest],
  buildGetAuthRuleRequest: [Function: buildGetAuthRuleRequest],
  buildTxnAuthorAgreementRequest: [Function: buildTxnAuthorAgreementRequest],
  buildDisableAllTxnAuthorAgreementsRequest: [Function: buildDisableAllTxnAuthorAgreementsRequest],
  buildGetTxnAuthorAgreementRequest: [Function: buildGetTxnAuthorAgreementRequest],
  buildAcceptanceMechanismsRequest: [Function: buildAcceptanceMechanismsRequest],
  buildGetAcceptanceMechanismsRequest: [Function: buildGetAcceptanceMechanismsRequest],
  buildLedgersFreezeRequest: [Function: buildLedgersFreezeRequest],
  buildGetFrozenLedgersRequest: [Function: buildGetFrozenLedgersRequest],
  appendTxnAuthorAgreementAcceptanceToRequest: [Function: appendTxnAuthorAgreementAcceptanceToRequest],
  appendRequestEndorser: [Function: appendRequestEndorser],
  getResponseMetadata: [Function: getResponseMetadata],
  addWalletRecord: [Function: addWalletRecord],
  updateWalletRecordValue: [Function: updateWalletRecordValue],
  updateWalletRecordTags: [Function: updateWalletRecordTags],
  addWalletRecordTags: [Function: addWalletRecordTags],
  deleteWalletRecordTags: [Function: deleteWalletRecordTags],
  deleteWalletRecord: [Function: deleteWalletRecord],
  getWalletRecord: [Function: getWalletRecord],
  openWalletSearch: [Function: openWalletSearch],
  fetchWalletSearchNextRecords: [Function: fetchWalletSearchNextRecords],
  closeWalletSearch: [Function: closeWalletSearch],
  getSchema: [Function: getSchema],
  getCredDef: [Function: getCredDef],
  purgeSchemaCache: [Function: purgeSchemaCache],
  purgeCredDefCache: [Function: purgeCredDefCache],
  isPairwiseExists: [Function: isPairwiseExists],
  createPairwise: [Function: createPairwise],
  listPairwise: [Function: listPairwise],
  getPairwise: [Function: getPairwise],
  setPairwiseMetadata: [Function: setPairwiseMetadata],
  createPaymentAddress: [Function: createPaymentAddress],
  listPaymentAddresses: [Function: listPaymentAddresses],
  addRequestFees: [Function: addRequestFees],
  parseResponseWithFees: [Function: parseResponseWithFees],
  buildGetPaymentSourcesRequest: [Function: buildGetPaymentSourcesRequest],
  buildGetPaymentSourcesWithFromRequest: [Function: buildGetPaymentSourcesWithFromRequest],
  parseGetPaymentSourcesResponse: [Function: parseGetPaymentSourcesResponse],
  parseGetPaymentSourcesWithFromResponse: [Function: parseGetPaymentSourcesWithFromResponse],
  buildPaymentReq: [Function: buildPaymentReq],
  parsePaymentResponse: [Function: parsePaymentResponse],
  preparePaymentExtraWithAcceptanceData: [Function: preparePaymentExtraWithAcceptanceData],
  buildMintReq: [Function: buildMintReq],
  buildSetTxnFeesReq: [Function: buildSetTxnFeesReq],
  buildGetTxnFeesReq: [Function: buildGetTxnFeesReq],
  parseGetTxnFeesResponse: [Function: parseGetTxnFeesResponse],
  buildVerifyPaymentReq: [Function: buildVerifyPaymentReq],
  parseVerifyPaymentResponse: [Function: parseVerifyPaymentResponse],
  getRequestInfo: [Function: getRequestInfo],
  signWithAddress: [Function: signWithAddress],
  verifyWithAddress: [Function: verifyWithAddress],
  createPoolLedgerConfig: [Function: createPoolLedgerConfig],
  openPoolLedger: [Function: openPoolLedger],
  refreshPoolLedger: [Function: refreshPoolLedger],
  listPools: [Function: listPools],
  closePoolLedger: [Function: closePoolLedger],
  deletePoolLedgerConfig: [Function: deletePoolLedgerConfig],
  setProtocolVersion: [Function: setProtocolVersion],
  createWallet: [Function: createWallet],
  openWallet: [Function: openWallet],
  exportWallet: [Function: exportWallet],
  importWallet: [Function: importWallet],
  closeWallet: [Function: closeWallet],
  deleteWallet: [Function: deleteWallet],
  generateWalletKey: [Function: generateWalletKey] }

Recuerda que para ejecutarlo correctamente se tiene que hacer con el comando

1
node example.js

Referencias



💬 Comparte!!

¡Gracias por leer esto y espero que hayas encontrado la información útil! Si tienes alguna duda no tardes en escribirme un comentario más abajo. Y si quieres ver más contenido, sólo házmelo saber y comparte este post con tus colegas, compañeros de trabajo, amigos, etc.

Please, don't try to hack this website servers. Guess why...