https://github.com/sentclose/sentc-docs
https://github.com/sentclose/sentc-docs
Last synced: 4 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/sentclose/sentc-docs
- Owner: sentclose
- Created: 2023-05-17T20:47:24.000Z (about 3 years ago)
- Default Branch: master
- Last Pushed: 2025-05-15T15:25:28.000Z (about 1 year ago)
- Last Synced: 2025-05-15T16:38:54.003Z (about 1 year ago)
- Language: Vue
- Size: 543 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Sentc documentation
For Javascript
Easy to install:
```bash
npm install @sentclose/sentc
```
```bash
yarn add @sentclose/sentc
```
Easy to use, installed or in the browser:
```js
import Sentc from "@sentclose/sentc";
//init the javascript client
await Sentc.init({
app_token: "5zMb6zs3dEM62n+FxjBilFPp+j9e7YUFA+7pi6Hi" // <-- your app token
});
//register a user
await Sentc.register("username", "password");
//login a user
const user = await Sentc.login("username", "password");
//create a group
const group_id = await user.createGroup();
//load a group. returned a group obj for every user.
const group = await user.getGroup(group_id);
//encrypt a string for the group
const encrypted_string = await group.encryptString("hello there!");
//now every user in the group can decrypt the string
const decrypted_string = await group.decryptString(encrypted_string);
console.log(decrypted_string); //hello there!
```
```html
Sentc example
//init the wasm
const sentc = window.Sentc.default;
async function run() {
//use your public token as the app token.
// if a user is already logged in, this function will return the logged-in user
await sentc.init({
app_token: "5zMb6zs3dEM62n+FxjBilFPp+j9e7YUFA+7pi6Hi"
});
//now you are ready to go
//register a user:
await sentc.register("username", "password");
//log in a user
const user = await sentc.login("username", "password");
//create a group
const group_id = await user.createGroup();
//load a group. returned a group obj for every user.
const group = await user.getGroup(group_id);
//encrypt a string for the group
const encrypted_string = await group.encryptString("hello there!");
//now every user in the group can decrypt the string
const decrypted_string = await group.decryptString(encrypted_string);
console.log(decrypted_string); //hello there!
}
run();
```
For Flutter
Easy to install:
```bash
flutter pub add sentc
```
Easy to use:
```dart
demo() async {
//init the client
await Sentc.init(appToken: "5zMb6zs3dEM62n+FxjBilFPp+j9e7YUFA+7pi6Hi");
//register a user
await Sentc.register("userIdentifier", "password");
//log in a user
final user = await Sentc.login("userIdentifier", "password");
//create a group
final groupId = await user.createGroup();
//load a group. returned a group obj for every user.
final group = await user.getGroup(groupId);
//invite another user to the group. Not here in the example because we only got one user so far
// await group.inviteAuto("other user id");
//encrypt a string for the group
final encrypted = await group.encryptString("hello there!");
//now every user in the group can decrypt the string
final decrypted = await group.decryptString(encrypted);
print(decrypted); //hello there!
//delete a group
await group.deleteGroup();
//delete a user
await user.deleteUser("password");
}
```
## Limitations
The protocol is designed for async long-running communication between groups.
- A group member should be able to decrypt the whole communication even if they joined years after the beginning.
- Group member should get decrypt all messages even if they were offline for years.
The both requirements make perfect forward secrecy impossible. See more [at the Protocol](/protocol/) how we solved it.