From 48ebe2d30f4931e4e836da99249184d5d347bd81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Soko=C5=82owski?= Date: Thu, 6 Feb 2020 12:55:35 +0100 Subject: [PATCH] add README.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jakub SokoĊ‚owski --- README.md | 32 ++++++++++++++++++++++++++++++++ src/main.js | 0 2 files changed, 32 insertions(+) create mode 100644 README.md mode change 100755 => 100644 src/main.js diff --git a/README.md b/README.md new file mode 100644 index 0000000..1054a94 --- /dev/null +++ b/README.md @@ -0,0 +1,32 @@ +# Description + +This is a JavaScript library for convering a Status chat key ot a chat name. + +# Details + +This implementation is based off of a GoLang one in [`status-im/status-go`](https://en.wikipedia.org/wiki/Linear-feedback_shift_register) repo. + +It uses the [Linear-Feedback Shift Register](https://en.wikipedia.org/wiki/Linear-feedback_shift_register) algorithm on the 8 least significant bytes of the `X` of [ECDSA](https://en.wikipedia.org/wiki/Elliptic_Curve_Digital_Signature_Algorithm) public key. + +# Building + +You can update the contents of `dist` folder by running: +``` +yarn test +yarn build +``` + +# Usage + +The library exports just one method: +```js +const StatusIm = require('./dist/status-chat-name.js') + +let chatKey = '0x040bc5bdbd8edf82962b191e80541d7ca8868920b1b415fcd999d6bd723cbbcff17f34e1e6e0484c11d9c7c63b164878a6da3173a49ceaf5fea2faac98928f8a47' + +let chatName = StatusIm.chatKeyToChatName(chatKey) + +if (chatName != 'Defensive Impartial Impala') { + throw new Error('FAIL!') +} +``` diff --git a/src/main.js b/src/main.js old mode 100755 new mode 100644