diff --git a/modular.d.ts b/modular.d.ts index 6dac14d39..94f0ba27f 100644 --- a/modular.d.ts +++ b/modular.d.ts @@ -16,6 +16,8 @@ * | `MessageStatic.fromEncodedArray()` | [`decodeMessages()`](../functions/modular.decodeMessages.html) | * | `MessageStatic.fromEncodedArray()` | [`decodeEncryptedMessages()`](../functions/modular.decodeEncryptedMessages.html) | * | `PresenceMessageStatic.fromEncoded()` | [`decodePresenceMessage()`](../functions/modular.decodePresenceMessage.html) | + * | `PresenceMessageStatic.fromEncoded()` | [`decodeEncryptedPresenceMessage()`](../functions/modular.decodeEncryptedPresenceMessage.html) | + * | `PresenceMessageStatic.fromEncodedArray()` | [`decodeEncryptedPresenceMessages()`](../functions/modular.decodeEncryptedPresenceMessages.html) | * | `PresenceMessageStatic.fromEncodedArray()` | [`decodePresenceMessages()`](../functions/modular.decodePresenceMessages.html) | * | `PresenceMessageStatic.fromValues()` | [`constructPresenceMessage()`](../functions/modular.constructPresenceMessage.html) | * @@ -60,6 +62,8 @@ export declare const decodeMessages: MessageStatic['fromEncodedArray']; export declare const decodeEncryptedMessages: MessageStatic['fromEncodedArray']; export declare const decodePresenceMessage: PresenceMessageStatic['fromEncoded']; export declare const decodePresenceMessages: PresenceMessageStatic['fromEncodedArray']; +export declare const decodeEncryptedPresenceMessage: PresenceMessageStatic['fromEncoded']; +export declare const decodeEncryptedPresenceMessages: PresenceMessageStatic['fromEncodedArray']; export declare const constructPresenceMessage: PresenceMessageStatic['fromValues']; /** diff --git a/scripts/moduleReport.ts b/scripts/moduleReport.ts index aacec5a00..8117950a4 100644 --- a/scripts/moduleReport.ts +++ b/scripts/moduleReport.ts @@ -34,6 +34,8 @@ const functions = [ { name: 'decodeEncryptedMessages', transitiveImports: ['Crypto'] }, { name: 'decodePresenceMessage', transitiveImports: [] }, { name: 'decodePresenceMessages', transitiveImports: [] }, + { name: 'decodeEncryptedPresenceMessage', transitiveImports: ['Crypto'] }, + { name: 'decodeEncryptedPresenceMessages', transitiveImports: ['Crypto'] }, { name: 'constructPresenceMessage', transitiveImports: [] }, ]; diff --git a/src/platform/web/modular/presencemessage.ts b/src/platform/web/modular/presencemessage.ts index 3ce2c1cf5..56ae0fa14 100644 --- a/src/platform/web/modular/presencemessage.ts +++ b/src/platform/web/modular/presencemessage.ts @@ -1,16 +1,26 @@ import * as API from '../../../../ably'; import { fromEncoded, fromEncodedArray, fromValues } from '../../../common/lib/types/presencemessage'; +import { Crypto } from './crypto'; import Platform from 'common/platform'; import Logger from '../../../common/lib/util/logger'; // The type assertions for the functions below are due to https://github.com/ably/ably-js/issues/1421 export const decodePresenceMessage = ((obj, options) => { - return fromEncoded(Logger.defaultLogger, Platform.Crypto, obj, options); + return fromEncoded(Logger.defaultLogger, null, obj, options); +}) as API.PresenceMessageStatic['fromEncoded']; + +export const decodeEncryptedPresenceMessage = ((obj, options) => { + return fromEncoded(Logger.defaultLogger, Crypto, obj, options); }) as API.PresenceMessageStatic['fromEncoded']; export const decodePresenceMessages = ((obj, options) => { - return fromEncodedArray(Logger.defaultLogger, Platform.Crypto, obj, options); + return fromEncodedArray(Logger.defaultLogger, null, obj, options); +}) as API.PresenceMessageStatic['fromEncodedArray']; + + +export const decodeEncryptedPresenceMessages = ((obj, options) => { + return fromEncodedArray(Logger.defaultLogger, Crypto, obj, options); }) as API.PresenceMessageStatic['fromEncodedArray']; export const constructPresenceMessage = fromValues as API.PresenceMessageStatic['fromValues'];