All Projects â†’ local-first-web â†’ auth

local-first-web / auth

Licence: MIT License
Decentralized authentication and authorization for team collaboration, using a secure chain of cryptological signatures. (Formerly known as ðŸŒŪ Taco.)

Programming Languages

typescript
32286 projects
Batchfile
5799 projects

Projects that are alternatives of or similar to auth

Decentralized Internet
A SDK/library for decentralized web and distributing computing projects
Stars: ✭ 406 (+420.51%)
Mutual labels:  peer-to-peer, decentralized-applications
Unstoppable Wallet Android
A secure and decentralized Bitcoin and other cryptocurrency wallet for Android phones. Supports Bitcoin, Ethereum, EOS, Binance Chain, Bitcoin Cash, DASH, ...
Stars: ✭ 165 (+111.54%)
Mutual labels:  peer-to-peer, decentralized-applications
Unstoppable Wallet Ios
A secure and decentralized Bitcoin and other cryptocurrency wallet for iPhone. Supports Bitcoin, Ethereum, EOS, Binance Chain, Bitcoin Cash, DASH, ...
Stars: ✭ 180 (+130.77%)
Mutual labels:  peer-to-peer, decentralized-applications
keyonic-v2
A Keycloak Mobile Implementation using Angular v4 and Ionic v3
Stars: ✭ 23 (-70.51%)
Mutual labels:  authorization
casbin-aspnetcore
Casbin.NET integration and extension for ASP.NET Core
Stars: ✭ 39 (-50%)
Mutual labels:  authorization
authcheck
Analysis for access-control vulnerabilities in Java Spring Security applications.
Stars: ✭ 14 (-82.05%)
Mutual labels:  authorization
windows-Credential-Provider-library
This repository will be updated with all the examples and links that I can find with relevant knowledge & information about CP in MS Windows vista up to version 10.
Stars: ✭ 122 (+56.41%)
Mutual labels:  authorization
opa-spring-security
Open Policy Agent for Spring Security
Stars: ✭ 19 (-75.64%)
Mutual labels:  authorization
state
A Redux-based state container for local-first software, offering seamless synchronization using Automerge CRDTs. (Formerly known as 🐟 Cevitxe).
Stars: ✭ 126 (+61.54%)
Mutual labels:  local-first
jdbc-adapter
JDBC adapter for Casbin
Stars: ✭ 26 (-66.67%)
Mutual labels:  authorization
bangle-io
A web only WYSIWYG note taking app that saves notes locally in markdown format.
Stars: ✭ 626 (+702.56%)
Mutual labels:  local-first
core
ðŸ”Ĩ Antares Core Implemenation. Most important project layer, this is the heart for your app. ACL, notifiter, console, geoip, areas, utils and many more...
Stars: ✭ 24 (-69.23%)
Mutual labels:  authorization
opal
Policy and data administration, distribution, and real-time updates on top of Open Policy Agent
Stars: ✭ 459 (+488.46%)
Mutual labels:  authorization
pacman.store
Pacman Mirror via IPFS for ArchLinux, Endeavouros and Manjaro
Stars: ✭ 65 (-16.67%)
Mutual labels:  peer-to-peer
wirelink
Experimental P2P configuration plane for Wireguard
Stars: ✭ 16 (-79.49%)
Mutual labels:  peer-to-peer
univoice
Voice chat/VoIP solution for unity. P2P implementation included.
Stars: ✭ 192 (+146.15%)
Mutual labels:  peer-to-peer
BookCart
An e-commerce application for an online book store.
Stars: ✭ 116 (+48.72%)
Mutual labels:  authorization
graphql-auth-directives
Add authorization to your GraphQL API using schema directives.
Stars: ✭ 110 (+41.03%)
Mutual labels:  authorization
OpenAM
OpenAM is an open access management solution that includes Authentication, SSO, Authorization, Federation, Entitlements and Web Services Security.
Stars: ✭ 476 (+510.26%)
Mutual labels:  authorization
auther
Enhances Rails with multi-account, form-based, database-less, application-wide authentication.
Stars: ✭ 22 (-71.79%)
Mutual labels:  authorization

@localfirst/auth logo

@localfirst/auth is a TypeScript library providing decentralized authentication and authorization for team collaboration, using a secure chain of cryptographic signatures.

🚧 This is a work in progress

Why

ðŸĪ You're building a local-first app to enable distributed collaboration without a central server.

🔑 You want to authenticate users and manage their permissions.

ðŸšŦ You don't want to depend on a centralized authentication server or a key management service.

💙 You want to provide a easy and seamless experience to users creating and joining teams

ðŸĪ” You don't want to expose any of the underlying cryptographic complexity.

How it works

This library uses a conflict-free replicated state container based on a signature chain (provided by the CRDX library) to manage team membership, permissions, and authentication.

All changes to the team's membership and permissions are recorded on the signature chain as a sequence of signed and hash-chained actions.

