summaryrefslogtreecommitdiff
path: root/node_modules/sshpk/lib/ed-compat.js
diff options
context:
space:
mode:
authorLinuxWizard42 <computerwizard@linuxmail.org>2022-10-12 23:08:57 +0300
committerLinuxWizard42 <computerwizard@linuxmail.org>2022-10-12 23:08:57 +0300
commit726b81b19251674e149ccfbb1abacbd837fc6db0 (patch)
treefbdbb227dc01357eb76e8222d76185bc124c5ca6 /node_modules/sshpk/lib/ed-compat.js
parent34f0890e175698940d49238097579f44e4d78c89 (diff)
downloadFlashRunner-726b81b19251674e149ccfbb1abacbd837fc6db0.tar.gz
FlashRunner-726b81b19251674e149ccfbb1abacbd837fc6db0.tar.zst
Removed files that should not have been included in git
Diffstat (limited to 'node_modules/sshpk/lib/ed-compat.js')
-rw-r--r--node_modules/sshpk/lib/ed-compat.js92
1 files changed, 0 insertions, 92 deletions
diff --git a/node_modules/sshpk/lib/ed-compat.js b/node_modules/sshpk/lib/ed-compat.js
deleted file mode 100644
index 70732e1..0000000
--- a/node_modules/sshpk/lib/ed-compat.js
+++ /dev/null
@@ -1,92 +0,0 @@
-// Copyright 2015 Joyent, Inc.
-
-module.exports = {
- Verifier: Verifier,
- Signer: Signer
-};
-
-var nacl = require('tweetnacl');
-var stream = require('stream');
-var util = require('util');
-var assert = require('assert-plus');
-var Buffer = require('safer-buffer').Buffer;
-var Signature = require('./signature');
-
-function Verifier(key, hashAlgo) {
- if (hashAlgo.toLowerCase() !== 'sha512')
- throw (new Error('ED25519 only supports the use of ' +
- 'SHA-512 hashes'));
-
- this.key = key;
- this.chunks = [];
-
- stream.Writable.call(this, {});
-}
-util.inherits(Verifier, stream.Writable);
-
-Verifier.prototype._write = function (chunk, enc, cb) {
- this.chunks.push(chunk);
- cb();
-};
-
-Verifier.prototype.update = function (chunk) {
- if (typeof (chunk) === 'string')
- chunk = Buffer.from(chunk, 'binary');
- this.chunks.push(chunk);
-};
-
-Verifier.prototype.verify = function (signature, fmt) {
- var sig;
- if (Signature.isSignature(signature, [2, 0])) {
- if (signature.type !== 'ed25519')
- return (false);
- sig = signature.toBuffer('raw');
-
- } else if (typeof (signature) === 'string') {
- sig = Buffer.from(signature, 'base64');
-
- } else if (Signature.isSignature(signature, [1, 0])) {
- throw (new Error('signature was created by too old ' +
- 'a version of sshpk and cannot be verified'));
- }
-
- assert.buffer(sig);
- return (nacl.sign.detached.verify(
- new Uint8Array(Buffer.concat(this.chunks)),
- new Uint8Array(sig),
- new Uint8Array(this.key.part.A.data)));
-};
-
-function Signer(key, hashAlgo) {
- if (hashAlgo.toLowerCase() !== 'sha512')
- throw (new Error('ED25519 only supports the use of ' +
- 'SHA-512 hashes'));
-
- this.key = key;
- this.chunks = [];
-
- stream.Writable.call(this, {});
-}
-util.inherits(Signer, stream.Writable);
-
-Signer.prototype._write = function (chunk, enc, cb) {
- this.chunks.push(chunk);
- cb();
-};
-
-Signer.prototype.update = function (chunk) {
- if (typeof (chunk) === 'string')
- chunk = Buffer.from(chunk, 'binary');
- this.chunks.push(chunk);
-};
-
-Signer.prototype.sign = function () {
- var sig = nacl.sign.detached(
- new Uint8Array(Buffer.concat(this.chunks)),
- new Uint8Array(Buffer.concat([
- this.key.part.k.data, this.key.part.A.data])));
- var sigBuf = Buffer.from(sig);
- var sigObj = Signature.parse(sigBuf, 'ed25519', 'raw');
- sigObj.hashAlgorithm = 'sha512';
- return (sigObj);
-};