How to use the @wireapp/protocol-messaging.LinkPreview.encode function in @wireapp/protocol-messaging

To help you get started, we’ve selected a few @wireapp/protocol-messaging examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github wireapp / wire-webapp / src / script / conversation / ConversationEphemeralHandler.js View on Github external
assetEntity.previews().map(linkPreview => {
        linkPreview.obfuscate();
        const protoArticle = new Article({permanentUrl: linkPreview.url, title: linkPreview.title}); // deprecated format
        const linkPreviewProto = new LinkPreview({
          article: protoArticle,
          permanentUrl: linkPreview.url,
          title: linkPreview.title,
          url: linkPreview.url,
          urlOffset: 0,
        });
        return arrayToBase64(LinkPreview.encode(linkPreviewProto).finish());
      }),
    );
github wireapp / wire-webapp / test / unit_tests / conversation / EventMapperSpec.js View on Github external
it('maps text messages with deprecated link preview format', async () => {
      const event_id = createRandomUuid();

      const article = new Article({
        permanentUrl: 'test.com',
        summary: 'Test description',
        title: 'Test title',
      });
      const link_preview = new LinkPreview({
        article,
        url: 'test.com',
        urlOffset: 0,
      });

      const base64LinkPreview = await arrayToBase64(LinkPreview.encode(link_preview).finish());

      const event = {
        conversation: conversation_et.id,
        data: {
          content: 'test.com',
          nonce: event_id,
          previews: [base64LinkPreview],
        },
        from: createRandomUuid,
        id: event_id,
        time: new Date().toISOString(),
        type: ClientEvent.CONVERSATION.MESSAGE_ADD,
      };

      const messageEntity = await event_mapper.mapJsonEvent(event, conversation_et);
github wireapp / wire-webapp / src / script / cryptography / CryptographyMapper.js View on Github external
      protoLinkPreviews.map(protoLinkPreview => arrayToBase64(LinkPreview.encode(protoLinkPreview).finish())),
    );