Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@samouraiwallet/auth47

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@samouraiwallet/auth47

A JS implementation of the Auth47 protocol

  • 0.5.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
50
increased by47.06%
Maintainers
1
Weekly downloads
 
Created
Source

@samouraiwallet/auth47

A JS implementation of the Auth47 protocol.

This library uses ES Modules. Node.js v14 or later is required.

Source code was written in Typescript. Type definitions are included in the published bundle.

Usage

Initialize a new instance for a Verifier using a HTTPS callback URI

import crypto from 'crypto'
import { Auth47Verifier } from '@samouraiwallet/auth47';

const verifier = new Auth47Verifier('https://samourai.io/auth');

Generate an Auth47URI for a given nonce

// Generate random nonce
const nonce = crypto.randomBytes(12).toString('hex');
const uri = verifier.generateURI({'nonce': nonce});
console.log('URI generated:', uri);

Verify a proof

const proof_received = {
  'auth47_response': '1.0',
  'challenge': 'auth47://aerezerzerze23131d?r=https://samourai.io/auth',
  'nym': 'PM8TJTLJbPRGxSbc8EJ...TzFcwQRya4GA',
  'signature': 'Hyn9En/w5I2LHR...ct8mbFD86o='
};

// Verify the proof (use bitcoin network defined as default)
const verifiedProof = verifier.verifyProof(proof_received);

if (verifiedProof.result === 'ok') {
  console.log('Proof is valid');
}
else {
  // log given error
  console.log(verifiedProof.error);
}

Keywords

FAQs

Package last updated on 11 Dec 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc