@burstjs/crypto v0.6.0-beta.6
@burstjs/crypto
Cryptographic functions for building Burstcoin apps.
Installation
burstJS can be used with NodeJS or Web. Two formats are available
Using with NodeJS and/or modern web frameworks
Install using npm:
npm install @burstjs/crypto
or using yarn:
yarn add @burstjs/crypto
Example
import {encryptAES, decryptAES, hashSHA256} from '@burstjs/crypto'
const encrypted = encryptAES('test', 'key')
const decrypted = decryptAES(encrypted, 'key')
console.log(hashSHA256('test'))
console.log(decrypted)
Using in classic <script>
Each package is available as bundled standalone library using IIFE.
This way burstJS can be used also within <script>
-Tags.
This might be useful for Wordpress and/or other PHP applications.
Just import the package using the HTML <script>
tag.
<script src='https://cdn.jsdelivr.net/npm/@burstjs/crypto/dist/burstjs.crypto.min.js'></script>
Example
const encrypted = b$crypto.encryptAES("test", "key");
const decrypted = b$crypto.decryptAES(encrypted, "key");
console.log(b$crypto.hashSHA256("test"));
console.log(decrypted);
See more here:
@burstjs/crypto Online Documentation
API Reference
Modules
Classes
Constants
crypto ⇒
Returns: The decrypted content
See: [encryptAES]
Param | Description |
---|---|
encryptedBase64 | encrypted data in base64 format |
key | The secret key |
crypto ⇒
Returns: The original plain text
Param | Description |
---|---|
encryptedData | The encrypted data |
senderPublicKeyHex | The senders public key in hex format |
recipientPrivateKeyHex | The recipients private (agreement) key in hex format |
crypto ⇒
Returns: The original message
Param | Description |
---|---|
encryptedMessage | The encrypted message |
senderPublicKeyHex | The senders public key in hex format |
recipientPrivateKeyHex | The recipients private (agreement) key in hex format |
crypto ⇒
Returns: The encrypted message as Base64 string
See: [decryptAES]
Param | Description |
---|---|
text | The message/text to be encrypted |
key | The key used |
crypto ⇒
Returns: The encrypted Data
See: [decryptData]
Param | Description |
---|---|
plaintext | Data to be encrypted |
recipientPublicKeyHex | The recipients public key in hexadecimal format |
senderPrivateKeyHex | The senders private (agreement) key hexadecimal format |
crypto ⇒
Returns: The encrypted Message
See: [decryptMessage]
Param | Description |
---|---|
plaintext | Message to be encrypted |
recipientPublicKeyHex | The recipients public key hexadecimal format |
senderPrivateKeyHex | The senders private (agreement) key hexadecimal format |
crypto ⇒
Returns: EC-KCDSA sign key pair + agreement key
Param | Description |
---|---|
passPhrase | The passphrase |
crypto ⇒
Returns: The signature in hexadecimal format
Param | Description |
---|---|
messageHex | The data in hexadecimal representation |
privateKey | The private key for signing |
crypto ⇒
Returns: The signed message digest
Param | Description |
---|---|
unsignedTransactionHex | The unsigned message |
signature | The signature |
crypto ⇒
Returns: The numeric account Id
Param | Description |
---|---|
publicKey | The public key |
crypto ⇒
Returns: A decimal string
Internal: Arbitrary length hexadecimal to decimal conversion
https://stackoverflow.com/questions/21667377/javascript-hexadecimal-string-to-decimal-string
Param | Description |
---|---|
s | A hexadecimal string |
crypto ⇒
Returns: the hash for that string in hex format
Param | Description |
---|---|
input | An arbitrary text |
crypto
Note: For secure randomization seedrandom is used.
crypto ⇒
Returns: true, if signature is valid, otherwise false
See: [generateSignature]
Param | Description |
---|---|
signature | The signature to be verified |
messageHex | The message data in hexadecimal representation |
publicKey | The public key |
crypto
Converter
Kind: global class
IV_LENGTH
Kind: global constant
IV_LENGTH
Kind: global constant
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago