Skip to content

Commit e804aab

Browse files
committed
Improve type stripping compat: Change .js extensions to .ts.
1 parent fa0955b commit e804aab

File tree

10 files changed

+28
-28
lines changed

10 files changed

+28
-28
lines changed

‎src/_arx.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ xchacha [^2] uses the subkey and remaining 8 byte nonce with ChaCha20 as normal
3636
3737
* @module
3838
*/
39-
import { abool, abytes, anumber } from './_assert.js';
40-
import { type XorStream, checkOpts, clean, copyBytes, u32 } from './utils.js';
39+
import { abool, abytes, anumber } from './_assert.ts';
40+
import { type XorStream, checkOpts, clean, copyBytes, u32 } from './utils.ts';
4141

4242
// We can't make top-level var depend on utils.utf8ToBytes
4343
// because it's not present in all envs. Creating a similar fn here

‎src/_micro.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
*/
77
/*! noble-ciphers - MIT License (c) 2023 Paul Miller (paulmillr.com) */
88
// prettier-ignore
9-
import { createCipher, rotl } from './_arx.js';
10-
import { abytes } from './_assert.js';
9+
import { createCipher, rotl } from './_arx.ts';
10+
import { abytes } from './_assert.ts';
1111
import {
1212
type Cipher,
1313
type XorStream,
@@ -19,7 +19,7 @@ import {
1919
numberToBytesBE,
2020
setBigUint64,
2121
wrapCipher,
22-
} from './utils.js';
22+
} from './utils.ts';
2323

