Skip to content

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

Description

@akhileshthite

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions