Can a JSON document be securely encrypted without relying on a server, using only client-side technologies?

Currently, I am in the midst of a project that involves utilizing a cross-storage JavaScript library known as JIO. This library facilitates the storage, sharing, and synchronization of JSON documents across various storage options such as S3 and Dav.

Setting security concerns aside, my main query pertains to whether there exists a method to inhibit the editing of a collaboratively shared document at a particular "stage". For instance, once a document is deemed "published", I aim for it to become immutable, even for users granted permission to edit.

In order to achieve this, I intend to establish a status flag and store this within the document's metadata. Subsequently, a response similar to the following would be relayed to the client:

{
  "id": 123,
  "created": "2013/12/01:11:10:59",
  "state": "published"
  ...
}

While it is feasible to prevent alterations if state !== "published" during the editing and saving process, the challenge lies in guarding against tampering with documents when unauthorized individuals could potentially execute any desired method via tools like Firebug.

Question:
I am curious if there exists a way to effectively "lock" a JSON document to deter any editing attempts in the absence of server-side involvement?

Answer №1

Upon hearing your explanation, I am struck by the resemblance to how the Bitcoin protocol operates. In this scenario, the blockchain serves as a collection of publicly available documents, with "double-spending" akin to publishing the same document twice.

Simply put, when a document is published, it is logged and circulated among other users. Subsequently, another user can add their own document by computing the RSA hash of the previous one along with their new submission. Consequently, these recorded documents create a chain that is distributed across all users. As a result, if a document is already published, any subsequent attempts will be disregarded since all users are aware of its existence.

Considering this, while feasible, developing an algorithm that enables the sharing of documents without a central server presents significant complexity.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

JavaScript: Retrieve values from individual textareas with identical class names

Imagine you have multiple text areas like the ones below: <textarea class='save'></textarea> <textarea class='save'></textarea> <textarea class='save'></textarea> All of them are assigned ...

Typescript's static classes are a powerful and convenient way to

Does anyone know how to implement a static class in TypeScript and Node.js? I am interested in creating a static class to store all constants and strings in one place. Any suggestions on the best approach to achieve this? ...

Error: TweenLite has not been recognized

/justincavery/pen/mPJadb - this is a link to CodePen After copying the code from CodePen and running it, I encountered an error: "Uncaught ReferenceError: TweenLite is not defined". The image only draws once and there is no animation unless I press "F5 ...

Troubleshooting the malfunction of the editing feature in my CRUD application

I am nearly done with my simple CRUD app, but for some reason the "edit" functionality is not working. When I try to edit a team member's name, nothing happens when I click on "Edit Name". It's worth mentioning that I copied the code from my "add ...

Implementing a Filter to Sort Text Files by Number in AngularJS

I am facing an issue with the filter in AngularJS. I am trying to display data where the condition is ordering=1 (a field in my file), but unfortunately, my code is not working. Below is my code: <script> function DanhMucController($scope, $http) ...

What differences exist in the implications of the options for the socket.io server object?

According to the socket.io documentation, you have the option to utilize the http.Server object or directly input a port number into the socket.io server object. What distinguishes the two methods? Instantiate the socket.io Object const io = require(&apo ...

Can I use MuiThemeProvider in my component without any restrictions?

I have a unique component called View: import React from 'react'; import { AppBar, Toolbar } from 'material-ui'; import { Typography } from 'material-ui'; import { MuiThemeProvider, createMuiTheme } from 'material-ui/st ...

Creating a subform using a Mongo query from a JSON entry

I am looking to extract specific information from the document. Specifically, I want access to only the Variables listed in the entry below, formatted as follows. Document1:{ "META" : { "CATEGORY" : "Boxes", "CREATEDBY" : " ...

Find the geometry row name using the Visio Add-in

Recently, I developed an add-in for Visio that can extract information from shapes and save it in a json file. This allows me to replicate Visio drawings in other applications seamlessly. Currently, my focus is on expanding the functionality to include mor ...

Tips for accessing information from an Angular Resource promise

I am currently facing an issue when trying to read data from an angular promise that was returned. Before, I had the following code: var data = category.get({id:userid}); Later, I realized that the data being returned was an unresolved promise. So, I ma ...

Striving to enable C code to determine the directory size for optimization with Emscripten compilation

Struggling to compile my C code with emscripten for the first time. Usually, I find solutions on Stack Overflow, but this time is different. I'm trying to show the size of my Django Root directory on a webpage with the following C code: #include <s ...

Steps for sending a POST request for every file in the given array

I am working on an angular component that contains an array of drag'n'dropped files. My goal is to make a POST request to http://some.url for each file in the array. Here is what I have been attempting: drop.component.ts public drop(event) { ...

Is there a way to determine whether all fields in a schema have been populated or remain empty?

I am working with a schema that looks like this: How can I determine if all the fields in the schema have been filled or not? The front-end (React.js) includes an onboarding process where users who are logging in for the first time need to complete onboa ...

Issue with require in Three.js

I am delving into the world of Three.js and Require.js for the first time. My objective is to load an Obj and Mtl file using the OBJMTLoader. However, I have encountered timeout errors in the console with my current setup: require({ baseUrl: 'js& ...

Discover the paths to locate all keys within an object that correspond to a specified string

I need help creating a function in plain JavaScript that can find all paths to keys with a specific name in an object. The object may have repeated key names at different depths. Here is an example: const obj = { stuff: { A: 'text' ...

Exporting two functions in JavaScript

Currently utilizing React, Redux, and experimenting with Material-UI integration. The example codes provided by Redux and Material-UI libraries include an 'export' statement at the end. Redux: export default connect(mapStateToProps, actions)(my ...

How to modify browser's back button action in Vue.js

Is there a way to detect the back function in the browser and then redirect to a different page using Vue.js? Here's what I've tried so far. mounted: function () { window.onpopstate = function(event) { this.$router.push({ path: ...

Updating the display text length on vue-moment

Currently, I am attempting to showcase an array of numbers const days = [1, 7, 14, 30, 60] in a more human-readable format using vue-moment Everything is functioning correctly {{ days | duration('humanize') }} // 'a day' // '7 d ...

Stop Carousel when hovering over individual items (Owl Beta 2)

After creating a unique navigation that is separate from the carousel, I encountered some issues with the autoplay feature. Below is the HTML markup: <div class="carousel"> <div class=""> <img src="assets/img/carousel1.jpg" /&g ...

The drop down menu in React does not show the selected value when a function is called in the onChange() event

I am currently developing a filter that retrieves data from serviceNow based on the user's selection in the drop down menu. In my onChange() function, I have a call to a filtering function (handleFilter()) which filters the data according to the value ...