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

credify-crypto

Package Overview
Dependencies
Maintainers
1
Versions
47
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

credify-crypto - npm Package Compare versions

Comparing version 0.2.0 to 0.3.0

dist/__tests__/jwt.test.d.ts

78

dist/index.es.js

@@ -342,48 +342,38 @@ import { Crypto } from '@peculiar/webcrypto';

if (password === void 0) { password = undefined; }
return __awaiter(this, void 0, void 0, function () {
var decomposed;
return __generator(this, function (_a) {
if (!this._privateKey) {
throw new Error("private key is not instantiated.");
}
decomposed = {
format: 'pkcs8-pem',
keyAlgorithm: { id: 'ed25519' },
keyData: {
seed: this._privateKey.slice(0, 32),
},
};
if (password) {
// @ts-ignore
decomposed["encryptionAlgorithm"] = {
keyDerivationFunc: {
id: 'pbkdf2',
iterationCount: 10000,
keyLength: 32,
prf: 'hmac-with-sha256' // The pseudo-random function
},
encryptionScheme: 'aes256-cbc',
};
}
return [2 /*return*/, composePrivateKey(decomposed, { password: password }).replace(/\n$/, "")];
});
});
if (!this._privateKey) {
throw new Error("private key is not instantiated.");
}
var decomposed = {
format: 'pkcs8-pem',
keyAlgorithm: { id: 'ed25519' },
keyData: {
seed: this._privateKey.slice(0, 32),
},
};
if (password) {
// @ts-ignore
decomposed["encryptionAlgorithm"] = {
keyDerivationFunc: {
id: 'pbkdf2',
iterationCount: 10000,
keyLength: 32,
prf: 'hmac-with-sha256' // The pseudo-random function
},
encryptionScheme: 'aes256-cbc',
};
}
return composePrivateKey(decomposed, { password: password }).replace(/\n$/, "");
};
Signing.prototype.exportPublicKey = function () {
return __awaiter(this, void 0, void 0, function () {
var decomposed;
return __generator(this, function (_a) {
if (!this._publicKey) {
throw new Error("public key is not instantiated.");
}
decomposed = {
format: 'spki-pem',
keyAlgorithm: { id: 'ed25519' },
keyData: {
bytes: this._publicKey,
},
};
return [2 /*return*/, composePublicKey(decomposed).replace(/\n$/, "")];
});
});
if (!this._publicKey) {
throw new Error("public key is not instantiated.");
}
var decomposed = {
format: 'spki-pem',
keyAlgorithm: { id: 'ed25519' },
keyData: {
bytes: this._publicKey,
},
};
return composePublicKey(decomposed).replace(/\n$/, "");
};

@@ -390,0 +380,0 @@ return Signing;

@@ -346,48 +346,38 @@ 'use strict';

if (password === void 0) { password = undefined; }
return __awaiter(this, void 0, void 0, function () {
var decomposed;
return __generator(this, function (_a) {
if (!this._privateKey) {
throw new Error("private key is not instantiated.");
}
decomposed = {
format: 'pkcs8-pem',
keyAlgorithm: { id: 'ed25519' },
keyData: {
seed: this._privateKey.slice(0, 32),
},
};
if (password) {
// @ts-ignore
decomposed["encryptionAlgorithm"] = {
keyDerivationFunc: {
id: 'pbkdf2',
iterationCount: 10000,
keyLength: 32,
prf: 'hmac-with-sha256' // The pseudo-random function
},
encryptionScheme: 'aes256-cbc',
};
}
return [2 /*return*/, cryptoKeyComposer.composePrivateKey(decomposed, { password: password }).replace(/\n$/, "")];
});
});
if (!this._privateKey) {
throw new Error("private key is not instantiated.");
}
var decomposed = {
format: 'pkcs8-pem',
keyAlgorithm: { id: 'ed25519' },
keyData: {
seed: this._privateKey.slice(0, 32),
},
};
if (password) {
// @ts-ignore
decomposed["encryptionAlgorithm"] = {
keyDerivationFunc: {
id: 'pbkdf2',
iterationCount: 10000,
keyLength: 32,
prf: 'hmac-with-sha256' // The pseudo-random function
},
encryptionScheme: 'aes256-cbc',
};
}
return cryptoKeyComposer.composePrivateKey(decomposed, { password: password }).replace(/\n$/, "");
};
Signing.prototype.exportPublicKey = function () {
return __awaiter(this, void 0, void 0, function () {
var decomposed;
return __generator(this, function (_a) {
if (!this._publicKey) {
throw new Error("public key is not instantiated.");
}
decomposed = {
format: 'spki-pem',
keyAlgorithm: { id: 'ed25519' },
keyData: {
bytes: this._publicKey,
},
};
return [2 /*return*/, cryptoKeyComposer.composePublicKey(decomposed).replace(/\n$/, "")];
});
});
if (!this._publicKey) {
throw new Error("public key is not instantiated.");
}
var decomposed = {
format: 'spki-pem',
keyAlgorithm: { id: 'ed25519' },
keyData: {
bytes: this._publicKey,
},
};
return cryptoKeyComposer.composePublicKey(decomposed).replace(/\n$/, "");
};

@@ -394,0 +384,0 @@ return Signing;

@@ -12,5 +12,5 @@ /// <reference types="node" />

verifyString(message: string, signature: string): boolean;
exportPrivateKey(password?: string | undefined): Promise<string>;
exportPublicKey(): Promise<string>;
exportPrivateKey(password?: string | undefined): string;
exportPublicKey(): string;
}
export default Signing;
{
"name": "credify-crypto",
"version": "0.2.0",
"version": "0.3.0",
"description": "Credify cryptographic related helpers in JavaScript",

@@ -5,0 +5,0 @@ "license": "MIT",

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