src/lib/Services/CreateService.js
/**
     * Creates an object which represents an encrypted invitation.
     * @param {string} baseUrl: base URL to generate invitation URL.
     * @param {string} chatUrl: chat storage URL.
     * @param {string} userWebId: chat creator WebId.
     * @param {string} interlocutorWebId: target WebId.
     * @returns {Object}: Private and Inbox invitations (different encryption).
     */
Creates an object which represents an encrypted invitation.
@param {string} baseUrl: base URL to generate invitation URL.
@param {string} chatUrl: chat storage URL.
Creates an object which represents an encrypted invitation . @param { string } baseUrl : base URL to generate invitation URL . @param { string } chatUrl : chat storage URL .
async generateInvitation(baseUrl, chatUrl, userWebId, interlocutorWebId) {
        const invitationUrl = await this.baseService.generateUniqueUrlForResource(baseUrl);
        var encurl = this.encrypter.encrypt(chatUrl, false);
        var encuser = this.encrypter.encrypt(userWebId, false);
        var encint = this.encrypter.encrypt(interlocutorWebId, false);
        const i1 = `
    <${invitationUrl}> a <${this.namespaces.schema}InviteAction>;
      <${this.namespaces.schema}event> <${encurl}>;
      <${this.namespaces.schema}agent> <${encuser}>;
      <${this.namespaces.schema}recipient> <${encint}>.
  `;
        encurl = this.encrypter.encrypt(chatUrl, true);
        encuser = this.encrypter.encrypt(userWebId, true);
        encint = this.encrypter.encrypt(interlocutorWebId, true);
        const i2 = `
    <${invitationUrl}> a <${this.namespaces.schema}InviteAction>;
      <${this.namespaces.schema}event> <${encurl}>;
      <${this.namespaces.schema}agent> <${encuser}>;
      <${this.namespaces.schema}recipient> <${encint}>.
  `;
        return {
            "forprivate": i1,
            "forinbox": i2
        };
    }
async generateInvitation ( baseUrl , chatUrl , userWebId , interlocutorWebId ) { const invitationUrl = await this . baseService . generateUniqueUrlForResource ( baseUrl ) ; var encurl = this . encrypter . encrypt ( chatUrl , false ) ; var encuser = this . encrypter . encrypt ( userWebId , false ) ; var encint = this . encrypter . encrypt ( interlocutorWebId , false ) ; const i1 = ` ${ invitationUrl } ${ this . namespaces . schema } ${ this . namespaces . schema } ${ encurl } ${ this . namespaces . schema } ${ encuser } ${ this . namespaces . schema } ${ encint } ` ; encurl = this . encrypter . encrypt ( chatUrl , true ) ; encuser = this . encrypter . encrypt ( userWebId , true ) ; encint = this . encrypter . encrypt ( interlocutorWebId , true ) ; const i2 = ` ${ invitationUrl } ${ this . namespaces . schema } ${ this . namespaces . schema } ${ encurl } ${ this . namespaces . schema } ${ encuser } ${ this . namespaces . schema } ${ encint } ` ; return { "forprivate" : i1 , "forinbox" : i2 } ; }
Creates an object which represents an encrypted invitation.
Creates an object which represents an encrypted invitation .