diff --git a/wasm/dm.go b/wasm/dm.go index dc4b465cbd031a7bb4d481fa6026934987de87dd..2df4f55709e285930e85946ae7a9f6fdc63c67bd 100644 --- a/wasm/dm.go +++ b/wasm/dm.go @@ -47,6 +47,7 @@ func newDMClientJS(api *bindings.DMClient) map[string]any { "ExportPrivateIdentity": js.FuncOf(cm.ExportPrivateIdentity), "SetNickname": js.FuncOf(cm.SetNickname), "GetNickname": js.FuncOf(cm.GetNickname), + "GetStorageTag": js.FuncOf(cm.GetStorageTag), // DM Sending Methods and Reports "SendText": js.FuncOf(cm.SendText), @@ -485,6 +486,18 @@ func (ch *DMClient) GetNickname(_ js.Value, args []js.Value) any { return nickname } +// GetStorageTag returns the storage tag, so users listening to the database +// can separately listen and read updates there. +// +// Parameters: +// +// Returns: +// - The storage tag (string). +func (dmc *DMClient) GetStorageTag(_ js.Value, args []js.Value) any { + return (base64.RawStdEncoding.EncodeToString(dmc.api.GetIdentity()) + + "_speakeasy_dm") +} + //////////////////////////////////////////////////////////////////////////////// // Channel Receiving Logic and Callback Registration // ////////////////////////////////////////////////////////////////////////////////