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

@libp2p/crypto

Package Overview
Dependencies
Maintainers
4
Versions
530
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@libp2p/crypto - npm Package Compare versions

Comparing version 0.22.10 to 0.22.11

11

dist/src/keys/index.d.ts

@@ -9,2 +9,3 @@ import * as keysPBM from './keys.js';

import * as Secp256k1 from './secp256k1-class.js';
import type { PrivateKey, PublicKey } from '@libp2p/interfaces/keys';
export { keyStretcher };

@@ -18,9 +19,9 @@ export { generateEphemeralKeyPair };

};
export declare function generateKeyPair(type: 'RSA' | 'Ed25519' | 'secp256k1', bits?: number): Promise<RSA.RsaPrivateKey | Ed25519.Ed25519PrivateKey | Secp256k1.Secp256k1PrivateKey>;
export declare function generateKeyPairFromSeed(type: 'RSA' | 'Ed25519' | 'secp256k1', seed: Uint8Array, bits?: number): Promise<Ed25519.Ed25519PrivateKey>;
export declare function unmarshalPublicKey(buf: Uint8Array): RSA.RsaPublicKey | Ed25519.Ed25519PublicKey | Secp256k1.Secp256k1PublicKey;
export declare function generateKeyPair(type: 'RSA' | 'Ed25519' | 'secp256k1', bits?: number): Promise<PrivateKey>;
export declare function generateKeyPairFromSeed(type: 'RSA' | 'Ed25519' | 'secp256k1', seed: Uint8Array, bits?: number): Promise<PrivateKey>;
export declare function unmarshalPublicKey(buf: Uint8Array): PublicKey;
export declare function marshalPublicKey(key: {
bytes: Uint8Array;
}, type?: string): Uint8Array;
export declare function unmarshalPrivateKey(buf: Uint8Array): Promise<RSA.RsaPrivateKey | Ed25519.Ed25519PrivateKey | Secp256k1.Secp256k1PrivateKey>;
export declare function unmarshalPrivateKey(buf: Uint8Array): Promise<PrivateKey>;
export declare function marshalPrivateKey(key: {

@@ -34,3 +35,3 @@ bytes: Uint8Array;

*/
export declare function importKey(encryptedKey: string, password: string): Promise<RSA.RsaPrivateKey | Ed25519.Ed25519PrivateKey | Secp256k1.Secp256k1PrivateKey>;
export declare function importKey(encryptedKey: string, password: string): Promise<PrivateKey>;
//# sourceMappingURL=index.d.ts.map
{
"name": "@libp2p/crypto",
"version": "0.22.10",
"version": "0.22.11",
"description": "Crypto primitives for libp2p",

@@ -172,2 +172,3 @@ "license": "Apache-2.0 OR MIT",

"dependencies": {
"@libp2p/interfaces": "^1.3.20",
"@noble/ed25519": "^1.6.0",

@@ -174,0 +175,0 @@ "@noble/secp256k1": "^1.5.4",

@@ -14,2 +14,3 @@ import * as keysPBM from './keys.js'

import * as Secp256k1 from './secp256k1-class.js'
import type { PrivateKey, PublicKey } from '@libp2p/interfaces/keys'

@@ -42,3 +43,3 @@ export { keyStretcher }

// Generates a keypair of the given type and bitsize
export async function generateKeyPair (type: 'RSA' | 'Ed25519' | 'secp256k1', bits?: number) { // eslint-disable-line require-await
export async function generateKeyPair (type: 'RSA' | 'Ed25519' | 'secp256k1', bits?: number): Promise<PrivateKey> { // eslint-disable-line require-await
return await typeToKey(type).generateKeyPair(bits ?? 2048)

@@ -49,3 +50,3 @@ }

// seed is a 32 byte uint8array
export async function generateKeyPairFromSeed (type: 'RSA' | 'Ed25519' | 'secp256k1', seed: Uint8Array, bits?: number) { // eslint-disable-line require-await
export async function generateKeyPairFromSeed (type: 'RSA' | 'Ed25519' | 'secp256k1', seed: Uint8Array, bits?: number): Promise<PrivateKey> { // eslint-disable-line require-await
if (type.toLowerCase() !== 'ed25519') {

@@ -60,3 +61,3 @@ throw errcode(new Error('Seed key derivation is unimplemented for RSA or secp256k1'), 'ERR_UNSUPPORTED_KEY_DERIVATION_TYPE')

// representative object
export function unmarshalPublicKey (buf: Uint8Array) {
export function unmarshalPublicKey (buf: Uint8Array): PublicKey {
const decoded = keysPBM.PublicKey.decode(buf)

@@ -78,3 +79,3 @@ const data = decoded.Data

// Converts a public key object into a protobuf serialized public key
export function marshalPublicKey (key: { bytes: Uint8Array }, type?: string) {
export function marshalPublicKey (key: { bytes: Uint8Array }, type?: string): Uint8Array {
type = (type ?? 'rsa').toLowerCase()

@@ -87,3 +88,3 @@ typeToKey(type) // check type

// representative object
export async function unmarshalPrivateKey (buf: Uint8Array) { // eslint-disable-line require-await
export async function unmarshalPrivateKey (buf: Uint8Array): Promise<PrivateKey> { // eslint-disable-line require-await
const decoded = keysPBM.PrivateKey.decode(buf)

@@ -105,3 +106,3 @@ const data = decoded.Data

// Converts a private key object into a protobuf serialized private key
export function marshalPrivateKey (key: { bytes: Uint8Array }, type?: string) {
export function marshalPrivateKey (key: { bytes: Uint8Array }, type?: string): Uint8Array {
type = (type ?? 'rsa').toLowerCase()

@@ -117,3 +118,3 @@ typeToKey(type) // check type

*/
export async function importKey (encryptedKey: string, password: string) { // eslint-disable-line require-await
export async function importKey (encryptedKey: string, password: string): Promise<PrivateKey> { // eslint-disable-line require-await
try {

@@ -120,0 +121,0 @@ const key = await importer(encryptedKey, password)

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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