diff --git a/.eslintrc.cjs b/.eslintrc.cjs index c88abe974..0dc144301 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -11,8 +11,16 @@ module.exports = { parserOptions: { sourceType: 'module', warnOnUnsupportedTypeScriptVersion: false, + project: 'tsconfig.json', }, rules: { + '@typescript-eslint/consistent-type-exports': [ + 'error', + { + fixMixedExportsWithInlineTypeSpecifier: false, + }, + ], + '@typescript-eslint/consistent-type-imports': 'error', 'prettier/prettier': 'error', 'jsdoc/require-jsdoc': 'off', 'jsdoc/require-description': 'off', diff --git a/bench/helpers.ts b/bench/helpers.ts index 441dca7a8..08f959bd1 100644 --- a/bench/helpers.ts +++ b/bench/helpers.ts @@ -1,6 +1,6 @@ import type Benchmark from 'benchmark' import { suite, save, cycle } from 'benny' -import { Config } from 'benny/lib/internal/common-types' +import type { Config } from 'benny/lib/internal/common-types' import crypto from '../src/crypto/crypto' import { PrivateKeyBundleV1 } from '../src/crypto/PrivateKeyBundle' import { newWallet } from '../test/helpers' diff --git a/src/ApiClient.ts b/src/ApiClient.ts index 9a5962306..6ffe2b34f 100644 --- a/src/ApiClient.ts +++ b/src/ApiClient.ts @@ -1,11 +1,11 @@ import { messageApi } from '@xmtp/proto' -import { NotifyStreamEntityArrival } from '@xmtp/proto/ts/dist/types/fetch.pb' +import type { NotifyStreamEntityArrival } from '@xmtp/proto/ts/dist/types/fetch.pb' import { b64Decode, retry, sleep, toNanoString } from './utils' import AuthCache from './authn/AuthCache' -import { Authenticator } from './authn' +import type { Authenticator } from './authn' import { version } from '../package.json' import { XMTP_DEV_WARNING } from './constants' -import { Flatten } from './utils/typedefs' +import type { Flatten } from './utils/typedefs' export const { MessageApi, SortDirection } = messageApi const RETRY_SLEEP_TIME = 100 diff --git a/src/Client.ts b/src/Client.ts index 4b915728e..e3f787068 100644 --- a/src/Client.ts +++ b/src/Client.ts @@ -1,51 +1,51 @@ import { PrivateKeyBundleV1 } from './crypto/PrivateKeyBundle' import { PublicKeyBundle, SignedPublicKeyBundle } from './crypto' +import type { + EnvelopeMapper, + EnvelopeMapperWithMessage, + EnvelopeWithMessage, +} from './utils' import { buildUserContactTopic, mapPaginatedStream, - EnvelopeMapper, buildUserInviteTopic, isBrowser, getSigner, - EnvelopeMapperWithMessage, - EnvelopeWithMessage, } from './utils' -import { Signer } from './types/Signer' +import type { Signer } from './types/Signer' import { Conversations } from './conversations' import { ContentTypeText, TextCodec } from './codecs/Text' -import { ContentTypeId, ContentCodec, EncodedContent } from './MessageContent' +import type { ContentCodec, EncodedContent } from './MessageContent' +import { ContentTypeId } from './MessageContent' import { compress, decompress } from './Compression' import { content as proto, messageApi } from '@xmtp/proto' import { decodeContactBundle, encodeContactBundle } from './ContactBundle' -import HttpApiClient, { - ApiUrls, - ApiClient, - PublishParams, - SortDirection, -} from './ApiClient' +import type { ApiClient, PublishParams } from './ApiClient' +import HttpApiClient, { ApiUrls, SortDirection } from './ApiClient' import { KeystoreAuthenticator } from './authn' -import { Flatten } from './utils/typedefs' -import BackupClient, { BackupType } from './message-backup/BackupClient' +import type { Flatten } from './utils/typedefs' +import type BackupClient from './message-backup/BackupClient' +import { BackupType } from './message-backup/BackupClient' import { createBackupClient } from './message-backup/BackupClientFactory' +import type { KeystoreProvider } from './keystore/providers' import { KeyGeneratorKeystoreProvider, - KeystoreProvider, KeystoreProviderUnavailableError, NetworkKeystoreProvider, SnapProvider, StaticKeystoreProvider, } from './keystore/providers' +import type { Persistence } from './keystore/persistence' import { BrowserStoragePersistence, InMemoryPersistence, - Persistence, } from './keystore/persistence' import { hasMetamaskWithSnaps } from './keystore/snapHelpers' import { packageName, version } from './snapInfo.json' -import { ExtractDecodedType } from './types/client' +import type { ExtractDecodedType } from './types/client' import { getAddress, type WalletClient } from 'viem' import { Contacts } from './Contacts' -import { KeystoreInterfaces } from './keystore/rpcDefinitions' +import type { KeystoreInterfaces } from './keystore/rpcDefinitions' const { Compression } = proto // eslint-disable @typescript-eslint/explicit-module-boundary-types diff --git a/src/Contacts.ts b/src/Contacts.ts index 5cbc63086..f5af16c6f 100644 --- a/src/Contacts.ts +++ b/src/Contacts.ts @@ -1,12 +1,9 @@ -import Client from './Client' +import type Client from './Client' import { privatePreferences } from '@xmtp/proto' -import { - EnvelopeWithMessage, - buildUserPrivatePreferencesTopic, - fromNanoString, -} from './utils' +import type { EnvelopeWithMessage } from './utils' +import { buildUserPrivatePreferencesTopic, fromNanoString } from './utils' import Stream from './Stream' -import { OnConnectionLostCallback } from './ApiClient' +import type { OnConnectionLostCallback } from './ApiClient' import JobRunner from './conversations/JobRunner' export type ConsentState = 'allowed' | 'denied' | 'unknown' diff --git a/src/Invitation.ts b/src/Invitation.ts index 07cecd8f5..efd9ba2d7 100644 --- a/src/Invitation.ts +++ b/src/Invitation.ts @@ -1,10 +1,11 @@ import Long from 'long' import { SignedPublicKeyBundle } from './crypto/PublicKeyBundle' -import { messageApi, invitation } from '@xmtp/proto' +import type { messageApi } from '@xmtp/proto' +import { invitation } from '@xmtp/proto' import crypto from './crypto/crypto' import Ciphertext from './crypto/Ciphertext' import { decrypt, encrypt } from './crypto' -import { PrivateKeyBundleV2 } from './crypto/PrivateKeyBundle' +import type { PrivateKeyBundleV2 } from './crypto/PrivateKeyBundle' import { dateToNs, buildDirectMessageTopicV2 } from './utils' export type InvitationContext = { diff --git a/src/Message.ts b/src/Message.ts index d32df3dc8..cedfd21e8 100644 --- a/src/Message.ts +++ b/src/Message.ts @@ -1,19 +1,17 @@ -import { - Conversation, - ConversationV1, - ConversationV2, -} from './conversations/Conversation' +import type { Conversation } from './conversations/Conversation' +import { ConversationV1, ConversationV2 } from './conversations/Conversation' import type Client from './Client' -import { message as proto, conversationReference } from '@xmtp/proto' +import type { conversationReference } from '@xmtp/proto' +import { message as proto } from '@xmtp/proto' import Long from 'long' import Ciphertext from './crypto/Ciphertext' import { PublicKeyBundle, PublicKey } from './crypto' import { bytesToHex } from './crypto/utils' import { sha256 } from './crypto/encryption' -import { ContentTypeId } from './MessageContent' +import type { ContentTypeId } from './MessageContent' import { dateToNs, nsToDate } from './utils' import { buildDecryptV1Request, getResultOrThrow } from './utils/keystore' -import { KeystoreInterfaces } from './keystore/rpcDefinitions' +import type { KeystoreInterfaces } from './keystore/rpcDefinitions' const headerBytesAndCiphertext = ( msg: proto.Message diff --git a/src/MessageContent.ts b/src/MessageContent.ts index 216016d78..5ac27029a 100644 --- a/src/MessageContent.ts +++ b/src/MessageContent.ts @@ -1,4 +1,4 @@ -import { content as proto } from '@xmtp/proto' +import type { content as proto } from '@xmtp/proto' // Represents proto.ContentTypeId export class ContentTypeId { diff --git a/src/PreparedMessage.ts b/src/PreparedMessage.ts index 0a59313da..3b6141bc1 100644 --- a/src/PreparedMessage.ts +++ b/src/PreparedMessage.ts @@ -1,7 +1,7 @@ -import { Envelope } from '@xmtp/proto/ts/dist/types/message_api/v1/message_api.pb' +import type { Envelope } from '@xmtp/proto/ts/dist/types/message_api/v1/message_api.pb' import { bytesToHex } from './crypto/utils' import { sha256 } from './crypto/encryption' -import { DecodedMessage } from './Message' +import type { DecodedMessage } from './Message' export class PreparedMessage { messageEnvelope: Envelope diff --git a/src/Stream.ts b/src/Stream.ts index 854113a31..f210ea961 100644 --- a/src/Stream.ts +++ b/src/Stream.ts @@ -1,6 +1,6 @@ -import { OnConnectionLostCallback, SubscriptionManager } from './ApiClient' -import Client from './Client' -import { messageApi } from '@xmtp/proto' +import type { OnConnectionLostCallback, SubscriptionManager } from './ApiClient' +import type Client from './Client' +import type { messageApi } from '@xmtp/proto' export type MessageDecoder = ( env: messageApi.Envelope diff --git a/src/authn/AuthCache.ts b/src/authn/AuthCache.ts index 875b4051c..397efdc9c 100644 --- a/src/authn/AuthCache.ts +++ b/src/authn/AuthCache.ts @@ -1,5 +1,5 @@ -import { Authenticator } from './interfaces' -import Token from './Token' +import type { Authenticator } from './interfaces' +import type Token from './Token' // Default to 10 seconds less than expected expiry to give some wiggle room near the end // https://github.com/xmtp/xmtp-node-go/blob/main/pkg/api/authentication.go#L18 diff --git a/src/authn/AuthData.ts b/src/authn/AuthData.ts index f290630a9..82439b57e 100644 --- a/src/authn/AuthData.ts +++ b/src/authn/AuthData.ts @@ -1,5 +1,5 @@ import { authn as authnProto } from '@xmtp/proto' -import Long from 'long' +import type Long from 'long' import { dateToNs } from '../utils/date' export default class AuthData implements authnProto.AuthData { diff --git a/src/authn/KeystoreAuthenticator.ts b/src/authn/KeystoreAuthenticator.ts index 0b505a57e..e0dc3c16b 100644 --- a/src/authn/KeystoreAuthenticator.ts +++ b/src/authn/KeystoreAuthenticator.ts @@ -1,7 +1,7 @@ -import { authn } from '@xmtp/proto' +import type { authn } from '@xmtp/proto' import { dateToNs } from '../utils' import Token from './Token' -import { +import type { KeystoreInterface, KeystoreInterfaces, } from '../keystore/rpcDefinitions' diff --git a/src/authn/LocalAuthenticator.ts b/src/authn/LocalAuthenticator.ts index bf8edcd66..924567688 100644 --- a/src/authn/LocalAuthenticator.ts +++ b/src/authn/LocalAuthenticator.ts @@ -1,6 +1,6 @@ import { authn, signature, publicKey } from '@xmtp/proto' import AuthData from './AuthData' -import { PrivateKey } from '../crypto' +import type { PrivateKey } from '../crypto' import Token from './Token' import { hexToBytes, keccak256 } from 'viem' diff --git a/src/authn/Token.ts b/src/authn/Token.ts index 472101eb1..f53ac5324 100644 --- a/src/authn/Token.ts +++ b/src/authn/Token.ts @@ -1,4 +1,5 @@ -import { authn, signature, publicKey } from '@xmtp/proto' +import type { signature, publicKey } from '@xmtp/proto' +import { authn } from '@xmtp/proto' import AuthData from './AuthData' export default class Token implements authn.Token { diff --git a/src/authn/interfaces.ts b/src/authn/interfaces.ts index 8525d7166..53ee2f0d1 100644 --- a/src/authn/interfaces.ts +++ b/src/authn/interfaces.ts @@ -1,4 +1,4 @@ -import Token from './Token' +import type Token from './Token' export interface Authenticator { createToken(timestamp?: Date): Promise diff --git a/src/codecs/Composite.ts b/src/codecs/Composite.ts index 1a8c13178..582467d61 100644 --- a/src/codecs/Composite.ts +++ b/src/codecs/Composite.ts @@ -1,10 +1,9 @@ -/* eslint-disable camelcase */ -import { - ContentTypeId, +import type { ContentCodec, EncodedContent, CodecRegistry, } from '../MessageContent' +import { ContentTypeId } from '../MessageContent' import { composite as proto } from '@xmtp/proto' // xmtp.org/composite diff --git a/src/codecs/Text.ts b/src/codecs/Text.ts index b93c5358e..598b5a7b6 100644 --- a/src/codecs/Text.ts +++ b/src/codecs/Text.ts @@ -1,4 +1,5 @@ -import { ContentTypeId, ContentCodec, EncodedContent } from '../MessageContent' +import type { ContentCodec, EncodedContent } from '../MessageContent' +import { ContentTypeId } from '../MessageContent' // xmtp.org/text // diff --git a/src/conversations/Conversation.ts b/src/conversations/Conversation.ts index 05b7dc107..13ca2872e 100644 --- a/src/conversations/Conversation.ts +++ b/src/conversations/Conversation.ts @@ -1,4 +1,4 @@ -import { OnConnectionLostCallback } from './../ApiClient' +import type { OnConnectionLostCallback } from './../ApiClient' import { buildUserIntroTopic, buildDirectMessageTopic, @@ -7,20 +7,16 @@ import { toNanoString, } from '../utils' import Stream from '../Stream' -import Client, { +import type { ListMessagesOptions, ListMessagesPaginatedOptions, SendOptions, } from '../Client' -import { InvitationContext } from '../Invitation' +import type Client from '../Client' +import type { InvitationContext } from '../Invitation' import { DecodedMessage, MessageV1, MessageV2 } from '../Message' -import { - messageApi, - message, - content as proto, - keystore, - ciphertext, -} from '@xmtp/proto' +import type { messageApi, keystore, ciphertext } from '@xmtp/proto' +import { message, content as proto } from '@xmtp/proto' import { SignedPublicKey, Signature, @@ -31,7 +27,7 @@ import { PreparedMessage } from '../PreparedMessage' import { sha256 } from '../crypto/encryption' import { buildDecryptV1Request, getResultOrThrow } from '../utils/keystore' import { ContentTypeText } from '../codecs/Text' -import { ConsentState } from '../Contacts' +import type { ConsentState } from '../Contacts' import { getAddress } from 'viem' /** diff --git a/src/conversations/Conversations.ts b/src/conversations/Conversations.ts index a4706587f..8043d3f5a 100644 --- a/src/conversations/Conversations.ts +++ b/src/conversations/Conversations.ts @@ -1,12 +1,13 @@ -import { OnConnectionLostCallback } from './../ApiClient' -import { messageApi, keystore, conversationReference } from '@xmtp/proto' +import type { OnConnectionLostCallback } from './../ApiClient' +import type { messageApi, keystore, conversationReference } from '@xmtp/proto' import { SignedPublicKeyBundle } from './../crypto/PublicKeyBundle' -import { ListMessagesOptions } from './../Client' -import { InvitationContext } from './../Invitation' -import { Conversation, ConversationV1, ConversationV2 } from './Conversation' +import type { ListMessagesOptions } from './../Client' +import type { InvitationContext } from './../Invitation' +import type { Conversation } from './Conversation' +import { ConversationV1, ConversationV2 } from './Conversation' import { MessageV1, DecodedMessage } from '../Message' import Stream from '../Stream' -import Client from '../Client' +import type Client from '../Client' import { buildDirectMessageTopic, buildUserIntroTopic, diff --git a/src/conversations/JobRunner.ts b/src/conversations/JobRunner.ts index 3f86d166f..6a7e0aa99 100644 --- a/src/conversations/JobRunner.ts +++ b/src/conversations/JobRunner.ts @@ -2,7 +2,7 @@ import { keystore } from '@xmtp/proto' import { Mutex } from 'async-mutex' import Long from 'long' import { dateToNs, nsToDate } from '../utils' -import { KeystoreInterfaces } from '../keystore/rpcDefinitions' +import type { KeystoreInterfaces } from '../keystore/rpcDefinitions' const CLOCK_SKEW_OFFSET_MS = 10000 diff --git a/src/conversations/index.ts b/src/conversations/index.ts index 576073d6a..37fd7b94a 100644 --- a/src/conversations/index.ts +++ b/src/conversations/index.ts @@ -1,2 +1,3 @@ export { default as Conversations } from './Conversations' -export { Conversation, ConversationV1, ConversationV2 } from './Conversation' +export type { Conversation } from './Conversation' +export { ConversationV1, ConversationV2 } from './Conversation' diff --git a/src/crypto/PrivateKey.ts b/src/crypto/PrivateKey.ts index f583e3078..be2a88724 100644 --- a/src/crypto/PrivateKey.ts +++ b/src/crypto/PrivateKey.ts @@ -1,13 +1,10 @@ import { privateKey } from '@xmtp/proto' import * as secp from '@noble/secp256k1' import Long from 'long' -import Signature, { - ECDSACompactWithRecovery, - ecdsaSignerKey, - KeySigner, -} from './Signature' +import type { ECDSACompactWithRecovery, KeySigner } from './Signature' +import Signature, { ecdsaSignerKey } from './Signature' import { PublicKey, SignedPublicKey, UnsignedPublicKey } from './PublicKey' -import Ciphertext from './Ciphertext' +import type Ciphertext from './Ciphertext' import { decrypt, encrypt, sha256 } from './encryption' import { equalBytes } from './utils' diff --git a/src/crypto/PrivateKeyBundle.ts b/src/crypto/PrivateKeyBundle.ts index 024d3762a..1b8cf5360 100644 --- a/src/crypto/PrivateKeyBundle.ts +++ b/src/crypto/PrivateKeyBundle.ts @@ -1,9 +1,9 @@ import { privateKey as proto } from '@xmtp/proto' import { PrivateKey, SignedPrivateKey } from './PrivateKey' import { WalletSigner } from './Signature' -import { PublicKey, SignedPublicKey } from './PublicKey' +import type { PublicKey, SignedPublicKey } from './PublicKey' import { PublicKeyBundle, SignedPublicKeyBundle } from './PublicKeyBundle' -import { Signer } from '../types/Signer' +import type { Signer } from '../types/Signer' import { NoMatchingPreKeyError } from './errors' // PrivateKeyBundle bundles the private keys corresponding to a PublicKeyBundle for convenience. diff --git a/src/crypto/PublicKey.ts b/src/crypto/PublicKey.ts index 2d284e993..7f1dc65f5 100644 --- a/src/crypto/PublicKey.ts +++ b/src/crypto/PublicKey.ts @@ -3,9 +3,10 @@ import * as secp from '@noble/secp256k1' import Long from 'long' import Signature, { WalletSigner } from './Signature' import { computeAddress, equalBytes, splitSignature } from './utils' -import { Signer } from '../types/Signer' +import type { Signer } from '../types/Signer' import { sha256 } from './encryption' -import { hashMessage, Hex, hexToBytes } from 'viem' +import type { Hex } from 'viem' +import { hashMessage, hexToBytes } from 'viem' // SECP256k1 public key in uncompressed format with prefix type secp256k1Uncompressed = { diff --git a/src/crypto/Signature.ts b/src/crypto/Signature.ts index 55e0cfea1..5bcee93b0 100644 --- a/src/crypto/Signature.ts +++ b/src/crypto/Signature.ts @@ -3,9 +3,10 @@ import Long from 'long' import * as secp from '@noble/secp256k1' import { PublicKey, UnsignedPublicKey, SignedPublicKey } from './PublicKey' import { SignedPrivateKey } from './PrivateKey' -import { Signer } from '../types/Signer' +import type { Signer } from '../types/Signer' import { bytesToHex, equalBytes, splitSignature } from './utils' -import { Hex, hashMessage, hexToBytes } from 'viem' +import type { Hex } from 'viem' +import { hashMessage, hexToBytes } from 'viem' // ECDSA signature with recovery bit. export type ECDSACompactWithRecovery = { diff --git a/src/crypto/SignedEciesCiphertext.ts b/src/crypto/SignedEciesCiphertext.ts index f5d72d4e5..992428b39 100644 --- a/src/crypto/SignedEciesCiphertext.ts +++ b/src/crypto/SignedEciesCiphertext.ts @@ -1,7 +1,7 @@ import { ciphertext } from '@xmtp/proto' import { sha256 } from './encryption' -import { PrivateKey, SignedPrivateKey } from './PrivateKey' -import { PublicKey, SignedPublicKey } from './PublicKey' +import type { PrivateKey, SignedPrivateKey } from './PrivateKey' +import type { PublicKey, SignedPublicKey } from './PublicKey' import Signature from './Signature' const IV_LENGTH = 16 diff --git a/src/crypto/encryption.ts b/src/crypto/encryption.ts index 8398cd8f2..f8fbd6a7f 100644 --- a/src/crypto/encryption.ts +++ b/src/crypto/encryption.ts @@ -1,4 +1,4 @@ -import { ciphertext } from '@xmtp/proto' +import type { ciphertext } from '@xmtp/proto' import Ciphertext, { AESGCMNonceSize, KDFSaltSize } from './Ciphertext' import crypto from './crypto' diff --git a/src/crypto/errors.ts b/src/crypto/errors.ts index e61f7a3c4..dca646580 100644 --- a/src/crypto/errors.ts +++ b/src/crypto/errors.ts @@ -1,4 +1,4 @@ -import { PublicKey, SignedPublicKey } from './PublicKey' +import type { PublicKey, SignedPublicKey } from './PublicKey' import { bytesToHex } from './utils' export class NoMatchingPreKeyError extends Error { diff --git a/src/crypto/index.ts b/src/crypto/index.ts index bbdc493ca..4a5ce6f2b 100644 --- a/src/crypto/index.ts +++ b/src/crypto/index.ts @@ -1,9 +1,9 @@ import { PublicKeyBundle, SignedPublicKeyBundle } from './PublicKeyBundle' import { SignedPrivateKey, PrivateKey } from './PrivateKey' +import type { PrivateKeyBundle } from './PrivateKeyBundle' import { PrivateKeyBundleV1, PrivateKeyBundleV2, - PrivateKeyBundle, decodePrivateKeyBundle, } from './PrivateKeyBundle' import { UnsignedPublicKey, SignedPublicKey, PublicKey } from './PublicKey' @@ -13,6 +13,7 @@ import { encrypt, decrypt } from './encryption' import Ciphertext from './Ciphertext' import SignedEciesCiphertext from './SignedEciesCiphertext' +export type { PrivateKeyBundle } export { utils, encrypt, @@ -25,7 +26,6 @@ export { PublicKeyBundle, PrivateKey, SignedPrivateKey, - PrivateKeyBundle, decodePrivateKeyBundle, PrivateKeyBundleV1, PrivateKeyBundleV2, diff --git a/src/crypto/selfEncryption.browser.ts b/src/crypto/selfEncryption.browser.ts index d4087f701..f3f5e3f26 100644 --- a/src/crypto/selfEncryption.browser.ts +++ b/src/crypto/selfEncryption.browser.ts @@ -10,7 +10,7 @@ import init, { // eslint-disable-next-line camelcase user_preferences_encrypt, } from '@xmtp/user-preferences-bindings-wasm/web' -import { PrivateKey } from './PrivateKey' +import type { PrivateKey } from './PrivateKey' export async function userPreferencesEncrypt( identityKey: PrivateKey, diff --git a/src/crypto/selfEncryption.bundler.ts b/src/crypto/selfEncryption.bundler.ts index 8b540532d..aff53ddf3 100644 --- a/src/crypto/selfEncryption.bundler.ts +++ b/src/crypto/selfEncryption.bundler.ts @@ -10,7 +10,7 @@ import { // eslint-disable-next-line camelcase user_preferences_encrypt, } from '@xmtp/user-preferences-bindings-wasm/bundler' -import { PrivateKey } from './PrivateKey' +import type { PrivateKey } from './PrivateKey' export async function userPreferencesEncrypt( identityKey: PrivateKey, diff --git a/src/crypto/selfEncryption.ts b/src/crypto/selfEncryption.ts index f6a5cefa3..9917c43f2 100644 --- a/src/crypto/selfEncryption.ts +++ b/src/crypto/selfEncryption.ts @@ -6,7 +6,7 @@ import { // eslint-disable-next-line camelcase user_preferences_encrypt, } from '@xmtp/user-preferences-bindings-wasm' -import { PrivateKey } from '../crypto' +import type { PrivateKey } from '../crypto' export async function userPreferencesEncrypt( identityKey: PrivateKey, diff --git a/src/crypto/utils.ts b/src/crypto/utils.ts index 4fe5381ae..c44039f8e 100644 --- a/src/crypto/utils.ts +++ b/src/crypto/utils.ts @@ -1,6 +1,6 @@ import * as secp from '@noble/secp256k1' +import type { Hex } from 'viem' import { - Hex, getAddress, hexToSignature, keccak256, diff --git a/src/index.ts b/src/index.ts index 584796c5c..563c7d7b7 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,10 +1,6 @@ -export { - Message, - DecodedMessage, - MessageV1, - MessageV2, - decodeContent, -} from './Message' +export type { Message } from './Message' +export { DecodedMessage, MessageV1, MessageV2, decodeContent } from './Message' +export type { PrivateKeyBundle } from './crypto' export { Ciphertext, PublicKey, @@ -12,7 +8,6 @@ export { SignedPublicKey, SignedPublicKeyBundle, PrivateKey, - PrivateKeyBundle, PrivateKeyBundleV1, PrivateKeyBundleV2, Signature, @@ -20,15 +15,12 @@ export { decrypt, } from './crypto' export { default as Stream } from './Stream' -export { Signer } from './types/Signer' -export { - default as Client, - defaultKeystoreProviders, +export type { Signer } from './types/Signer' +export type { ClientOptions, ListMessagesOptions, ListMessagesPaginatedOptions, SendOptions, - Compression, NetworkOptions, ContentOptions, KeyStoreOptions, @@ -36,28 +28,22 @@ export { XmtpEnv, } from './Client' export { - Conversations, - Conversation, - ConversationV1, - ConversationV2, -} from './conversations' -export { + default as Client, + defaultKeystoreProviders, + Compression, +} from './Client' +export type { Conversation } from './conversations' +export { Conversations, ConversationV1, ConversationV2 } from './conversations' +export type { CodecRegistry, - ContentTypeId, ContentCodec, EncodedContent, - ContentTypeFallback, } from './MessageContent' +export { ContentTypeId, ContentTypeFallback } from './MessageContent' export { TextCodec, ContentTypeText } from './codecs/Text' -export { - Composite, - CompositeCodec, - ContentTypeComposite, -} from './codecs/Composite' -export { - default as HttpApiClient, - ApiUrls, - SortDirection, +export type { Composite } from './codecs/Composite' +export { CompositeCodec, ContentTypeComposite } from './codecs/Composite' +export type { ApiClient, QueryParams, QueryAllOptions, @@ -70,7 +56,9 @@ export { UnsubscribeFn, OnConnectionLostCallback, } from './ApiClient' -export { Authenticator, AuthCache, LocalAuthenticator } from './authn' +export { default as HttpApiClient, ApiUrls, SortDirection } from './ApiClient' +export type { Authenticator } from './authn' +export { AuthCache, LocalAuthenticator } from './authn' export { nsToDate, dateToNs, @@ -86,10 +74,9 @@ export { buildUserInviteTopic, buildUserPrivateStoreTopic, } from './utils' -export { Keystore, InMemoryKeystore, TopicData } from './keystore' -export { - apiDefs as keystoreApiDefs, - snapApiDefs as snapKeystoreApiDefs, +export type { Keystore, TopicData } from './keystore' +export { InMemoryKeystore } from './keystore' +export type { KeystoreApiDefs, KeystoreApiEntries, KeystoreApiMethods, @@ -111,20 +98,25 @@ export { SnapKeystoreInterfaceRequestValues, } from './keystore/rpcDefinitions' export { - KeystoreProvider, + apiDefs as keystoreApiDefs, + snapApiDefs as snapKeystoreApiDefs, +} from './keystore/rpcDefinitions' +export type { KeystoreProvider } from './keystore/providers' +export { KeyGeneratorKeystoreProvider, NetworkKeystoreProvider, StaticKeystoreProvider, SnapProvider, } from './keystore/providers' +export type { Persistence } from './keystore/persistence' export { EncryptedPersistence, BrowserStoragePersistence, InMemoryPersistence, PrefixedPersistence, - Persistence, } from './keystore/persistence' -export { InvitationContext, SealedInvitation, InvitationV1 } from './Invitation' +export type { InvitationContext } from './Invitation' +export { SealedInvitation, InvitationV1 } from './Invitation' export { decodeContactBundle } from './ContactBundle' export type { GetMessageContentTypeFromClient, diff --git a/src/keystore/InMemoryKeystore.ts b/src/keystore/InMemoryKeystore.ts index 71b8531c9..4fa1c9c9f 100644 --- a/src/keystore/InMemoryKeystore.ts +++ b/src/keystore/InMemoryKeystore.ts @@ -1,11 +1,10 @@ -import { authn, keystore, privateKey, signature } from '@xmtp/proto' -import { - PrivateKeyBundleV1, - PrivateKeyBundleV2, -} from './../crypto/PrivateKeyBundle' +import type { authn, privateKey, signature } from '@xmtp/proto' +import { keystore } from '@xmtp/proto' +import type { PrivateKeyBundleV1 } from './../crypto/PrivateKeyBundle' +import { PrivateKeyBundleV2 } from './../crypto/PrivateKeyBundle' import { InvitationV1, SealedInvitation } from './../Invitation' -import { PrivateKey, PublicKeyBundle } from '../crypto' -import { TopicData } from './interfaces' +import type { PrivateKey, PublicKeyBundle } from '../crypto' +import type { TopicData } from './interfaces' import { decryptV1, encryptV1, encryptV2, decryptV2 } from './encryption' import { KeystoreError } from './errors' import { @@ -22,8 +21,9 @@ import { buildDirectMessageTopicV2, buildDirectMessageTopic, } from '../utils' -import { AddRequest, V1Store, V2Store } from './conversationStores' -import { Persistence } from './persistence' +import type { AddRequest } from './conversationStores' +import { V1Store, V2Store } from './conversationStores' +import type { Persistence } from './persistence' import LocalAuthenticator from '../authn/LocalAuthenticator' import { hmacSha256Sign } from '../crypto/ecies' import crypto from '../crypto/crypto' @@ -34,7 +34,7 @@ import { userPreferencesEncrypt, generateUserPreferencesTopic, } from '../crypto/selfEncryption' -import { KeystoreInterface } from '..' +import type { KeystoreInterface } from '..' const { ErrorCode } = keystore diff --git a/src/keystore/SnapKeystore.ts b/src/keystore/SnapKeystore.ts index 3713c75a9..708c28c99 100644 --- a/src/keystore/SnapKeystore.ts +++ b/src/keystore/SnapKeystore.ts @@ -1,11 +1,12 @@ -import { SnapMeta, snapRPC } from './snapHelpers' +import type { SnapMeta } from './snapHelpers' +import { snapRPC } from './snapHelpers' import type { XmtpEnv } from '../Client' -import { +import type { SnapKeystoreApiEntries, SnapKeystoreApiRequestValues, SnapKeystoreInterface, - snapApiDefs, } from './rpcDefinitions' +import { snapApiDefs } from './rpcDefinitions' export function SnapKeystore( walletAddress: string, diff --git a/src/keystore/conversationStores.ts b/src/keystore/conversationStores.ts index 2f64a881b..129ca4c2a 100644 --- a/src/keystore/conversationStores.ts +++ b/src/keystore/conversationStores.ts @@ -1,6 +1,7 @@ -import Long from 'long' -import { keystore, invitation } from '@xmtp/proto' -import { Persistence } from './persistence/interface' +import type Long from 'long' +import type { invitation } from '@xmtp/proto' +import { keystore } from '@xmtp/proto' +import type { Persistence } from './persistence/interface' import { Mutex } from 'async-mutex' import { isCompleteTopicData, topicDataToMap } from './utils' import { numberToUint8Array, uint8ArrayToNumber } from '../utils' diff --git a/src/keystore/encryption.ts b/src/keystore/encryption.ts index c0f6e5143..b3ef3dfdc 100644 --- a/src/keystore/encryption.ts +++ b/src/keystore/encryption.ts @@ -1,10 +1,6 @@ -import { - PublicKeyBundle, - encrypt, - PrivateKeyBundleV1, - decrypt, -} from '../crypto' -import { ciphertext } from '@xmtp/proto' +import type { PublicKeyBundle, PrivateKeyBundleV1 } from '../crypto' +import { encrypt, decrypt } from '../crypto' +import type { ciphertext } from '@xmtp/proto' export const decryptV1 = async ( myKeys: PrivateKeyBundleV1, diff --git a/src/keystore/errors.ts b/src/keystore/errors.ts index 648403e98..e870f86e1 100644 --- a/src/keystore/errors.ts +++ b/src/keystore/errors.ts @@ -1,4 +1,4 @@ -import { keystore } from '@xmtp/proto' +import type { keystore } from '@xmtp/proto' export class KeystoreError extends Error implements keystore.KeystoreError { code: keystore.ErrorCode diff --git a/src/keystore/interfaces.ts b/src/keystore/interfaces.ts index 7ea373309..d3052c4c0 100644 --- a/src/keystore/interfaces.ts +++ b/src/keystore/interfaces.ts @@ -1,5 +1,11 @@ -import { keystore, publicKey, authn, privateKey, signature } from '@xmtp/proto' -import { WithoutUndefined } from '../utils/typedefs' +import type { + keystore, + publicKey, + authn, + privateKey, + signature, +} from '@xmtp/proto' +import type { WithoutUndefined } from '../utils/typedefs' /** * A Keystore is responsible for holding the user's XMTP private keys and using them to encrypt/decrypt/sign messages. diff --git a/src/keystore/persistence/BrowserStoragePersistence.ts b/src/keystore/persistence/BrowserStoragePersistence.ts index ef4d82db4..fc0492de5 100644 --- a/src/keystore/persistence/BrowserStoragePersistence.ts +++ b/src/keystore/persistence/BrowserStoragePersistence.ts @@ -1,4 +1,4 @@ -import { Persistence } from './interface' +import type { Persistence } from './interface' export default class BrowserStoragePersistence implements Persistence { storage: Storage diff --git a/src/keystore/persistence/EncryptedPersistence.ts b/src/keystore/persistence/EncryptedPersistence.ts index 95611b4ee..148567564 100644 --- a/src/keystore/persistence/EncryptedPersistence.ts +++ b/src/keystore/persistence/EncryptedPersistence.ts @@ -1,10 +1,8 @@ -import { Persistence } from './interface' -import { Ecies, getPublic, encrypt, decrypt } from '../../crypto/ecies' -import { - PrivateKey, - SignedEciesCiphertext, - SignedPrivateKey, -} from '../../crypto' +import type { Persistence } from './interface' +import type { Ecies } from '../../crypto/ecies' +import { getPublic, encrypt, decrypt } from '../../crypto/ecies' +import type { PrivateKey, SignedPrivateKey } from '../../crypto' +import { SignedEciesCiphertext } from '../../crypto' /** * EncryptedPersistence is a Persistence implementation that uses ECIES to encrypt all values diff --git a/src/keystore/persistence/PrefixedPersistence.ts b/src/keystore/persistence/PrefixedPersistence.ts index 7d4840538..01c854dc4 100644 --- a/src/keystore/persistence/PrefixedPersistence.ts +++ b/src/keystore/persistence/PrefixedPersistence.ts @@ -1,4 +1,4 @@ -import { Persistence } from './interface' +import type { Persistence } from './interface' export default class PrefixedPersistence { prefix: string diff --git a/src/keystore/persistence/TopicPersistence.ts b/src/keystore/persistence/TopicPersistence.ts index 65fc04ca8..da77c1d51 100644 --- a/src/keystore/persistence/TopicPersistence.ts +++ b/src/keystore/persistence/TopicPersistence.ts @@ -1,8 +1,8 @@ import { messageApi } from '@xmtp/proto' import type { ApiClient } from '../../ApiClient' -import { Authenticator } from '../../authn' +import type { Authenticator } from '../../authn' import { buildUserPrivateStoreTopic } from '../../utils/topic' -import { Persistence } from './interface' +import type { Persistence } from './interface' export default class TopicPersistence implements Persistence { apiClient: ApiClient diff --git a/src/keystore/providers/KeyGeneratorKeystoreProvider.ts b/src/keystore/providers/KeyGeneratorKeystoreProvider.ts index 0fbf4d88d..0aa28d67f 100644 --- a/src/keystore/providers/KeyGeneratorKeystoreProvider.ts +++ b/src/keystore/providers/KeyGeneratorKeystoreProvider.ts @@ -1,4 +1,4 @@ -import { ApiClient } from '../../ApiClient' +import type { ApiClient } from '../../ApiClient' import { PrivateKeyBundleV1 } from '../../crypto' import InMemoryKeystore from '../InMemoryKeystore' import TopicPersistence from '../persistence/TopicPersistence' @@ -7,7 +7,7 @@ import { buildPersistenceFromOptions } from './helpers' import NetworkKeyManager from './NetworkKeyManager' import type { Signer } from '../../types/Signer' import type { KeystoreProvider, KeystoreProviderOptions } from './interfaces' -import { KeystoreInterface } from '../rpcDefinitions' +import type { KeystoreInterface } from '../rpcDefinitions' /** * KeyGeneratorKeystoreProvider will create a new XMTP `PrivateKeyBundle` and persist it to the network diff --git a/src/keystore/providers/NetworkKeyManager.ts b/src/keystore/providers/NetworkKeyManager.ts index 065946bde..9120edb1f 100644 --- a/src/keystore/providers/NetworkKeyManager.ts +++ b/src/keystore/providers/NetworkKeyManager.ts @@ -1,4 +1,4 @@ -import { Signer } from '../../types/Signer' +import type { Signer } from '../../types/Signer' import crypto from '../../crypto/crypto' import { PrivateKeyBundleV1, @@ -12,8 +12,9 @@ import { LocalAuthenticator } from '../../authn' import { bytesToHex } from '../../crypto/utils' import Ciphertext from '../../crypto/Ciphertext' import { privateKey as proto } from '@xmtp/proto' -import TopicPersistence from '../persistence/TopicPersistence' -import { Hex, getAddress, hexToBytes, verifyMessage } from 'viem' +import type TopicPersistence from '../persistence/TopicPersistence' +import type { Hex } from 'viem' +import { getAddress, hexToBytes, verifyMessage } from 'viem' const KEY_BUNDLE_NAME = 'key_bundle' /** diff --git a/src/keystore/providers/NetworkKeystoreProvider.ts b/src/keystore/providers/NetworkKeystoreProvider.ts index 96e06df27..d4073e6fa 100644 --- a/src/keystore/providers/NetworkKeystoreProvider.ts +++ b/src/keystore/providers/NetworkKeystoreProvider.ts @@ -1,12 +1,12 @@ -import { Signer } from './../../types/Signer' +import type { Signer } from './../../types/Signer' import type { ApiClient } from '../../ApiClient' -import { KeystoreProvider, KeystoreProviderOptions } from './interfaces' +import type { KeystoreProvider, KeystoreProviderOptions } from './interfaces' import NetworkKeyLoader from './NetworkKeyManager' import { KeystoreProviderUnavailableError } from './errors' import TopicPersistence from '../persistence/TopicPersistence' import InMemoryKeystore from '../InMemoryKeystore' import { buildPersistenceFromOptions } from './helpers' -import { KeystoreInterface } from '../rpcDefinitions' +import type { KeystoreInterface } from '../rpcDefinitions' /** * NetworkKeystoreProvider will look on the XMTP network for an `EncryptedPrivateKeyBundle` diff --git a/src/keystore/providers/SnapProvider.ts b/src/keystore/providers/SnapProvider.ts index 54610bf26..806057830 100644 --- a/src/keystore/providers/SnapProvider.ts +++ b/src/keystore/providers/SnapProvider.ts @@ -1,5 +1,5 @@ import { KeystoreProviderUnavailableError } from './errors' -import { KeystoreProvider, KeystoreProviderOptions } from './interfaces' +import type { KeystoreProvider, KeystoreProviderOptions } from './interfaces' import { SnapKeystore } from '../SnapKeystore' import { connectSnap, @@ -9,14 +9,14 @@ import { initSnap, } from '../snapHelpers' import { keystore } from '@xmtp/proto' -import { Signer } from '../../types/Signer' -import { ApiClient } from '../../ApiClient' +import type { Signer } from '../../types/Signer' +import type { ApiClient } from '../../ApiClient' import NetworkKeystoreProvider from './NetworkKeystoreProvider' import { PrivateKeyBundleV1, decodePrivateKeyBundle } from '../../crypto' import KeyGeneratorKeystoreProvider from './KeyGeneratorKeystoreProvider' import type { XmtpEnv } from '../../Client' import { semverGreaterThan } from '../../utils/semver' -import { SnapKeystoreInterface } from '../rpcDefinitions' +import type { SnapKeystoreInterface } from '../rpcDefinitions' const { GetKeystoreStatusResponse_KeystoreStatus: KeystoreStatus } = keystore export const SNAP_LOCAL_ORIGIN = 'local:http://localhost:8080' diff --git a/src/keystore/providers/StaticKeystoreProvider.ts b/src/keystore/providers/StaticKeystoreProvider.ts index f4ade4596..25b535c41 100644 --- a/src/keystore/providers/StaticKeystoreProvider.ts +++ b/src/keystore/providers/StaticKeystoreProvider.ts @@ -6,7 +6,7 @@ import { PrivateKeyBundleV2, } from '../../crypto/PrivateKeyBundle' import { buildPersistenceFromOptions } from './helpers' -import { KeystoreInterface } from '../rpcDefinitions' +import type { KeystoreInterface } from '../rpcDefinitions' /** * StaticKeystoreProvider will look for a `privateKeyOverride` in the provided options, diff --git a/src/keystore/providers/helpers.ts b/src/keystore/providers/helpers.ts index 5707dc8ed..11717a9a8 100644 --- a/src/keystore/providers/helpers.ts +++ b/src/keystore/providers/helpers.ts @@ -1,7 +1,7 @@ -import { PrivateKeyBundleV2 } from './../../crypto/PrivateKeyBundle' -import { PrivateKeyBundleV1 } from '../../crypto/PrivateKeyBundle' +import type { PrivateKeyBundleV2 } from './../../crypto/PrivateKeyBundle' +import type { PrivateKeyBundleV1 } from '../../crypto/PrivateKeyBundle' import { EncryptedPersistence, PrefixedPersistence } from '../persistence' -import { KeystoreProviderOptions } from './interfaces' +import type { KeystoreProviderOptions } from './interfaces' import { buildPersistenceKey } from '../utils' import EphemeralPersistence from '../persistence/InMemoryPersistence' diff --git a/src/keystore/providers/interfaces.ts b/src/keystore/providers/interfaces.ts index 113fd9c46..be70d8496 100644 --- a/src/keystore/providers/interfaces.ts +++ b/src/keystore/providers/interfaces.ts @@ -1,8 +1,8 @@ import type { XmtpEnv, PreEventCallbackOptions } from '../../Client' import type { Signer } from '../../types/Signer' import type { ApiClient } from '../../ApiClient' -import { Persistence } from '../persistence' -import { KeystoreInterface, KeystoreInterfaces } from '../rpcDefinitions' +import type { Persistence } from '../persistence' +import type { KeystoreInterface, KeystoreInterfaces } from '../rpcDefinitions' export type KeystoreProviderOptions = { env: XmtpEnv diff --git a/src/keystore/rpcDefinitions.ts b/src/keystore/rpcDefinitions.ts index 6c823d890..af063558f 100644 --- a/src/keystore/rpcDefinitions.ts +++ b/src/keystore/rpcDefinitions.ts @@ -1,6 +1,6 @@ import { keystore, authn, publicKey, privateKey, signature } from '@xmtp/proto' -import { Reader, Writer } from 'protobufjs/minimal' -import { Flatten } from '../utils/typedefs' +import type { Reader, Writer } from 'protobufjs/minimal' +import type { Flatten } from '../utils/typedefs' // eslint-disable-next-line @typescript-eslint/no-explicit-any export type KeystoreRPCCodec = { diff --git a/src/keystore/snapHelpers.ts b/src/keystore/snapHelpers.ts index 65ac92f8c..f0ac9c835 100644 --- a/src/keystore/snapHelpers.ts +++ b/src/keystore/snapHelpers.ts @@ -8,7 +8,7 @@ import type { } from './rpcDefinitions' import { b64Decode, b64Encode } from '../utils/bytes' import { KeystoreError } from './errors' -import { PrivateKeyBundleV1 } from '../crypto' +import type { PrivateKeyBundleV1 } from '../crypto' import { getEthereum } from '../utils/ethereum' import type { XmtpEnv } from '../Client' import { isSameMajorVersion } from '../utils/semver' diff --git a/src/keystore/utils.ts b/src/keystore/utils.ts index 476c12528..cc0c29392 100644 --- a/src/keystore/utils.ts +++ b/src/keystore/utils.ts @@ -1,14 +1,10 @@ -import { TopicData } from './interfaces' -import { - conversationReference, - publicKey, - keystore, - invitation, -} from '@xmtp/proto' +import type { TopicData } from './interfaces' +import type { conversationReference, publicKey, invitation } from '@xmtp/proto' +import { keystore } from '@xmtp/proto' import { PublicKeyBundle, SignedPublicKeyBundle } from '../crypto' import { KeystoreError } from './errors' -import { WithoutUndefined } from '../utils/typedefs' -import { XmtpEnv } from '../Client' +import type { WithoutUndefined } from '../utils/typedefs' +import type { XmtpEnv } from '../Client' export const convertError = ( e: Error, diff --git a/src/message-backup/BackupClientFactory.ts b/src/message-backup/BackupClientFactory.ts index 5784cc000..4215a2080 100644 --- a/src/message-backup/BackupClientFactory.ts +++ b/src/message-backup/BackupClientFactory.ts @@ -1,8 +1,6 @@ -import BackupClient, { - BackupConfiguration, - BackupType, - SelectBackupProvider, -} from './BackupClient' +import type { BackupConfiguration, SelectBackupProvider } from './BackupClient' +import type BackupClient from './BackupClient' +import { BackupType } from './BackupClient' import NoBackupClient from './NoBackupClient' import TopicStoreBackupClient from './TopicStoreBackupClient' diff --git a/src/message-backup/NoBackupClient.ts b/src/message-backup/NoBackupClient.ts index 60a0a3d9d..4550f36bf 100644 --- a/src/message-backup/NoBackupClient.ts +++ b/src/message-backup/NoBackupClient.ts @@ -1,4 +1,6 @@ -import BackupClient, { BackupType, NoBackupConfiguration } from './BackupClient' +import type { NoBackupConfiguration } from './BackupClient' +import type BackupClient from './BackupClient' +import { BackupType } from './BackupClient' const BACKUP_TYPE = BackupType.none export default class NoBackupClient implements BackupClient { diff --git a/src/message-backup/TopicStoreBackupClient.ts b/src/message-backup/TopicStoreBackupClient.ts index 6be9ef479..57867739b 100644 --- a/src/message-backup/TopicStoreBackupClient.ts +++ b/src/message-backup/TopicStoreBackupClient.ts @@ -1,7 +1,6 @@ -import BackupClient, { - BackupType, - TopicStoreBackupConfiguration, -} from './BackupClient' +import type { TopicStoreBackupConfiguration } from './BackupClient' +import type BackupClient from './BackupClient' +import { BackupType } from './BackupClient' const BACKUP_TYPE = BackupType.xmtpTopicStore export default class TopicStoreBackupClient implements BackupClient { diff --git a/src/utils/async.ts b/src/utils/async.ts index 38242a5e2..9e3d208bc 100644 --- a/src/utils/async.ts +++ b/src/utils/async.ts @@ -1,5 +1,5 @@ -import { messageApi } from '@xmtp/proto' -import { Flatten } from './typedefs' +import type { messageApi } from '@xmtp/proto' +import type { Flatten } from './typedefs' export type IsRetryable = (err?: Error) => boolean diff --git a/src/utils/keystore.ts b/src/utils/keystore.ts index d3ce25cfc..7a5353093 100644 --- a/src/utils/keystore.ts +++ b/src/utils/keystore.ts @@ -1,8 +1,8 @@ import { keystore } from '@xmtp/proto' import { PublicKeyBundle } from '../crypto/PublicKeyBundle' import { KeystoreError } from '../keystore/errors' -import { MessageV1 } from '../Message' -import { WithoutUndefined } from './typedefs' +import type { MessageV1 } from '../Message' +import type { WithoutUndefined } from './typedefs' // Validates the Keystore response. Throws on errors or missing fields. // Returns a type with all possibly undefined fields required to be defined diff --git a/src/utils/viem.ts b/src/utils/viem.ts index 02c958bc3..8994c13e8 100644 --- a/src/utils/viem.ts +++ b/src/utils/viem.ts @@ -1,5 +1,5 @@ import type { WalletClient } from 'viem' -import { Signer } from '../types/Signer' +import type { Signer } from '../types/Signer' export function getSigner(wallet: Signer | WalletClient | null): Signer | null { if (!wallet) { diff --git a/test/ContentTypeTestKey.ts b/test/ContentTypeTestKey.ts index 0b844f510..a36083b55 100644 --- a/test/ContentTypeTestKey.ts +++ b/test/ContentTypeTestKey.ts @@ -1,5 +1,6 @@ import { publicKey } from '@xmtp/proto' -import { ContentTypeId, ContentCodec, PublicKey, EncodedContent } from '../src' +import type { ContentCodec, EncodedContent } from '../src' +import { ContentTypeId, PublicKey } from '../src' export const ContentTypeTestKey = new ContentTypeId({ authorityId: 'xmtp.test', diff --git a/test/helpers.ts b/test/helpers.ts index e2aef53cf..9c7c2cef5 100644 --- a/test/helpers.ts +++ b/test/helpers.ts @@ -1,18 +1,13 @@ import { dateToNs, toNanoString } from './../src/utils' import { Wallet } from 'ethers' -import { - PrivateKey, - ContentCodec, - ContentTypeId, - TextCodec, - Client, - ClientOptions, -} from '../src' -import { Signer } from '../src/types/Signer' -import Stream from '../src/Stream' +import type { ContentCodec, ContentTypeId, ClientOptions } from '../src' +import { PrivateKey, TextCodec, Client } from '../src' +import type { Signer } from '../src/types/Signer' +import type Stream from '../src/Stream' import { promiseWithTimeout } from '../src/utils' -import { PublicKeyBundle, SignedPublicKeyBundle } from '../src/crypto' -import { messageApi, fetcher } from '@xmtp/proto' +import type { PublicKeyBundle, SignedPublicKeyBundle } from '../src/crypto' +import type { messageApi } from '@xmtp/proto' +import { fetcher } from '@xmtp/proto' const { b64Encode } = fetcher diff --git a/test/keystore/providers/helpers.ts b/test/keystore/providers/helpers.ts index f6a052503..becc4f590 100644 --- a/test/keystore/providers/helpers.ts +++ b/test/keystore/providers/helpers.ts @@ -1,5 +1,5 @@ import { InMemoryPersistence } from '../../../src' -import { KeystoreProviderOptions } from '../../../src/keystore/providers' +import type { KeystoreProviderOptions } from '../../../src/keystore/providers' export const testProviderOptions = ({ privateKeyOverride = undefined, diff --git a/tsconfig.json b/tsconfig.json index 110a2c9b7..9940dc80d 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -13,5 +13,15 @@ "target": "es2021", "types": ["vitest/globals"] }, - "include": ["src/**/*", "bench/**/*", "build/**/*", "test/**/*"] + "include": [ + "src/**/*", + "bench/**/*", + "build/**/*", + "test/**/*", + ".eslintrc.cjs", + "commitlint.config.cjs", + "rollup.config.bench.js", + "rollup.config.js", + "vitest.config.ts" + ] } diff --git a/vitest.config.ts b/vitest.config.ts index 9bdd9e106..8a4dcd91f 100644 --- a/vitest.config.ts +++ b/vitest.config.ts @@ -4,7 +4,7 @@ import { defineConfig } from 'vitest/config' export default defineConfig({ test: { globals: true, - testTimeout: 60000, + testTimeout: 120000, hookTimeout: 60000, }, })