Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: secure room join via room hash in ipfs pubsub chat #64

Open
akhileshthite opened this issue Oct 10, 2024 · 0 comments
Open

feat: secure room join via room hash in ipfs pubsub chat #64

akhileshthite opened this issue Oct 10, 2024 · 0 comments

Comments

@akhileshthite
Copy link
Contributor

https://github.com/AgregoreWeb/website/tree/main/docs/examples/ipfs-pub-sub-chat

Summary: There are two proposed improvements to the current IPFS PUBSUB chat system implementation:

  • Create Room with Topic Name (Hashed) and Auto-Join: When creating a room, the user should input a topic name, which will be hashed into a unique identifier (hex hash). The user should immediately join the room upon creation using this hash.

  • Join Room with Hash Only: To invite others, they will need to enter the room using only the provided hash. A separate "Join Room" button should be added to allow users to input and join rooms by their hash.

This is a static app, so we can use web crypto api, eg:

async function hashRoomName(roomName) {
    const encoder = new TextEncoder();
    const data = encoder.encode(roomName);
    const hashBuffer = await crypto.subtle.digest('SHA-256', data); 
    const hashArray = Array.from(new Uint8Array(hashBuffer)); 
    const hashHex = hashArray.map(byte => byte.toString(16).padStart(2, '0')).join('');
    return hashHex;
}

Screenshot 2024-10-10 at 1 16 31 AM

@akhileshthite akhileshthite changed the title feat: secure room join via room hash feat: secure room join via room hash in ipfs pubsub chat Oct 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant