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

@aitmed/crypto-sdk

Package Overview
Dependencies
Maintainers
6
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@aitmed/crypto-sdk

>This is the level 2 layer sdk that handles encryption/decryption.

  • 1.2.10
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
6
Weekly downloads
 
Created
Source

AiTmed's Encryption/Decryption SDK

Usage

These methods were built on top of TweetNaCl.js

import services from '@aitmed/crypto-sdk'

async function callSomeApi() {
  const deat = await services.createUser({
    phone_number: '(555)555-5555',
    password: 'letmein123',
    verification_code: '00000',
    first_name: 'Tom',
    last_name: 'Jones',
  })

  return deat
}


async function callSomeApi() {
  const deat = await services.createEdge({
      etype:'CREATE_USER',
    apiVersion: 'v1beta1',
    name: {  phone_number: '(555)555-5555',
    first_name: 'Tom',
    last_name: 'Jones',}
    callBack?: (deat, error)=>{
      if(deat){
        return deat
      }
      console.log(error)
    },

  })

  return deat
}

Methods Include:

MethodReturnsDescription
Encryption/Decryption
.generateAKey(){sk:Uint8Array, pk:Uint8Array}Generates a keyPair for assymetric encryption/decryption
.aKeyCheck(publicKey:Uint8Array,secretKey:Uint8Array)booleanChecks if the keyPair is a valid one
.aKeyEncrypt(secretKey:Uint8Array, data:Uint8Array)Uint8ArrayAssymetrically encrypts the given data using a secret key from a valid keyPair
.aKeyDecrypt: (publicKey: Uint8Array, encryptedData: Uint8Array)Uint8ArrayDecrypts the assymetrically encrypted data using the publicKey from a valid keyPair
.generateSKey()Uint8ArrayGenerates a secretKey for symetrical encryption/decryption
.sKeyEncrypt(secretKey: Uint8Array, data: Uint8Array)Uint8ArraySymetrically encrypts data using a secretKey
.sKeyDecrypt(secretKey: Uint8Array, encryptedData: Uint8Array)Uint8ArrayDecrypts the symetrically encrypted data using the secretKey it was encrypted with
.uint8ArrayToBase64(data: Uint8Array)stringEncodes Uint8Array value to base64 string
.base64ToUint8Array(data: string)Uint8ArrayDecodes string value to Uint8Array
.uTF8ToUint8Array(data: string)Uint8ArrayDecodes string and returns Uint8Array
.uint8ArrayToUTF8(data: Uint8Array)stringEncodes Uint8Array or Array of bytes into string
Account
.createUser{ status: success, user_id: UUID, token: string,}creates a user
.login{ status: success or error}login a user
Edges
.createEdgeEdgecreates an edge
.retrieveEdgeEdgeretrieves an edge

FAQs

Package last updated on 13 Nov 2019

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