Socket
Socket
Sign inDemoInstall

@ldapjs/asn1

Package Overview
Dependencies
Maintainers
4
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ldapjs/asn1 - npm Package Compare versions

Comparing version 1.0.1 to 1.2.0-rc.1

18

lib/ber/writer.js

@@ -58,2 +58,20 @@ // Copyright 2011 Mark Cavage <mcavage@gmail.com> All rights reserved.

/**
* Append a raw buffer to the current writer instance. No validation to
* determine if the buffer represents a valid BER encoding is performed.
*
* @param {Buffer} buffer The buffer to append. If this is not a valid BER
* sequence of data, it will invalidate the BER represented by the `BerWriter`.
*
* @throws If the input is not an instance of Buffer.
*/
Writer.prototype.appendBuffer = function appendBuffer (buffer) {
if (Buffer.isBuffer(buffer) === false) {
throw Error('buffer must be an instance of Buffer')
}
for (const b of buffer.values()) {
this.writeByte(b)
}
}
Writer.prototype.writeByte = function (b) {

@@ -60,0 +78,0 @@ if (typeof (b) !== 'number') { throw new TypeError('argument must be a Number') }

@@ -337,1 +337,9 @@ // Copyright 2011 Mark Cavage <mcavage@gmail.com> All rights reserved.

})
test('appendBuffer appends a buffer', async t => {
const expected = Buffer.from([0x04, 0x03, 0x66, 0x6f, 0x6f, 0x66, 0x6f, 0x6f])
const writer = new BerWriter()
writer.writeString('foo')
writer.appendBuffer(Buffer.from('foo'))
t.equal(Buffer.compare(writer.buffer, expected), 0)
})

2

package.json

@@ -11,3 +11,3 @@ {

"description": "Contains parsers and serializers for ASN.1 (currently BER only)",
"version": "1.0.1",
"version": "1.2.0-rc.1",
"repository": {

@@ -14,0 +14,0 @@ "type": "git",

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