-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add decryption-capable versions of modular presencemessage decode fun…
…ctions
- Loading branch information
1 parent
e2f99d9
commit 24f6cea
Showing
3 changed files
with
18 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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']; |