https://github.com/questnetwork/quest-os-js
JavaScript Implementation of the Quest Network Operating System. Drop-In solution to build Quest Network, IPFS and Ethereum dApps.
https://github.com/questnetwork/quest-os-js
Last synced: 9 months ago
JSON representation
JavaScript Implementation of the Quest Network Operating System. Drop-In solution to build Quest Network, IPFS and Ethereum dApps.
- Host: GitHub
- URL: https://github.com/questnetwork/quest-os-js
- Owner: QuestNetwork
- License: agpl-3.0
- Created: 2020-09-08T09:36:55.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2020-11-01T23:11:52.000Z (over 5 years ago)
- Last Synced: 2025-01-20T23:11:19.600Z (over 1 year ago)
- Language: JavaScript
- Homepage:
- Size: 317 KB
- Stars: 7
- Watchers: 2
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
     [](https://gitter.im/QuestNetwork/qOS?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
# qOS
## Lead Maintainer
[StationedInTheField](https://github.com/StationedInTheField)
## Description
Unified API for the QuestNetwork dStack. Use with our example app: [qDesk](https://github.com/QuestNetwork/qDesk).
Main strategy is to create a Quest Network / IPFS / Ethereum interface that even kids can easily understand.
qOS offers encrypted channels, persistent storage, peer management, timelines, posts and more. It is used to load add-on modules, like [quest-coral-js](https://github.com/QuestNetwork/quest-coral-js) to use [IPFS DAGs](https://docs.ipfs.io/concepts/merkle-dag/), or [quest-dolphin-js](https://github.com/QuestNetwork/quest-dolphin-js) to use [IPFS GossipSub](https://blog.ipfs.io/2020-05-20-gossipsub-v1.1/).
## Security
  
qOS uses [4096 Bit RSA-OAEP](https://en.wikipedia.org/wiki/RSA_(cryptosystem)#Operation) encryption, [256 Bit AES-CBC](https://en.wikipedia.org/wiki/Advanced_Encryption_Standard) encryption and [NIST P-521 EC](https://en.wikipedia.org/wiki/Elliptic-curve_cryptography#Fast_reduction_(NIST_curves)) signatures.
## Installation & Usage
``npm install @questnetwork/quest-os-js@0.9.4``
**OR**
```
git clone https://github.com/QuestNetwork/quest-os-js && cd quest-os-js && git checkout 0.9.4 && cd ..
```
## API
### async boot(config)
Boots the operating system. The GitHub branches master/0.9.2/0.9.3+ boot with:
JavaScript/NodeJS
```javascript
import { qOS } from '@questnetwork/quest-os-js'
// configure with a bootstrap swarm peer, for testing you can use:
let config = {
ipfs: {
Swarm: [,],
API: '',
Gateway: ''
},
version:
dev:
};
// boot the operating system
qOS.boot().then( () => {
//the operating system is online, build the future
})
```
TypeScript/Angular Service
```javascript
import { Injectable } from '@angular/core';
import { qOS } from '@questnetwork/quest-os-js';
import * as swarmJson from '../swarm.json';
import packageJson from '../../../package.json';
const version = packageJson.version;
@Injectable({
providedIn: 'root'
})
export class QuestOSService {
public os;
ready = false;
config;
constructor() {
this.config = {
ipfs: {
Swarm: swarmJson['ipfs']['Swarm'],
API: '',
Gateway: ''
},
version: version,
dev: swarmJson['dev']
};
this.os = qOS;
}
async boot(){
try{
await this.os.boot(this.config);
this.ready = true;
}
catch(e){
throw(e);
}
}
}
```
### isReady()
Returns true once boot is complete, otherwise returns false.
```javascript
if(.isReady()){
console.log("Ready To Sign In");
};
```
### onReady()
Returns a Subject that pushes next when boot is complete
```javascript
if(.onReady().subsribe( () => {
console.log("Ready To Sign In");
});
```
### reboot()
Reboots the entire system
```javascript
.reboot();
```
### enableSaveLock()
[](https://github.com/QuestNetwork/quest-bee-js)
Locks the system from saving any changes
```javascript
.enableSaveLock();
```
### disableSaveLock()
[](https://github.com/QuestNetwork/quest-bee-js)
Unlocks the system from saving changes and saves changes normally
```javascript
.disableSaveLock();
```
### setStorageLocation(location)
[](https://github.com/QuestNetwork/quest-bee-js)
Sets the storage location for the app. Normally Quest OS does this automatically and you do not need to call this function.
Possible locations are: `"Download"`,`"LocalStorage"` or `"ConfigFile"`
```javascript
.setStorageLocation("LocalStorage");
```
### getStorageLocation(location)
[](https://github.com/QuestNetwork/quest-bee-js)
Returns a string with the current storage location
```javascript
.getStorageLocation();
```
### setPwd(pwd)
[](https://github.com/QuestNetwork/quest-bee-js)
Sets the password to be used with the next signIn attempt.
```javascript
.setPwd(pwd);
```
### setPassword(old,new)
[](https://github.com/QuestNetwork/quest-bee-js)
Sets the password to be used for encryption.
When you don't set this before sign in all data is encrypted with a random password.
```javascript
.setPassword('','first-password');
```
### signIn(config = {})
[](https://github.com/QuestNetwork/quest-bee-js)
Activates Accounts. Empty config creates a new account
```javascript
.signIn({});
```
### signOut()
[](https://github.com/QuestNetwork/quest-bee-js)
Deactivates Accounts And Restarts The Interface On The Web, Closes The Current Window In Electron
```javascript
.signOut();
```
### onSignIn()
[](https://github.com/QuestNetwork/quest-bee-js)
Returns a subscribable Subject that fires when the account is signed in.
```javascript
.onSignIn().subscribe( () => {
console.log("Hello Universe");
});
```
### isSignedIn()
[](https://github.com/QuestNetwork/quest-bee-js)
Returns a boolean true or false
```javascript
if(.isSignedIn()){
console.log("Hello Universe");
};
```
### channel
#### async channel.create(dirtyChannelName, parentFolderId = "")
[](https://github.com/QuestNetwork/quest-bee-js) [](https://github.com/QuestNetwork/quest-ocean-js)
Returns the clean channel name
```javascript
let claenChannelName = await .channel.create('propaganda');
```
#### channel.remove(cleanChannelName)
[](https://github.com/QuestNetwork/quest-bee-js) [](https://github.com/QuestNetwork/quest-ocean-js)
Removes a channel
```javascript
.channel.remove('propaganda----1234');
```
#### channel.listen(cleanChannelName)
[](https://github.com/QuestNetwork/quest-ocean-js)
Returns a Subject that forwards non-system channel messages.
```javascript
.channel.listen('propaganda----1234').subscribe( msg ){
console.log(msg);
}
```
#### async channel.publish(cleanChannelName, message, type = 'CHANNEL_MESSAGE')
[](https://github.com/QuestNetwork/quest-ocean-js)
Returns a Subject that forwards non-system channel messages.
```javascript
await .channel.publish('propaganda----1234',"Hello Universe");
```
### channel.challenge
#### channel.challenge.enable(cleanChannelName)
[](https://github.com/QuestNetwork/quest-ocean-js)
Opens the channel to everyone who can solve the Captcha provided by [Quest Image Captcha JS](https://github.com/QuestNetwork/quest-image-captcha-js)
```javascript
.channel.challenge.enable('propaganda----1234');
```
#### channel.challenge.disable(cleanChannelName)
[](https://github.com/QuestNetwork/quest-ocean-js)
Closes the channel to invite only participation
```javascript
.channel.challenge.disable('propaganda----1234');
```
#### channel.challenge.isEnabled(cleanChannelName)
[](https://github.com/QuestNetwork/quest-ocean-js)
```javascript
if(.isEnabled()){
console.log("Hello Universe");
};
```
### channel.invite
#### channel.invite.create(cleanChannelName,newInviteCodeMax, exportFolders = false)
[](https://github.com/QuestNetwork/quest-bee-js) [](https://github.com/QuestNetwork/quest-ocean-js)
Creates a new channel invite, specify max uses of this invite code and whether or not to include your folder structure.
```javascript
.channel.invite.create('propaganda----1234',5,true);
```
#### channel.invite.remove(cleanChannelName,link)
[](https://github.com/QuestNetwork/quest-bee-js) [](https://github.com/QuestNetwork/quest-ocean-js)
Removes a channel invite
```javascript
.channel.invite.remove('propaganda----1234',"5448495320495320414e2045585452454d454c59204c4f4e4720414e4420494e56414c494420494e5649544520434f4445");
```
#### channel.invite.get(channel)
[](https://github.com/QuestNetwork/quest-ocean-js)
Gets all invites for a channel
```javascript
let invites = .channel.invite.get('propaganda----1234');
```
#### channel.invite.get(channel)
[](https://github.com/QuestNetwork/quest-ocean-js)
Gets all invites for a channel
```javascript
let invites = .channel.invite.get('propaganda----1234');
```
**Unfortunately nobody is working on a detailed API documentation yet, until then check out the source in [qDesk Messages](https://github.com/QuestNetwork/quest-messenger-js) 0.9.3+ to see how to use the OS.**
We recommend to use our [quest-cli](https://github.com/QuestNetwork/quest-cli) to test and build the package. It allows you to bootstrap your Quest Network apps with the same peers and settings.
Pro Tip: Put a file in your `/bin` that runs the quest-cli like so `node /path/to/quest-cli/index.js` from any folder on your system. It's much nicer!
## Features
**0.9.2**
- Encrypted P2P Channels
- API for high level IPFS functionality
- Saves Config
- [Quest Ocean JS](https://github.com/QuestNetwork/quest-ocean-js)
- [Quest Bee JS](https://github.com/QuestNetwork/quest-bee-js)
**0.9.3**
- [Quest Social JS](https://github.com/QuestNetwork/quest-social-js)
- Documentation Extended
- Easier Access
- Offer "LocalStorage" As A Storage Container On The Web To Stay Signed In
**0.9.4**
- Change Peer Configuration in browser, Electron and on NodeJS
- Module Upgrades
- Password
**0.9.5**
- Account Name
## Roadmap
**0.9.5**
- [Quest Quorum Module](https://github.com/QuestNetwork/quest-quorum-js)
- Democratically block or mute peers
- Faux requests. Send request in channel, wait for response, deliver response as if it was an http request.
**0.9.6**
- Ethereum Payment Integration Beta
**0.9.7**
- Quest Worker To Render `.blend` Files And Earn Rewards
## Support Us
Please consider supporting us, so that we can build a non-profit for this project (ć)
| Ethereum| Bitcoin |
|---|---|
| `0xBC2A050E7B87610Bc29657e7e7901DdBA6f2D34E` | `bc1qujrqa3s34r5h0exgmmcuf8ejhyydm8wwja4fmq` |
|
|
|
## License
GNU Affero GPLv3