OSDN Git Service

add keys api doc
authorYongfeng LI <wliyongfeng@gmail.com>
Tue, 15 May 2018 10:12:40 +0000 (18:12 +0800)
committerYongfeng LI <wliyongfeng@gmail.com>
Tue, 15 May 2018 10:12:40 +0000 (18:12 +0800)
src/api/keys.js

index 285931c..638b2ed 100644 (file)
@@ -1,8 +1,53 @@
+/**
+ * Cryptographic private keys are the primary authorization mechanism on a
+ * blockchain.
+ *
+ * @typedef {Object} Key
+ * @global
+ *
+ * @property {String} alias
+ * User specified, unique identifier of the key.
+ *
+ * @property {String} xpub
+ * Hex-encoded string representation of the key.
+ */
+
+/**
+ * API for interacting with {@link Key keys}.
+ *
+ * @module KeysApi
+ */
 const keysApi = connection => {
   return {
+    /**
+     * Create a new key.
+     *
+     * @param {String} alias - User specified, unique identifier.
+     * @param {String} password - User specified, key password.
+     * @returns {Promise<Key>} Newly created key.
+     */
     create: (alias, password) => connection.request('/create-key', {alias, password}),
+
+    /**
+     * Got all the keys in one Bytom node.
+     * @returns {Promise<Array<Key>>} All keys.
+     */
     list: () => connection.request('/list-keys'),
+
+    /**
+     *
+     * @param {String} xpub - Hex-encoded string representation of the key.
+     * @param {String} password - Key password.
+     */
     delete: (xpub, password) => connection.request('/delete-key', {xpub, password}),
+
+    /**
+     * Reset key password.
+     *
+     * @param {String} xpub - Hex-encoded string representation of the key.
+     * @param {String} oldPassword - Old password.
+     * @param {String} newPassword - New password.
+     */
     resetPassword: (xpub, oldPassword, newPassword) => connection.request('/reset-key-password', {
       xpub,
       old_password: oldPassword,