1
- import { PublicKeyBundle , PrivateKeyBundle } from './crypto'
1
+ import { PublicKeyBundle , PrivateKeyBundleV1 } from './crypto'
2
2
import Message from './Message'
3
3
import {
4
4
buildDirectMessageTopic ,
8
8
import Stream , { MessageFilter , noTransformation } from './Stream'
9
9
import { Signer } from 'ethers'
10
10
import {
11
- EncryptedStore ,
11
+ EncryptedKeyStore ,
12
12
KeyStore ,
13
13
LocalStorageStore ,
14
14
PrivateTopicStore ,
@@ -24,7 +24,7 @@ import {
24
24
} from './MessageContent'
25
25
import { decompress , compress } from './Compression'
26
26
import { xmtpEnvelope , messageApi , fetcher } from '@xmtp/proto'
27
- import { DecodeContactBundle } from './ContactBundle'
27
+ import { decodeContactBundle } from './ContactBundle'
28
28
import ApiClient , { SortDirection } from './ApiClient'
29
29
import { Authenticator } from './authn'
30
30
const { Compression } = xmtpEnvelope
@@ -125,15 +125,15 @@ export function defaultOptions(opts?: Partial<ClientOptions>): ClientOptions {
125
125
*/
126
126
export default class Client {
127
127
address : string
128
- keys : PrivateKeyBundle
128
+ keys : PrivateKeyBundleV1
129
129
apiClient : ApiClient
130
130
private contacts : Set < string > // address which we have connected to
131
131
private knownPublicKeyBundles : Map < string , PublicKeyBundle > // addresses and key bundles that we have witnessed
132
132
private _conversations : Conversations
133
133
private _codecs : Map < string , ContentCodec < any > >
134
134
private _maxContentSize : number
135
135
136
- constructor ( keys : PrivateKeyBundle , apiClient : ApiClient ) {
136
+ constructor ( keys : PrivateKeyBundleV1 , apiClient : ApiClient ) {
137
137
this . contacts = new Set < string > ( )
138
138
this . knownPublicKeyBundles = new Map < string , PublicKeyBundle > ( )
139
139
this . keys = keys
@@ -487,13 +487,13 @@ function createKeyStoreFromConfig(
487
487
function createNetworkPrivateKeyStore (
488
488
wallet : Signer ,
489
489
apiClient : ApiClient
490
- ) : EncryptedStore {
491
- return new EncryptedStore ( wallet , new PrivateTopicStore ( apiClient ) )
490
+ ) : EncryptedKeyStore {
491
+ return new EncryptedKeyStore ( wallet , new PrivateTopicStore ( apiClient ) )
492
492
}
493
493
494
494
// Create Encrypted store which uses LocalStorage to store KeyBundles
495
- function createLocalPrivateKeyStore ( wallet : Signer ) : EncryptedStore {
496
- return new EncryptedStore ( wallet , new LocalStorageStore ( ) )
495
+ function createLocalPrivateKeyStore ( wallet : Signer ) : EncryptedKeyStore {
496
+ return new EncryptedKeyStore ( wallet , new LocalStorageStore ( ) )
497
497
}
498
498
499
499
function createStaticStore ( privateKeyOverride : Uint8Array ) : KeyStore {
@@ -505,15 +505,15 @@ function createStaticStore(privateKeyOverride: Uint8Array): KeyStore {
505
505
async function loadOrCreateKeysFromStore (
506
506
wallet : Signer | null ,
507
507
store : KeyStore
508
- ) : Promise < PrivateKeyBundle > {
508
+ ) : Promise < PrivateKeyBundleV1 > {
509
509
let keys = await store . loadPrivateKeyBundle ( )
510
510
if ( keys ) {
511
511
return keys
512
512
}
513
513
if ( ! wallet ) {
514
514
throw new Error ( 'No wallet found' )
515
515
}
516
- keys = await PrivateKeyBundle . generate ( wallet )
516
+ keys = await PrivateKeyBundleV1 . generate ( wallet )
517
517
await store . storePrivateKeyBundle ( keys )
518
518
return keys
519
519
}
@@ -565,7 +565,7 @@ async function getUserContactFromNetwork(
565
565
566
566
for await ( const env of stream ) {
567
567
if ( ! env . message ) continue
568
- const bundle = DecodeContactBundle ( b64Decode ( env . message . toString ( ) ) )
568
+ const bundle = decodeContactBundle ( b64Decode ( env . message . toString ( ) ) )
569
569
const keyBundle = bundle . keyBundle
570
570
571
571
const address = keyBundle ?. walletSignatureAddress ( )
0 commit comments