Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@functionland/fula-sec

Package Overview
Dependencies
Maintainers
3
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@functionland/fula-sec

<!-- *** Thanks for checking out the Best-README-Template. If you have a suggestion *** that would make this better, please fork the repo and create a pull request *** or simply open an issue with the tag "enhancement". *** Don't forg

  • 0.6.6
  • next
  • npm
  • Socket score

Version published
Weekly downloads
7
increased by250%
Maintainers
3
Weekly downloads
 
Created
Source

Fula Security Layer (FSL)

Fula Security Layer Includes Data Authentication, Decentralized Identity and Encryption.

Fula-sec providing two different way encryption methods.

  1. Tagged Encryption.(Tagged DID)
  2. Asymmetric Encryption.

Installation

Install NPM package

npm install @functionland/fula-sec --save

(back to top)

Decentralized Identity (DID)

 import {FullaDID} from '@functionland/fula-sec'

 // Fulla DID
 const fullaDID = new FullaDID();
 // ...
 // Create DID identity () => return {did|authDID, mnemonic, privateKey}
 await fullaDID.create();

 // You can also call backup option by using getter -> fullaDID.backup () => return {did|authDID, mnemonic, privateKey}
 
 // Import Options:
 // 1. Import with mnemonic
 // 2. Import with privateKey

 // Import existing mnemonic phrase () => return {did|authDID, privateKey}
 // mnemonic example: 'mercy drip similar hole oil lock blast absent medal slam world sweet',
 await fullaDID.importMnemonic(result.mnemonic);

 // Import existing privateKey () => return {did|authDID, privateKey}
 // privateKey example: ff396d82b24b3f8f200cc240bb6d0770911c82e1d8c0199638373221efedabd5
 await fullaDID.importPrivateKey(result.privateKey);

(back to top)

Tagged Encryption (Tagged DID)

 import {FullaDID, TaggedEncryption} from '@functionland/fula-sec'

 // Alice creates own DID 
 const AliceDID = new FullaDID();
 await AliceDID.create();
 const taggedA = new TaggedEncryption(AliceDID.did);

 // Bob creates own DID
 const BobDID = new FullaDID();
 await BobDID.create();
 const taggedB = new TaggedEncryption(BobDID.did);

 // 1. Handshake             |Alice DID| <---  |Bob DID|      
 // 2. Share Content         |Encrypt  | jwe-> |Decrypt| 
 
 // Alice is issuer and she want to share content with Bob (Audience)
 let plaintext = {
         symetricKey: 'content-privateKey',
         CID: 'Content ID'
     }
 // Alice encrypts the content by adding Bob's DID id () => return jwe {}
 let jwe = await taggedA.encrypt(plaintext.symetricKey, plaintext.CID, [BobDID.did.id])

 // Bob decrypts to get the content allowed by Alice.
 let dec = await taggedB.decrypt(jwe) 

(back to top)

Asymmetric Encryption

 import {FullaDID, AsymEncryption} from '@functionland/fula-sec'

  // Alice creates own DID (Issuer)
 const AliceDID = new FullaDID();
 await AliceDID.create();
 // Set privateKey
 const asymEncA = new AsymEncryption(AliceDID.privateKey);

  // Bob creates own DID (Audience)
 const BliceDID = new FullaDID();
 await BliceDID.create();
 // Set privateKey
 const asymEncB = new AsymEncryption(BliceDID.privateKey);

 /* 
    1. Bob shares PublicKey with Alice
    2. Encrypt content with Bob`s PubKey and Decrypt JWE with Bob`s 
                                                   |      Alice            |       |       Bob        |  
                                                   |publicKey=(DID^pk)     | <---  |publicKey=(DID^pk)|      
                                                   |jwe=Enc(m, Bob^PubKey) | jwe-> |Dec(cip, Bob^pk)  |                                                          
 */

 // Alice is issuer and she want to share content with Bob (Audience)
 let plaintext = {
         symetricKey: 'content-privateKey',
         CID: 'Content ID'
     }

 // Issuer (Alice) encrypts plaintext with Audience (Bob) PublicKey
 let jweCipher = await asymEncA.encrypt(plaintext.symetricKey, plaintext.CID, [asymEncB.publicKey]);

 // Audience (Bob) decrypts with own private Key
 let decrypted = await asymEncB.decrypt(jweCipher);

(back to top)

Document Page

Run doc cmd

npx typedoc --out docs

Fulla Sec DOC

Roadmap

  • Identity (DIDs)
  • Encryption
  • Authentication

See the open issues for a full list of proposed features (and known issues).

(back to top)

Development

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

(back to top)

Community

Maintainers

License

See LICENSE for more information.

(back to top)

FAQs

Package last updated on 15 Jun 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc