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

@aeternity/aepp-calldata

Package Overview
Dependencies
Maintainers
5
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@aeternity/aepp-calldata - npm Package Compare versions

Comparing version 1.1.0 to 1.1.1

src/utils/base58check.js

13

CHANGELOG.md

@@ -15,2 +15,15 @@ # Changelog

## [1.1.1] - 2022-03-15
## Fixed
- Depend on Buffer ponyfill for browser compatibility (#122)
## Added
- Add tests from root to browser bundle (#120)
## Changed
- Use own implementation of base58check (#122)
- Use blakejs version that doesn't refer to Buffer (#122)
- Update dependencies (#121)
## [1.1.0] - 2022-01-27

@@ -17,0 +30,0 @@

23

package.json
{
"name": "@aeternity/aepp-calldata",
"description": "Aeternity data serialization library",
"version": "1.1.0",
"version": "1.1.1",
"author": "aeternity",

@@ -32,15 +32,16 @@ "license": "ISC",

"dependencies": {
"blakejs": "^1.1.0",
"bs58check": "^2.1.2",
"rlp": "^2.2.4",
"@aeternity/blakejs": "^1.1.2",
"bs58": "^4.0.1",
"rlp": "^3.0.0",
"safe-buffer": "^5.2.1",
"sha.js": "^2.4.11"
},
"devDependencies": {
"ava": "^3.1.0",
"browserify": "^16.5.2",
"eslint": "^8.2.0",
"ava": "^4.0.1",
"browserify": "^17.0.0",
"eslint": "^8.8.0",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-plugin-import": "^2.25.3",
"nyc": "^15.0.0",
"tape": "^5.0.1"
"eslint-plugin-import": "^2.25.4",
"nyc": "^15.1.0",
"tape": "^5.5.0"
},

@@ -62,3 +63,3 @@ "ava": {

"scripts": {
"browser-test-bundle": "browserify tests/**/*.js > build/js/tests.js",
"browser-test-bundle": "browserify tests/[A-Z]*.js tests/**/*.js > build/js/tests.js",
"coverage": "nyc ava",

@@ -65,0 +66,0 @@ "test": "ava --verbose",

@@ -1,2 +0,2 @@

const bs58check = require('bs58check')
const base58check = require('../utils/base58check')

@@ -13,3 +13,3 @@ /**

visitAddress(acceptor) {
return acceptor.prefix + '_' + bs58check.encode(acceptor.value)
return acceptor.prefix + '_' + base58check.encode(acceptor.value)
}

@@ -16,0 +16,0 @@

@@ -1,2 +0,2 @@

const bs58check = require('bs58check')
const base58check = require('../utils/base58check')
const FateTypeError = require('../Errors/FateTypeError')

@@ -44,3 +44,3 @@

return bs58check.decode(asString.substring(prefix.length + 1))
return base58check.decode(asString.substring(prefix.length + 1))
}

@@ -47,0 +47,0 @@

const shajs = require('sha.js')
const { Buffer } = require('safe-buffer')
const FormatError = require('../Errors/FormatError')

@@ -12,14 +13,28 @@

const addChecksum = (payload) => {
const buffer = Buffer.from(payload)
const checksum = checkSumFn(payload)
return Buffer.concat([buffer, checksum], buffer.length + 4)
}
const getPayload = (payloadWithChecksum) => {
const payload = payloadWithChecksum.slice(0, -4)
const checksum = payloadWithChecksum.slice(-4)
const newChecksum = checkSumFn(payload)
if (!checksum.equals(newChecksum)) {
throw new FormatError('Invalid checksum')
}
return payload
}
/**
* Base64check encode given `input`
* @rtype (input: String|buffer) => Buffer
* @param {String} input - Data to encode
* @return {Buffer} Base64check encoded data
* @param {String|Buffer} input - Data to encode
* @return {String} Base64check encoded data
*/
const encode = (input) => {
const buffer = Buffer.from(input)
const checksum = checkSumFn(input)
const payloadWithChecksum = Buffer.concat([buffer, checksum], buffer.length + 4)
return payloadWithChecksum.toString('base64')
return addChecksum(input).toString('base64')
}

@@ -34,17 +49,10 @@

const decode = (str) => {
const buffer = Buffer.from(str, 'base64')
const payload = buffer.slice(0, -4)
const checksum = buffer.slice(-4)
const newChecksum = checkSumFn(payload)
if (!checksum.equals(newChecksum)) {
throw new FormatError('Invalid base64 checksum')
}
return Buffer.from(payload)
return getPayload(Buffer.from(str, 'base64'))
}
module.exports = {
addChecksum,
getPayload,
encode,
decode
}

@@ -1,2 +0,2 @@

const blake = require('blakejs')
const blake = require('@aeternity/blakejs')

@@ -3,0 +3,0 @@ const HASH_BYTES = 32

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