InMemoryKeystore
Class: InMemoryKeystore
A Keystore is responsible for holding the user's XMTP private keys and using them to encrypt/decrypt/sign messages.
Keystores are instantiated using a KeystoreProvider
Implements
Constructors
constructor
new InMemoryKeystore(keys
, inviteStore
)
Parameters
Name | Type |
---|---|
keys | PrivateKeyBundleV1 |
inviteStore | default |
Defined in
keystore/InMemoryKeystore.ts:39
Properties
accountAddress
Private
accountAddress: undefined
| string
Defined in
keystore/InMemoryKeystore.ts:37
authenticator
Private
authenticator: default
Defined in
keystore/InMemoryKeystore.ts:36
inviteStore
Private
inviteStore: default
Defined in
keystore/InMemoryKeystore.ts:35
v1Keys
Private
v1Keys: PrivateKeyBundleV1
Defined in
keystore/InMemoryKeystore.ts:33
v2Keys
Private
v2Keys: PrivateKeyBundleV2
Defined in
keystore/InMemoryKeystore.ts:34
Methods
createAuthToken
createAuthToken(«destructured»
): Promise
<Token
>
Create an XMTP auth token to be used as a header on XMTP API requests
Parameters
Name | Type |
---|---|
«destructured» | CreateAuthTokenRequest |
Returns
Promise
<Token
>
Implementation of
Defined in
keystore/InMemoryKeystore.ts:151
createInvite
createInvite(req
): Promise
<CreateInviteResponse
>
Create a sealed/encrypted invite and store the Topic keys in the Keystore for later use. The returned invite payload must be sent to the network for the other party to be able to communicate.
Parameters
Name | Type |
---|---|
req | CreateInviteRequest |
Returns
Promise
<CreateInviteResponse
>
Implementation of
Defined in
keystore/InMemoryKeystore.ts:241
decryptV1
decryptV1(req
): Promise
<DecryptResponse
>
Decrypt a batch of V1 messages
Parameters
Name | Type |
---|---|
req | DecryptV1Request |
Returns
Promise
<DecryptResponse
>
Implementation of
Defined in
keystore/InMemoryKeystore.ts:50
decryptV2
decryptV2(req
): Promise
<DecryptResponse
>
Decrypt a batch of V2 messages
Parameters
Name | Type |
---|---|
req | DecryptV2Request |
Returns
Promise
<DecryptResponse
>
Implementation of
Defined in
keystore/InMemoryKeystore.ts:81
encryptV1
encryptV1(req
): Promise
<EncryptResponse
>
Encrypt a batch of V1 messages
Parameters
Name | Type |
---|---|
req | EncryptV1Request |
Returns
Promise
<EncryptResponse
>
Implementation of
Defined in
keystore/InMemoryKeystore.ts:119
encryptV2
encryptV2(req
): Promise
<EncryptResponse
>
Encrypt a batch of V2 messages
Parameters
Name | Type |
---|---|
req | EncryptV2Request |
Returns
Promise
<EncryptResponse
>
Implementation of
Defined in
keystore/InMemoryKeystore.ts:159
getAccountAddress
getAccountAddress(): Promise
<string
>
Get the account address of the wallet used to create the Keystore
Returns
Promise
<string
>
Implementation of
Defined in
keystore/InMemoryKeystore.ts:332
getPrivateKeyBundle
getPrivateKeyBundle(): Promise
<PrivateKeyBundleV1
>
Export the private keys. May throw an error if the keystore implementation does not allow this operation
Returns
Promise
<PrivateKeyBundleV1
>
Implementation of
Defined in
keystore/InMemoryKeystore.ts:328
getPublicKeyBundle
getPublicKeyBundle(): Promise
<PublicKeyBundle
>
Get the PublicKeyBundle
associated with the Keystore's private keys
Returns
Promise
<PublicKeyBundle
>
Implementation of
Defined in
keystore/InMemoryKeystore.ts:324
getV2Conversations
getV2Conversations(): Promise
<ConversationReference
[]>
Get a list of V2 conversations
Returns
Promise
<ConversationReference
[]>
Implementation of
Defined in
keystore/InMemoryKeystore.ts:311
lookupTopic
lookupTopic(topic
): undefined
| WithoutUndefined
<TopicMap_TopicData
>
Parameters
Name | Type |
---|---|
topic | string |
Returns
undefined
| WithoutUndefined
<TopicMap_TopicData
>
Defined in
keystore/InMemoryKeystore.ts:343
saveInvites
saveInvites(req
): Promise
<SaveInvitesResponse
>
Take a batch of invite messages and store the TopicKeys
for later use in decrypting messages
Parameters
Name | Type |
---|---|
req | SaveInvitesRequest |
Returns
Promise
<SaveInvitesResponse
>
Implementation of
Defined in
keystore/InMemoryKeystore.ts:198
signDigest
signDigest(req
): Promise
<Signature
>
Sign the provided digest with either the IdentityKey
or a specified PreKey
Parameters
Name | Type |
---|---|
req | SignDigestRequest |
Returns
Promise
<Signature
>
Implementation of
Defined in
keystore/InMemoryKeystore.ts:276
create
Static
create(keys
, persistence?
): Promise
<InMemoryKeystore
>
Parameters
Name | Type |
---|---|
keys | PrivateKeyBundleV1 |
persistence? | Persistence |
Returns
Promise
<InMemoryKeystore
>