Add key calls.

This commit is contained in:
Jaidyn Levesque 2019-06-07 00:12:39 -05:00
parent d42905cf6d
commit 18f1220d9d
2 changed files with 38 additions and 0 deletions

View File

@ -602,6 +602,38 @@
;; —————————————————————————————————————
;; KEY CALLS
;; STRING [:STRING :NUMBER] → ALIST || (NIL STRING)
(defun key-gen (name &key (type nil) (size nil))
"Create a new keypair.
/ipns/docs.ipfs.io/reference/api/http/#api-v0-key-gen"
(bind-api-alist
(ipfs-call "key/gen" `(("name" ,name) ,(if type (list "type" type))
,(if size (list "size" size))))))
;; NIL → ALIST || (NIL STRING)
(defun key-list ()
"List all local keypairs.
/ipns/docs.ipfs.io/reference/api/http/#api-v0-key-list"
(bind-api-alist (ipfs-call "key/list" '())))
;; STRING STRING [:BOOLEAN] → ALIST || (NIL STRING)
(defun key-rename (old-name new-name &key (force nil))
"Rename a local keypair.
/ipns/docs.ipfs.io/reference/api/http/#api-v0-key-rename"
(bind-api-alist
(ipfs-call "key/rename" `(("arg" ,old-name) ("arg" ,new-name)
("force" ,force)))))
;; STRING → ALIST || (NIL STRING)
(defun key-remove (name)
"Remove a keypair, based on name.
/ipns/docs.ipfs.io/reference/api/http/#api-v0-key-remove"
(bind-api-alist (ipfs-call "key/remove" `(("arg" ,name)))))
;; ————————————————————————————————————— ;; —————————————————————————————————————
;; VERSION CALLS ;; VERSION CALLS

View File

@ -81,6 +81,12 @@
:filestore-dups :filestore-dups
:filestore-ls :filestore-ls
:filestore-verify :filestore-verify
;; key calls
:key-gen
:key-list
:key-rename
:key-remove
;; version calls ;; version calls
:version :version