@libp2p/crypto
Advanced tools
Comparing version 2.0.4 to 2.0.5
import 'node-forge/lib/aes.js'; | ||
export interface Cipher { | ||
update: (data: Uint8Array) => Uint8Array; | ||
update(data: Uint8Array): Uint8Array; | ||
} | ||
@@ -5,0 +5,0 @@ export declare function createCipheriv(mode: any, key: Uint8Array, iv: Uint8Array): Cipher; |
export interface AESCipher { | ||
encrypt: (data: Uint8Array) => Promise<Uint8Array>; | ||
decrypt: (data: Uint8Array) => Promise<Uint8Array>; | ||
encrypt(data: Uint8Array): Promise<Uint8Array>; | ||
decrypt(data: Uint8Array): Promise<Uint8Array>; | ||
} | ||
export declare function create(key: Uint8Array, iv: Uint8Array): Promise<AESCipher>; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -11,5 +11,5 @@ export interface CreateOptions { | ||
export interface AESCipher { | ||
encrypt: (data: Uint8Array, password: string | Uint8Array) => Promise<Uint8Array>; | ||
decrypt: (data: Uint8Array, password: string | Uint8Array) => Promise<Uint8Array>; | ||
encrypt(data: Uint8Array, password: string | Uint8Array): Promise<Uint8Array>; | ||
decrypt(data: Uint8Array, password: string | Uint8Array): Promise<Uint8Array>; | ||
} | ||
//# sourceMappingURL=interface.d.ts.map |
export declare function create(hashType: 'SHA1' | 'SHA256' | 'SHA512', secret: Uint8Array): Promise<{ | ||
digest: (data: Uint8Array) => Promise<Uint8Array>; | ||
digest(data: Uint8Array): Promise<Uint8Array>; | ||
length: number; | ||
}>; | ||
//# sourceMappingURL=index-browser.d.ts.map |
export interface HMAC { | ||
digest: (data: Uint8Array) => Promise<Uint8Array>; | ||
digest(data: Uint8Array): Promise<Uint8Array>; | ||
length: number; | ||
@@ -4,0 +4,0 @@ } |
@@ -15,3 +15,3 @@ export interface JWKKeyPair { | ||
key: Uint8Array; | ||
genSharedKey: (theirPub: Uint8Array, forcePrivate?: ECDHKeyPair) => Promise<Uint8Array>; | ||
genSharedKey(theirPub: Uint8Array, forcePrivate?: ECDHKeyPair): Promise<Uint8Array>; | ||
} | ||
@@ -18,0 +18,0 @@ export interface JWKEncodedPublicKey { |
import 'node-forge/lib/rsa.js'; | ||
export interface JWK { | ||
encrypt: (msg: string) => string; | ||
decrypt: (msg: string) => string; | ||
encrypt(msg: string): string; | ||
decrypt(msg: string): string; | ||
} | ||
@@ -6,0 +6,0 @@ export declare function jwk2priv(key: JsonWebKey): JWK; |
@@ -5,3 +5,3 @@ import 'node-forge/lib/util.js'; | ||
export declare function bigIntegerToUintBase64url(num: { | ||
abs: () => any; | ||
abs(): any; | ||
}, len?: number): string; | ||
@@ -8,0 +8,0 @@ export declare function base64urlToBigInteger(str: string): typeof forge.jsbn.BigInteger; |
{ | ||
"name": "@libp2p/crypto", | ||
"version": "2.0.4", | ||
"version": "2.0.5", | ||
"description": "Crypto primitives for libp2p", | ||
@@ -66,2 +66,3 @@ "license": "Apache-2.0 OR MIT", | ||
"parserOptions": { | ||
"project": true, | ||
"sourceType": "module" | ||
@@ -89,3 +90,3 @@ }, | ||
"dependencies": { | ||
"@libp2p/interface": "^0.1.2", | ||
"@libp2p/interface": "^0.1.3", | ||
"@noble/curves": "^1.1.0", | ||
@@ -101,3 +102,3 @@ "@noble/hashes": "^1.3.1", | ||
"@types/mocha": "^10.0.0", | ||
"aegir": "^40.0.8", | ||
"aegir": "^41.0.2", | ||
"benchmark": "^2.1.4", | ||
@@ -104,0 +105,0 @@ "protons": "^7.0.2" |
@@ -8,3 +8,3 @@ import 'node-forge/lib/aes.js' | ||
export interface Cipher { | ||
update: (data: Uint8Array) => Uint8Array | ||
update(data: Uint8Array): Uint8Array | ||
} | ||
@@ -11,0 +11,0 @@ |
@@ -5,4 +5,4 @@ import { cipherMode } from './cipher-mode.js' | ||
export interface AESCipher { | ||
encrypt: (data: Uint8Array) => Promise<Uint8Array> | ||
decrypt: (data: Uint8Array) => Promise<Uint8Array> | ||
encrypt(data: Uint8Array): Promise<Uint8Array> | ||
decrypt(data: Uint8Array): Promise<Uint8Array> | ||
} | ||
@@ -9,0 +9,0 @@ |
@@ -12,4 +12,4 @@ export interface CreateOptions { | ||
export interface AESCipher { | ||
encrypt: (data: Uint8Array, password: string | Uint8Array) => Promise<Uint8Array> | ||
decrypt: (data: Uint8Array, password: string | Uint8Array) => Promise<Uint8Array> | ||
encrypt(data: Uint8Array, password: string | Uint8Array): Promise<Uint8Array> | ||
decrypt(data: Uint8Array, password: string | Uint8Array): Promise<Uint8Array> | ||
} |
@@ -15,3 +15,3 @@ import webcrypto from '../webcrypto.js' | ||
export async function create (hashType: 'SHA1' | 'SHA256' | 'SHA512', secret: Uint8Array): Promise<{ digest: (data: Uint8Array) => Promise<Uint8Array>, length: number }> { | ||
export async function create (hashType: 'SHA1' | 'SHA256' | 'SHA512', secret: Uint8Array): Promise<{ digest(data: Uint8Array): Promise<Uint8Array>, length: number }> { | ||
const hash = hashTypes[hashType] | ||
@@ -18,0 +18,0 @@ |
@@ -5,3 +5,3 @@ import crypto from 'crypto' | ||
export interface HMAC { | ||
digest: (data: Uint8Array) => Promise<Uint8Array> | ||
digest(data: Uint8Array): Promise<Uint8Array> | ||
length: number | ||
@@ -8,0 +8,0 @@ } |
@@ -18,3 +18,3 @@ export interface JWKKeyPair { | ||
key: Uint8Array | ||
genSharedKey: (theirPub: Uint8Array, forcePrivate?: ECDHKeyPair) => Promise<Uint8Array> | ||
genSharedKey(theirPub: Uint8Array, forcePrivate?: ECDHKeyPair): Promise<Uint8Array> | ||
} | ||
@@ -21,0 +21,0 @@ |
@@ -7,4 +7,4 @@ import 'node-forge/lib/rsa.js' | ||
export interface JWK { | ||
encrypt: (msg: string) => string | ||
decrypt: (msg: string) => string | ||
encrypt(msg: string): string | ||
decrypt(msg: string): string | ||
} | ||
@@ -11,0 +11,0 @@ |
@@ -144,3 +144,3 @@ import { CodeError } from '@libp2p/interface/errors' | ||
function convertKey (key: JsonWebKey, pub: boolean, msg: Uint8Array, handle: (msg: string, key: { encrypt: (msg: string) => string, decrypt: (msg: string) => string }) => string): Uint8Array { | ||
function convertKey (key: JsonWebKey, pub: boolean, msg: Uint8Array, handle: (msg: string, key: { encrypt(msg: string): string, decrypt(msg: string): string }) => string): Uint8Array { | ||
const fkey = pub ? jwk2pub(key) : jwk2priv(key) | ||
@@ -147,0 +147,0 @@ const fmsg = uint8ArrayToString(Uint8Array.from(msg), 'ascii') |
@@ -9,3 +9,3 @@ import 'node-forge/lib/util.js' | ||
export function bigIntegerToUintBase64url (num: { abs: () => any }, len?: number): string { | ||
export function bigIntegerToUintBase64url (num: { abs(): any }, len?: number): string { | ||
// Call `.abs()` to convert to unsigned | ||
@@ -12,0 +12,0 @@ let buf = Uint8Array.from(num.abs().toByteArray()) // toByteArray converts to big endian |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
497349
Updated@libp2p/interface@^0.1.3