Skip to content

Request for examples of using this to recover private key from juicebox key store #7

@jiajiel1

Description

@jiajiel1

Hi,

I need some help to use this SDK to create new XChat conversation message (not the old DM).

Knowing the XChat convo is encryped and we will need to use the private key to encrypt the message.

Here's some of my snippet.

const oauth1Config: OAuth1Config = {
  apiKey: '',
  apiSecret: '',
  accessToken: '',
  accessTokenSecret: '',
  callback: 'callback_url'
};

const oauth1: OAuth1 = new OAuth1(oauth1Config);

const config: ClientConfig = {
  oauth1: oauth1,
};

const client: Client = new Client(config);

const publicKey = await client.chat.getUserPublicKeys('123456789');

const conversations = await client.chat.getConversations();

const conversationId = conversations.data[1].id

So far we have gotten the conversations and conversation Id ok, but next is we want to send a message to one conversation.

Then we need to recover the private key and encrypt the message.
And in the public key response, there is a juiceboxConfig, we are not sure how to use it.

Also the chat send message example is missing.

await client.chat.sendMessage('123-1234567',{
  conversationToken?: string; /** Base64-encoded Thrift MessageCreateEvent containing encrypted message contents. */
  encodedMessageCreateEvent: string; /** Base64-encoded Thrift MessageEventSignature for message verification. */
  encodedMessageEventSignature?: string; /** Unique identifier for this message. */
  messageId: string;
})

Can we know how to set these params please?

Thank you,

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions