Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sentclose/sentc-javascript
https://github.com/sentclose/sentc-javascript
backend-as-a-service end-to-end-encryption javascript sentc sentclose typescript
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/sentclose/sentc-javascript
- Owner: sentclose
- License: agpl-3.0
- Created: 2022-08-24T06:47:27.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2024-09-30T12:26:12.000Z (3 months ago)
- Last Synced: 2024-10-20T12:13:18.689Z (3 months ago)
- Topics: backend-as-a-service, end-to-end-encryption, javascript, sentc, sentclose, typescript
- Language: TypeScript
- Homepage:
- Size: 358 KB
- Stars: 4
- Watchers: 2
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Sentc Javascript SDK
from sentclose.
End-to-end encryption as a service.
Sentc is an easy to use end-to-end encryption sdk. It can be used for any kind of data.
## Example from CDN
The scripts can be downloaded from any CDN provider.
````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);
//invite a user to a group. use the sentc user id
await group.invite("user_id_of_the_other_user");
//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();
````