Every team member keeps a complete replica of the signature chain and can validate other members' actions independently. All authorizations can be traced back to the team's founding member. The chain thereby builds a tamper-proof, distributed web of trust.

The team's signature chain also acts as a self-contained certificate authority or public key infrastructure (PKI) solution. At any point in time we calculate the team's current state from it, which includes each member's public keys, as well as their status and roles. This allows us to provide authenticated and encrypted peer-to-peer connections between members.

Invitations are handled using a Seitan token exchange. Once admitted to the team, each member generates their own cryptographic keys for signatures and encryption. They also generate device-level keys that are stored in each devices' secure storage, and which never leave the device.

When roles are changed, members leave, or devices are lost or replaced, keys are rotated and associated data re-encrypted.

👉 Learn more: Internals

Demo

This repo includes a demo app. This will eventually simulate a simple group chat app, although the chat part hasn't been built yet; just the group membership parts.

To run the app, clone the repo and run

yarn dev

The app will be available at http://localhost:3000 .

This demo is also run by Cypress tests, which exercise most of the libary's functionality. To run these:

yarn dev:cy

Usage

This library provides a Team class, which wraps the signature chain and encapsulates the team's members, devices, and roles. With this object, you can invite new members and manage their permissions.

This object can also use the public keys embedded in the signature chain, along with the user's own secret keys, to provide encryption and signature verification within the team.

Not included

  • Storage This library does not provide storage for user information (including keys) or the signature chain.
  • Networking This library includes a protocol for synchronizing the team's signature chains, but you need to provide a working socket connecting us to a peer. (The demo uses @localfirst/relay, which is a tiny relay server and client that bridges two WebSocket connections to allow peers to talk directly to each other.)

Examples

yarn add @localfirst/auth

Alice creates a new team

import { user, team } from '@localfirst/auth'

// ðŸ‘ĐðŸū Alice
const alice = user.create('alice')
const alicesTeam = team.create({ name: 'Spies ÐŊ Us', context: { user: alice } })

Usernames (alice in the example) identify a person uniquely within the team. You could use existing user IDs or names, or email addresses.

Alice invites Bob

// ðŸ‘ĐðŸū Alice
const { secretKey } = alicesTeam.invite('bob')

The invitation key is a single-use secret that only Alice and Bob will ever know. By default, it is a 16-character string like aj7x d2jr 9c8f zrbs, and to make it easier to retype if needed, it is in base-30 format, which omits easily confused characters. It might be typed directly into your application, or appended to a URL that Bob can click to accept:

Alice has invited you to team XYZ. To accept, click: http://xyz.org/accept/aj7x+d2jr+9c8f+zrbs

Alice will send the invitation to Bob via a side channel she already trusts (phone call, email, SMS, WhatsApp, Telegram, etc).

Bob accepts the invitation

Bob uses the secret invitation key to generate proof that he was invited, without divulging the key.

// ðŸ‘ĻðŸŧ‍ðŸĶē Bob
import { accept } from '@localfirst/auth'
const proofOfInvitation = accept('aj7x d2jr 9c8f zrbs')

When Bob shows up to join the team, anyone can validate his proof of invitation to admit him to the team - it doesn't have to be an admin.

// ðŸ‘ģðŸ―â€â™‚ïļ Charlie
team.admit(proofOfInvitation)
const success = team.has('bob') // TRUE

Alice defines a role and adds Bob

// ðŸ‘ĐðŸū Alice
team.addRole('managers')
team.addMemberRole('bob', 'managers')

Alice checks Bob's role membership

// ðŸ‘ĐðŸū Alice
const isAdmin = team.isAdmin('bob') // TRUE

Alice encrypts a message for managers

// ðŸ‘ĐðŸū Alice
const message = 'the condor flies at midnight'
const encrypted = team.encrypt(message, 'managers')

Bob decrypts the message

// ðŸ‘ĻðŸŧ‍ðŸĶē Bob
const decrypted = team.decrypt(encrypted) // 'the condor flies at midnight'

👉 Learn more: API documentation.

Prior art

ðŸ’Ą This project is inspired by and borrows heavily from Keybase: The signature chain is inspired by their implementation for Keybase Teams, and the invitation mechanism is based on their Seitan token exchange specification, proposed as a more secure alternative to TOFU, or Trust On First Use.

ðŸŒŪ This library was originally called taco-js. TACO stands for Trust After Confirmation Of invitation.

Q: ðŸĪ” Is this a blockchain?

A: That depends.

Q: How do you feel about blockchains?

A: 😎 I think blockchains are the key to a beautiful decentralized future.

A signature chain is conceptually similar to a blockchain: It's a distributed ledger, with hash-linked and signed operations.

A: 😟 The word makes me nervous.

If the very mention of a blockchain makes you worry you're about to get scammed, a signature chain is not at all like a blockchain.

  1. None of this has anything to do with cryptocurrency or any kind of money.

  2. Rather than resolving conflicts via proof of energy consumption, this system is a CRDT (conflict-free replicated datatype): Conflicts are resolved using deterministic rules.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].