aboutsummaryrefslogtreecommitdiff
path: root/deps/npm/node_modules/request/node_modules/http-signature/node_modules/sshpk/lib/ssh-buffer.js
diff options
context:
space:
mode:
Diffstat (limited to 'deps/npm/node_modules/request/node_modules/http-signature/node_modules/sshpk/lib/ssh-buffer.js')
-rw-r--r--deps/npm/node_modules/request/node_modules/http-signature/node_modules/sshpk/lib/ssh-buffer.js24
1 files changed, 24 insertions, 0 deletions
diff --git a/deps/npm/node_modules/request/node_modules/http-signature/node_modules/sshpk/lib/ssh-buffer.js b/deps/npm/node_modules/request/node_modules/http-signature/node_modules/sshpk/lib/ssh-buffer.js
index 0b00277349..8fc2cb8785 100644
--- a/deps/npm/node_modules/request/node_modules/http-signature/node_modules/sshpk/lib/ssh-buffer.js
+++ b/deps/npm/node_modules/request/node_modules/http-signature/node_modules/sshpk/lib/ssh-buffer.js
@@ -73,6 +73,14 @@ SSHBuffer.prototype.readInt = function () {
return (v);
};
+SSHBuffer.prototype.readInt64 = function () {
+ assert.ok(this._offset + 8 < this._buffer.length,
+ 'buffer not long enough to read Int64');
+ var v = this._buffer.slice(this._offset, this._offset + 8);
+ this._offset += 8;
+ return (v);
+};
+
SSHBuffer.prototype.readChar = function () {
var v = this._buffer[this._offset++];
return (v);
@@ -106,6 +114,22 @@ SSHBuffer.prototype.writeInt = function (v) {
this._offset += 4;
};
+SSHBuffer.prototype.writeInt64 = function (v) {
+ assert.buffer(v, 'value');
+ if (v.length > 8) {
+ var lead = v.slice(0, v.length - 8);
+ for (var i = 0; i < lead.length; ++i) {
+ assert.strictEqual(lead[i], 0,
+ 'must fit in 64 bits of precision');
+ }
+ v = v.slice(v.length - 8, v.length);
+ }
+ while (this._offset + 8 > this._size)
+ this.expand();
+ v.copy(this._buffer, this._offset);
+ this._offset += 8;
+};
+
SSHBuffer.prototype.writeChar = function (v) {
while (this._offset + 1 > this._size)
this.expand();