Skip to content

Commit

Permalink
Fixing import type declarations.
Browse files Browse the repository at this point in the history
  • Loading branch information
armfazh committed Jun 28, 2024
1 parent 5fcaca3 commit 436a8e0
Show file tree
Hide file tree
Showing 10 changed files with 23 additions and 32 deletions.
11 changes: 6 additions & 5 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
"root": true,
"parserOptions": {
"ecmaVersion": 2020,
"sourceType": "module"
"sourceType": "module",
"project": true
},
"extends": [
"eslint:recommended",
Expand Down Expand Up @@ -76,15 +77,15 @@
"error",
"never"
],
"@typescript-eslint/no-namespace": [
"warn"
],
"@typescript-eslint/no-namespace": "warn",
"@typescript-eslint/no-unused-vars": [
"error",
{
"argsIgnorePattern": "^_"
}
]
],
"@typescript-eslint/consistent-type-imports": "error",
"@typescript-eslint/consistent-type-exports": "error"
}
}
]
Expand Down
4 changes: 2 additions & 2 deletions bench/group.bench.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
// Licensed under the BSD-3-Clause license found in the LICENSE file or
// at https://opensource.org/licenses/BSD-3-Clause

import Benchmark from 'benchmark'
import { type CryptoProvider } from '@cloudflare/voprf-ts'
import type Benchmark from 'benchmark'
import type { CryptoProvider } from '../src/cryptoTypes.js'

function asyncFn(call: CallableFunction) {
return {
Expand Down
2 changes: 1 addition & 1 deletion bench/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { benchGroup } from './group.bench.js'
import { benchOPRF } from './oprf.bench.js'
import { getCryptoProviders } from './testProviders.js'

import { type CryptoProvider } from '../src/index.js'
import type { CryptoProvider } from '../src/cryptoTypes.js'

if (typeof crypto === 'undefined') {
Object.assign(global, { crypto: webcrypto })
Expand Down
2 changes: 1 addition & 1 deletion bench/oprf.bench.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
randomPrivateKey
} from '../src/index.js'

import Benchmark from 'benchmark'
import type Benchmark from 'benchmark'

function asyncFn(call: CallableFunction) {
return {
Expand Down
7 changes: 0 additions & 7 deletions bench/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
{
"extends": "../tsconfig.json",
"compilerOptions": {
"paths": {
"@cloudflare/voprf-ts": ["../src/index.js"],
"@cloudflare/voprf-ts/crypto-noble": ["../src/cryptoNoble.js"],
"@cloudflare/voprf-ts/facade": ["../src/facade/index.js"]
}
},
"include": ["."],
"references": [
{
Expand Down
10 changes: 2 additions & 8 deletions src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,8 @@
// at https://opensource.org/licenses/BSD-3-Clause

import type { Elt, Scalar } from './groupTypes.js'
import {
Evaluation,
EvaluationRequest,
FinalizeData,
type ModeID,
Oprf,
type SuiteID
} from './oprf.js'
import type { Evaluation, ModeID, SuiteID } from './oprf.js'
import { EvaluationRequest, FinalizeData, Oprf } from './oprf.js'

import { zip } from './util.js'
import type { CryptoProviderArg } from './cryptoImpl.js'
Expand Down
2 changes: 1 addition & 1 deletion src/keys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import { type ModeID, Oprf, type SuiteID } from './oprf.js'
import { joinAll, toU16LenPrefix } from './util.js'
import { type Scalar } from './groupTypes.js'
import type { Scalar } from './groupTypes.js'
import { type CryptoProviderArg, getSuiteGroup } from './cryptoImpl.js'

export function getKeySizes(id: SuiteID, ...arg: CryptoProviderArg): { Nsk: number; Npk: number } {
Expand Down
6 changes: 4 additions & 2 deletions src/noble/hashes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@

import { sha256 } from '@noble/hashes/sha256'
import { sha384, sha512 } from '@noble/hashes/sha512'
import { type CHash, Hash, wrapConstructor } from '@noble/hashes/utils'
import { Keccak, shake256 } from '@noble/hashes/sha3'
import type { Hash, CHash } from '@noble/hashes/utils'
import { wrapConstructor } from '@noble/hashes/utils'
import type { Keccak } from '@noble/hashes/sha3'
import { shake256 } from '@noble/hashes/sha3'
import type { HashID } from '../cryptoTypes.js'

export const shake256_512 = wrapConstructor<Hash<Keccak>>(() => shake256.create({ dkLen: 64 }))
Expand Down
8 changes: 4 additions & 4 deletions src/noble/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
// Licensed under the BSD-3-Clause license found in the LICENSE file or
// at https://opensource.org/licenses/BSD-3-Clause

import { Field } from '@noble/curves/abstract/modular'
import type { Field } from '@noble/curves/abstract/modular'
import type { CHash } from '@noble/hashes/utils'
import * as p256 from '@noble/curves/p256'
import * as ed25519 from '@noble/curves/ed25519'
import * as ed448 from '@noble/curves/ed448'
import type * as p256 from '@noble/curves/p256'
import type * as ed25519 from '@noble/curves/ed25519'
import type * as ed448 from '@noble/curves/ed448'
import type { Hex } from '@noble/curves/abstract/utils'

import type { HashID } from '../cryptoTypes.js'
Expand Down
3 changes: 2 additions & 1 deletion src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@

import { DLEQProver } from './dleq.js'
import type { Elt, Scalar } from './groupTypes.js'
import { Evaluation, EvaluationRequest, type ModeID, Oprf, type SuiteID } from './oprf.js'
import type { EvaluationRequest, ModeID, SuiteID } from './oprf.js'
import { Evaluation, Oprf } from './oprf.js'
import { ctEqual, zip } from './util.js'
import type { CryptoProviderArg } from './cryptoImpl.js'

Expand Down

0 comments on commit 436a8e0

Please sign in to comment.