0.1.3 • Published 1 year ago

supasteeltokens v0.1.3

Weekly downloads
-
License
MIT
Repository
-
Last release
1 year ago

⚡️SupaSteelTokens - SSTs

SupaSteelTokens or SSTs, are "taped" cookies that use the native 'crypto' module to encrypt/decrypt data. With SSTs, you can: selected the number of keys you want to generate for "taping" your cookies, select any given ones at random, and tape and untap your cookies.

Tabla de Contenido

Installation

NPM:
npm i supasteeltokens

YARN:
yarn add supasteeltokens

Hook: useSSTKeyGen

This hook allows you to generate a selected number of keys. For security, you'd store the generated keys in environment variables (.env*), that you can access securely. Because you cannot use arrays as values, I've made it so that the array with your keys are returned as a string that you can paste the value to in your env variable.

SSTKeyGen API

  • rotations (number, required): This prop lets you tell the generator how many keys it should generate for you to rotate from.
// index.js
import { useSSTKeyGen } from 'supasteeltokens'

/// You only need to use this when generating keys
// apart from that, you can take this out 
let keys = useSSTKeyGen(3)

console.log(keys)
/*
PS: Shown like this for readability, but it's just one long string
separated by commas.

1. KxPKjwJgHbTHvKPmn1bObT0Ouh9W9tazhijtB8/KZaiRG1LKxRL8Bzxg+14QjfnzeZlZQGkcCDAcIKZqNuXwy1cwtcE6bvpwK/KDzKsQg383/NdXRHJnx1AOzwCwbllsHaffVsfvnCFi5/zJVpCYma6XAveSRr2rtiKscwKItCc=

2. 6DIQI5Uf/doPG+9skKUsgsi4oM8oKZ5qPFrPgU5b84UTWJDBMrWdCeXsNG3n/a1SM/u8caGt6QaoJ+P+gbUdKjQRzwr/bbGbfW+X5MoR7Ot5Q4EckV1XU9D1EUBnMts4/WVbn2ClJON1P/vIZbCsZsUdnKfW/d4Mfv6ANOYIVRo=

3. rU/z60t9n8q9DEB673qQn0Swes2OyYc1MzHglnx2/uzYEUAxeynqp8rxZDwBibhJvZ03Hu67ZPDKK0c1cTS3NglRTkne7U85p0X+xRE7eCWOvr1olHgsbmujXFZrA8vuzq+VLNdEHPTKPMIRPoPCK+HjA24RmicJV5YXUai94k8=
*/

Hook: useSSTSelect

This hook allows you to take in the delimited string in the environment variable storing your SST keys, converts them back into an array, select one from the available options and returns it. This comes in clutch when using the useSSTEncrypt hook.

SSTSelect API

  • keys (string, required): takes in the string from useSSTKeyGen.
import { useSSTKeyGen, useSSTSelect } from 'supasteeltokens'

/// You only need to use this when generating keys
// apart from that, you can take this out 
let keys = useSSTKeyGen(3)

let result = useSSTSelect(keys)

console.log(result)
/*
In this example the second option (_arr[1]) was returned ->
6DIQI5Uf/doPG+9skKUsgsi4oM8oKZ5qPFrPgU5b84UTWJDBMrWdCeXsNG3n/a1SM/u8caGt6QaoJ+P+gbUdKjQRzwr/bbGbfW+X5MoR7Ot5Q4EckV1XU9D1EUBnMts4/WVbn2ClJON1P/vIZbCsZsUdnKfW/d4Mfv6ANOYIVRo=
*/

Hook: useSSTEncrypt

SSTEncrypt API

Hook: useSSTDecrypt

SSTDecrypt API

Hook: useSSTDestroy

SSTDestroy API

0.1.3

1 year ago

0.1.2

1 year ago

0.1.1

1 year ago