1.4.26 • Published 4 years ago

@aitmed/crypto-sdk-test v1.4.26

Weekly downloads
-
License
ISC
Repository
-
Last release
4 years ago

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',
    },
  })

  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
1.4.26

4 years ago

1.4.25

4 years ago

1.4.24

4 years ago

1.4.22

4 years ago

1.4.23

4 years ago

1.4.21

4 years ago

1.4.20

4 years ago

1.4.18

4 years ago

1.4.17

4 years ago

1.4.16

4 years ago

1.4.13

4 years ago

1.4.15

4 years ago

1.4.14

4 years ago

1.4.12

4 years ago

1.4.9

4 years ago

1.4.11

4 years ago

1.4.10

4 years ago

1.4.8

4 years ago

1.4.7

4 years ago

1.4.6

4 years ago

1.4.5

4 years ago

1.4.4

4 years ago

1.4.3

4 years ago

1.4.2

4 years ago

1.4.1

4 years ago

1.4.0

4 years ago

1.3.9

4 years ago

1.3.8

4 years ago

1.3.7

4 years ago

1.3.6

4 years ago

1.3.5

4 years ago

1.3.4

4 years ago

1.3.3

4 years ago

1.3.2

4 years ago

1.3.1

4 years ago

1.3.0

4 years ago

1.2.9

4 years ago

1.2.8

4 years ago

1.2.7

4 years ago

1.2.6

4 years ago

1.2.3

4 years ago

1.2.2

4 years ago