Giter Site home page Giter Site logo

alifma / ed25519-rn Goto Github PK

View Code? Open in Web Editor NEW

This project forked from citradigital/ed25519-rn

0.0 0.0 0.0 430 KB

React Native ed25519 module

License: MIT License

Shell 0.64% JavaScript 6.32% Ruby 5.23% C 0.44% Objective-C 15.24% Java 43.61% TypeScript 27.25% Swift 1.28%

ed25519-rn's Introduction

ed25519-rn

React Native ed25519 module

Installation

npm install ed25519-rn

Usage

import { multiply } from "ed25519-rn";

// ...

      const kp = await generateKeyPair(kp);
      const pk = await getPublicKey(kp);

      console.log('kp', kp);
      console.log('pk', await getPublicKey(kp));

      const kp2 = await generateKeypair();
      const pk2 = await getPublicKey(kp2);

      const sk1 = await getSharedKey(kp, pk2);
      const sk2 = await getSharedKey(kp2, pk);

      console.log('sk1', sk1);
      console.log('sk2', sk2);
      console.log('sk1 == sk2', sk1 === sk2);

      const data = 'omama olala osama obama orama oyama owawa';
      const signature = await sign(kp, hex(data));
      console.log('sig verification', await verify(pk, hex(data), signature));

// should output something like this

[Thu Mar 24 2022 07:15:41.459]  LOG      Running "Ed25519RnExample" with {"rootTag":81}
[Thu Mar 24 2022 07:15:41.472]  LOG      kp 90ac8b6af5f8f915088f1e8bb649c0c595ad3977734d98e36b75647641c32e584988fde505f4510bf96170a2089c7fbc831d38335ca6bd3ee5a38ac5827d7c0fef4eef82b3ec52d1d723b550d6cc7b3f7e07728e31c6c2be81bc62849b789739
[Thu Mar 24 2022 07:15:41.474]  LOG      pk ef4eef82b3ec52d1d723b550d6cc7b3f7e07728e31c6c2be81bc62849b789739
[Thu Mar 24 2022 07:15:41.499]  LOG      sk1 f8194f6768896fbb46ae1f9698e98c0dbc3c02c0c62c7d7744f75538a96c685f
[Thu Mar 24 2022 07:15:41.500]  LOG      sk2 f8194f6768896fbb46ae1f9698e98c0dbc3c02c0c62c7d7744f75538a96c685f
[Thu Mar 24 2022 07:15:41.501]  LOG      sk1 == sk2 true
[Thu Mar 24 2022 07:15:41.508]  LOG      sig verification true

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT

(c) 2022 PT Citra Digital Lintas https://citra.digital

ed25519-rn's People

Contributors

citradigital-bot avatar mdamt avatar alifma avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.