All Projects â†’ blockstack-packages â†’ blockstack.js-old

blockstack-packages / blockstack.js-old

Licence: MIT license
The Blockstack JS library for identity and authentication

Programming Languages

HTML
75241 projects
javascript
184084 projects - #8 most used programming language
CSS
56736 projects

Projects that are alternatives of or similar to blockstack.js-old

logto
🧑‍🚀 Logto helps you build the sign-in, auth, and user identity within minutes. We provide an OIDC-based identity service and the end-user experience with username, phone number, email, and social sign-in, with extendable multi-language support.
Stars: ✭ 3,421 (+17005%)
Mutual labels:  identity, auth
self
đŸĻ‰ Cryptgraphic peer authentication.
Stars: ✭ 42 (+110%)
Mutual labels:  profile, identity
Angular Auth Oidc Client
npm package for OpenID Connect, OAuth Code Flow with PKCE, Refresh tokens, Implicit Flow
Stars: ✭ 577 (+2785%)
Mutual labels:  identity, auth
Laravel5.7 Vue Cli3 Boilerplate
Boilerplate / Starter kit. Laravel 5.7, Vue CLI 3 — Authentication with Email Verification. REST API.
Stars: ✭ 52 (+160%)
Mutual labels:  profile, auth
Stacks Blockchain
The Stacks 2.0 blockchain implementation
Stars: ✭ 2,549 (+12645%)
Mutual labels:  identity, blockstack
blockstack-browser
The Blockstack Browser
Stars: ✭ 1,130 (+5550%)
Mutual labels:  identity, blockstack
cogito
Cogito Identity Management https://cogito.mobi
Stars: ✭ 14 (-30%)
Mutual labels:  identity
auth
🔑 Laravel Authentication package with built-in two-factor (Authy) and social authentication (Socialite).
Stars: ✭ 39 (+95%)
Mutual labels:  auth
active-directory-android
An android app that uses Azure AD and the ADAL library for authenticating the user and calling a web API using OAuth 2.0 access tokens.
Stars: ✭ 33 (+65%)
Mutual labels:  identity
Authentication
Authentication examples for AspNetCore 3.1
Stars: ✭ 37 (+85%)
Mutual labels:  identity
BlackIQ
Who I am !?
Stars: ✭ 19 (-5%)
Mutual labels:  profile
Convenience
.NET Core 5/Angular11/NG-ZORRO 权限įŽĄį†įŗģįģŸ åˇĨäŊœæĩįŗģįģŸ
Stars: ✭ 74 (+270%)
Mutual labels:  identity
netease-music-box
🎧 将äŊ æœ€čŋ‘一周įš„įŊ‘易äē‘éŸŗ䚐įš„åŦæ­ŒčŽ°åŊ•æ›´æ–°åˆ° Gist
Stars: ✭ 57 (+185%)
Mutual labels:  profile
caddy-security
🔐 Authentication, Authorization, and Accounting (AAA) App and Plugin for Caddy v2. 💎 Implements Form-Based, Basic, Local, LDAP, OpenID Connect, OAuth 2.0 (Github, Google, Facebook, Okta, etc.), SAML Authentication. MFA/2FA with App Authenticators and Yubico. 💎 Authorization with JWT/PASETO tokens. 🔐
Stars: ✭ 696 (+3380%)
Mutual labels:  auth
permissionsql
🔏 Middleware for keeping track of users, login states and permissions
Stars: ✭ 58 (+190%)
Mutual labels:  auth
open-source-enthusiasts
[ PLEASE DON'T USE THIS REPO ] Hacktoberfest 2020 movement to list out all the open source enthusiasts in one place. Want to make your PR count for Hacktoberfest? Add yourself in the list.
Stars: ✭ 40 (+100%)
Mutual labels:  profile
opus
No description or website provided.
Stars: ✭ 22 (+10%)
Mutual labels:  identity
facematch
Facematch is a tool to verifies if two photos contain the same person.
Stars: ✭ 62 (+210%)
Mutual labels:  identity
identifo
Universal authentication framework for web, created with go
Stars: ✭ 58 (+190%)
Mutual labels:  auth
ERC-1484
ERC-1484 Reference Implementation
Stars: ✭ 28 (+40%)
Mutual labels:  identity

blockstack.js CircleCI npm npm npm Slack

Installation

$ npm install blockstack

About

Blockstack JS is a library for profiles/identity and authentication.

The authentication portion of this library can be used to:

  1. create an authentication request
  2. create an authentication response

The profiles/identity portion of this library can be used to:

  1. transform a JSON profile into cryptographically-signed signed tokens
  2. recover a JSON profile from signed tokens
  3. validate signed profile tokens

Note: this document uses ES6 in its examples but it is compiled down to Javascript (ES5) and is perfectly compatible with it. If you're using the latter, just make a few adjustments to the examples below (e.g. use "let" instead of "var").

Auth

Request a user to sign in

import { requestSignIn } from 'blockstack'

var appManifest = {
  name: "Hello, Blockstack",
  start_url: "https://helloblockstack.com",
  description: "A simple demo of blockstack auth",
  icons: [{
    "src": "https://raw.githubusercontent.com/blockstack/blockstack-portal/master/app/images/app-hello-blockstack.png",
    "sizes": "192x192",
    "type": "image/png"
  }]
}

$('#login-button').click(function() {
    requestSignIn(null, appManifest) // The user will be redirected to their identity provider
})

Sign a user in

import { signUserIn } from 'blockstack'

signUserIn((session) => {
    // Redirect the user to the home page
})

Create a raw auth request

import { makeAuthRequest, makeECPrivateKey } from 'blockstack'

const privateKey = makeECPrivateKey()

const appManifest = { name: "Hello, Blockstack", start_url: "https://helloblockstack.com" }
const authRequest = makeAuthRequest(privateKey, appManifest)

Verify an auth request

import { verifyAuthRequest } from 'blockstack'

const verified = verifyAuthRequest(authRequest)

Create an auth response

import { makeAuthResponse, makeECPrivateKey } from 'blockstack'
const privateKey = makeECPrivateKey()

const authData = { profile: { name: 'Naval Ravikant' }, username: 'naval.id' }
const authResponse = makeAuthResponse(privateKey, authData)

Verify an auth response

import { verifyAuthResponse } from 'blockstack'

const verified = verifyAuthResponse(authResponse)

Profiles

Follow these steps to create and register a profile for a Blockchain ID:

  1. Create a JSON profile object
  2. Split up the profile into tokens, sign the tokens, and put them in a token file
  3. Create a zone file that points to the web location of the profile token file

Create a profile

const profileOfNaval = {
  "@context": "http://schema.org/",
  "@type": "Person",
  "name": "Naval Ravikant",
  "description": "Co-founder of AngelList"
}

Sign a profile as a single token

import { makeECPrivateKey, wrapProfileToken, Person } from 'blockstack'

const privateKey = makeECPrivateKey()

const person = new Person(profileOfNaval)
const token = person.toToken(privateKey)
const tokenFile = [wrapProfileToken(token)]

Verify an individual token

import { verifyProfileToken } from 'blockstack'

try {
  const decodedToken = verifyProfileToken(tokenFile[0].token, publicKey)
} catch(e) {
  console.log(e)
}

Recover a profile from a token file

const recoveredProfile = Person.fromToken(tokenFile, publicKey)

Validate profile schema

const validationResults = Person.validateSchema(recoveredProfile)

Validate a proof

import { validateProofs } from 'blockstack'

const domainName = "naval.id"
validateProofs(profile, domainName).then((proofs) => {
  console.log(proofs)
})

Testing

$ npm run test

Testing in a browser

This test will only work with your browser's Cross-Origin Restrictions disabled.

Run npm run compile; npm run browserify before opening the file test.html in your browser.

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].