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

@credify/crypto

Package Overview
Dependencies
Maintainers
2
Versions
37
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 1.3.10 to 1.4.0

2

package.json
{
"name": "@credify/crypto",
"version": "1.3.10",
"version": "1.4.0",
"description": "Credify cryptographic related helpers in JavaScript",

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

@@ -19,11 +19,5 @@ [![npm](https://github.com/credify-pte-ltd/credify-crypto/actions/workflows/npm.yml/badge.svg)](https://github.com/credify-pte-ltd/credify-crypto/actions/workflows/npm.yml)

### CDN
```html
<script src="https://cdn.jsdelivr.net/npm/@credify/crypto@0.19.0/dist/index.min.js"></script>
```
## How to use
### Encryption
### Encryption (RSA)

@@ -52,3 +46,3 @@ ```typescript

### Signing
### Signing (EdDSA)

@@ -71,9 +65,30 @@ ```typescript

### Signing (ECDSA)
```typescript
import { EcdsaKey } from "@credify/crypto";
const privateKeyPem = `-----BEGIN PRIVATE KEY-----
MC4CAQAwBQYDK2VwBCIEIPqO4b4UtXSaWGp5u38rCXYu4/LdbaSk7lD46LtRUu44
-----END PRIVATE KEY-----`;
const message = "test message";
const signing = new EcdsaKey();
await signing.importPrivateKey(privateKeyPem);
const sign = await signing.sign(message, { input: "utf8" });
const verified = await signing.verify(message, sign);
console.log(verified) // true
```
## Asymmetric Encryption
@credify/crypto supports RSA encryption with 4096 bit length keys. Its padding scheme uses [OAEP](https://en.wikipedia.org/wiki/Optimal_asymmetric_encryption_padding).
@credify/crypto supports RSA encryption with 3072 bit length keys by default. Its padding scheme uses [OAEP](https://en.wikipedia.org/wiki/Optimal_asymmetric_encryption_padding).
## Signing
@credify/crypto utilizes [EdDSA](https://en.wikipedia.org/wiki/EdDSA). This supports Curve25519.
@credify/crypto supports
- [EdDSA](https://en.wikipedia.org/wiki/EdDSA) `(signing.ts)`
- [ECDSA](https://en.wikipedia.org/wiki/Elliptic_Curve_Digital_Signature_Algorithm) `(ecdsa.ts)`

@@ -92,4 +107,8 @@ ## PKCS #8

```
Currently, it does not work with Webpack 5 due to Node.js core dependencies.
```
## License
@credify/crypto is released under the MIT license. See LICENSE for details.

@@ -27,2 +27,28 @@ export class Signing {

export class EcdsaKey {
public get privateKey(): CryptoKey;
public get publicKey(): CryptoKey;
public generateKeyPair(): Promise<void>;
public importPrivateKey(pem: string, password?: string): Promise<void>;
public importPrivateKeyInBase64Url(pem: string, password?: string): Promise<void>;
public importPublicKey(pem: string): Promise<void>;
public importPublicKeyInBase64Url(pem: string): Promise<void>;
public sign(
message: string,
option?: {
input?: "base64" | "utf8" | "hex";
output?: "base64" | "utf8" | "hex";
}
): Promise<string>;
public verify(
message: string,
signature: string,
option?: { encode: "base64" | "base64Url" }
): Promise<boolean>;
public exportPrivateKey(password?: string): Promise<string>;
public exportPrivateKeyInBase64Url(): Promise<string>;
public exportPublicKey(): Promise<string>;
public exportPublicKeyInBase64Url(): Promise<string>;
}
export class Encryption {

@@ -29,0 +55,0 @@ public get privateKey(): CryptoKey;

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

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