2424
export type ARXCipherN = ((key: Uint8Array, nonce: Uint8Array, AAD?: Uint8Array) => Cipher) & {
2525
blockSize: number;

‎src/_poly1305.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
* Check out [original website](https://cr.yp.to/mac.html).
1717
* @module
1818
*/
19-
import { abytes, aexists, aoutput } from './_assert.js';
20-
import { Hash, type Input, clean, toBytes } from './utils.js';
19+
import { abytes, aexists, aoutput } from './_assert.ts';
20+
import { Hash, type Input, clean, toBytes } from './utils.ts';
2121

2222
// Based on Public Domain poly1305-donna https://github.com/floodyberry/poly1305-donna
2323
const u8to16 = (a: Uint8Array, i: number) => (a[i++] & 0xff) | ((a[i++] & 0xff) << 8);

‎src/_polyval.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
*
1313
* @module
1414
*/
15-
import { abytes, aexists, aoutput } from './_assert.js';
16-
import { clean, copyBytes, createView, Hash, type Input, toBytes, u32 } from './utils.js';
15+
import { abytes, aexists, aoutput } from './_assert.ts';
16+
import { clean, copyBytes, createView, Hash, type Input, toBytes, u32 } from './utils.ts';
1717

1818
const BLOCK_SIZE = 16;
1919
// TODO: rewrite

‎src/aes.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
* and [original proposal](https://csrc.nist.gov/csrc/media/projects/cryptographic-standards-and-guidelines/documents/aes-development/rijndael-ammended.pdf)
1515
* @module
1616
*/
17-
import { abytes } from './_assert.js';
18-
import { ghash, polyval } from './_polyval.js';
17+
import { abytes } from './_assert.ts';
18+
import { ghash, polyval } from './_polyval.ts';
1919
import {
2020
type Cipher,
2121
type CipherWithOutput,
@@ -32,7 +32,7 @@ import {
3232
u32,
3333
u8,
3434
wrapCipher,
35-
} from './utils.js';
35+
} from './utils.ts';
3636

3737
const BLOCK_SIZE = 16;
3838
const BLOCK_SIZE32 = 4;

‎src/chacha.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
* [wiki](https://en.wikipedia.org/wiki/Salsa20).
1313
* @module
1414
*/
15-
import { createCipher, rotl } from './_arx.js';
16-
import { poly1305 } from './_poly1305.js';
15+
import { createCipher, rotl } from './_arx.ts';
16+
import { poly1305 } from './_poly1305.ts';
1717
import {
1818
type ARXCipher,
1919
type CipherWithOutput,
@@ -24,7 +24,7 @@ import {
2424
getOutput,
2525
setBigUint64,
2626
wrapCipher,
27-
} from './utils.js';
27+
} from './utils.ts';
2828

2929
/**
3030
* ChaCha core function.

‎src/ff1.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
* [NIST 800-38G](https://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-38G.pdf).
44
* @module
55
*/
6-
import { abytes, anumber } from './_assert.js';
7-
import { unsafe } from './aes.js';
8-
import { type Cipher, bytesToNumberBE, clean, numberToBytesBE } from './utils.js';
6+
import { abytes, anumber } from './_assert.ts';
7+
import { unsafe } from './aes.ts';
8+
import { type Cipher, bytesToNumberBE, clean, numberToBytesBE } from './utils.ts';
99

1010
// NOTE: no point in inlining encrypt instead of encryptBlock, since BigInt stuff will be slow
1111
const { expandKeyLE, encryptBlock } = unsafe;

‎src/salsa.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313
* [wiki](https://en.wikipedia.org/wiki/Salsa20).
1414
* @module
1515
*/
16-
import { createCipher, rotl } from './_arx.js';
17-
import { abytes } from './_assert.js';
18-
import { poly1305 } from './_poly1305.js';
16+
import { createCipher, rotl } from './_arx.ts';
17+
import { abytes } from './_assert.ts';
18+
import { poly1305 } from './_poly1305.ts';
1919
import {
2020
type ARXCipher,
2121
type CipherWithOutput,
@@ -24,7 +24,7 @@ import {
2424
getOutput,
2525
wrapCipher,
2626
type XorStream,
27-
} from './utils.js';
27+
} from './utils.ts';
2828

2929
/**
3030
* Salsa20 core function.

‎src/utils.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* @module
44
*/
55
/*! noble-ciphers - MIT License (c) 2023 Paul Miller (paulmillr.com) */
6-
import { abytes, isBytes } from './_assert.js';
6+
import { abytes, isBytes } from './_assert.ts';
77
// prettier-ignore
88
export type TypedArray = Int8Array | Uint8ClampedArray | Uint8Array |
99
Uint16Array | Int16Array | Uint32Array | Int32Array;

‎src/webcrypto.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
*/
1111
// Use full path so that Node.js can rewrite it to `cryptoNode.js`.
1212
import { crypto } from '@noble/ciphers/crypto';
13-
import { abytes, anumber } from './_assert.js';
14-
import { type AsyncCipher, type Cipher, concatBytes } from './utils.js';
13+
import { abytes, anumber } from './_assert.ts';
14+
import { type AsyncCipher, type Cipher, concatBytes } from './utils.ts';
1515

1616
/**
1717
* Secure PRNG. Uses `crypto.getRandomValues`, which defers to OS.
@@ -153,9 +153,9 @@ export const gcm: (key: Uint8Array, nonce: Uint8Array, AAD?: Uint8Array) => Asyn
153153
/* @__PURE__ */ (() => generate(mode.GCM))();
154154

155155
// // Type tests
156-
// import { siv, gcm, ctr, ecb, cbc } from '../aes.js';
157-
// import { xsalsa20poly1305 } from '../salsa.js';
158-
// import { chacha20poly1305, xchacha20poly1305 } from '../chacha.js';
156+
// import { siv, gcm, ctr, ecb, cbc } from '../aes.ts';
157+
// import { xsalsa20poly1305 } from '../salsa.ts';
158+
// import { chacha20poly1305, xchacha20poly1305 } from '../chacha.ts';
159159

160160
// const wsiv = managedNonce(siv);
161161
// const wgcm = managedNonce(gcm);

0 commit comments

Comments
 (0)