Skip to content

Commit

Permalink
chore: use streaming hashes where possible
Browse files Browse the repository at this point in the history
  • Loading branch information
achingbrain committed Nov 25, 2023
1 parent c83354a commit 5b0d7d3
Show file tree
Hide file tree
Showing 561 changed files with 15,900 additions and 418 deletions.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export declare function cipherMode(key: Uint8Array): string;
//# sourceMappingURL=cipher-mode.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import 'node-forge/lib/aes.js';
export interface Cipher {
update(data: Uint8Array): Uint8Array;
}
export declare function createCipheriv(mode: any, key: Uint8Array, iv: Uint8Array): Cipher;
export declare function createDecipheriv(mode: any, key: Uint8Array, iv: Uint8Array): Cipher;
//# sourceMappingURL=ciphers-browser.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/// <reference types="node" />
import crypto from 'crypto';
export declare const createCipheriv: typeof crypto.createCipheriv;
export declare const createDecipheriv: typeof crypto.createDecipheriv;
//# sourceMappingURL=ciphers.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/**
* @packageDocumentation
*
* Exposes an interface to AES encryption (formerly Rijndael), as defined in U.S. Federal Information Processing Standards Publication 197.
*
* This uses `CTR` mode.
*
* /**
* @example
*
* ```js
* import { create } from '@libp2p/crypto/aes'
*
* // Setting up Key and IV
*
* // A 16 bytes array, 128 Bits, AES-128 is chosen
* const key128 = Uint8Array.from([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15])
*
* // A 16 bytes array, 128 Bits,
* const IV = Uint8Array.from([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15])
*
* const decryptedMessage = 'Hello, world!'
*
* // Encrypting
* const cipher = await crypto.aes.create(key128, IV)
* const encryptedBuffer = await encrypt(Uint8Array.from(decryptedMessage))
* console.log(encryptedBuffer)
* // prints: <Uint8Array 42 f1 67 d9 2e 42 d0 32 9e b1 f8 3c>
*
* // Decrypting
* const decipher = await crypto.aes.create(key128, IV)
* const decryptedBuffer = await decrypt(encryptedBuffer)
*
* console.log(decryptedBuffer)
* // prints: <Uint8Array 42 f1 67 d9 2e 42 d0 32 9e b1 f8 3c>
*
* console.log(decryptedBuffer.toString('utf-8'))
* // prints: Hello, world!
* ```
*/
export interface AESCipher {
encrypt(data: Uint8Array): Promise<Uint8Array>;
decrypt(data: Uint8Array): Promise<Uint8Array>;
}
/**
* @param key - The key, if length `16` then `AES 128` is used. For length `32`, `AES 256` is used
* @param iv - Must have length `16`
*/
export declare function create(key: Uint8Array, iv: Uint8Array): Promise<AESCipher>;
//# sourceMappingURL=index.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import type { CreateOptions, AESCipher } from './interface.js';
export declare const derivedEmptyPasswordKey: {
alg: string;
ext: boolean;
k: string;
key_ops: string[];
kty: string;
};
export declare function create(opts?: CreateOptions): AESCipher;
//# sourceMappingURL=aes-gcm.browser.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 5b0d7d3

Please sign in to comment.