antelope-webauthn
Advanced tools
Comparing version 1.0.0-rc.0 to 1.0.0-rc.1
@@ -1,9 +0,9 @@ | ||
import decodeDER from "./decode-der.js"; | ||
import base58_to_binary from "base58-js/base58_to_binary.js"; | ||
import binary_to_base58 from "base58-js/binary_to_base58.js"; | ||
import varuint32 from "eosio-wasm-js/varuint32.js"; | ||
import ripemd160 from "ripemd160-js/ripemd160.js"; | ||
import sha256 from "./sha256.js"; | ||
import { array_to_number } from "./array_to_number.js"; | ||
import base58_to_binary from "base58-js/base58_to_binary.js"; | ||
import calculateRecID from "./calculate_recovery_id.js"; | ||
import decodeDER from "./decode-der.js"; | ||
import sha256 from "./sha256.js"; | ||
export default async function webAuthSig({ authenticatorData, signature, clientDataJSON, }, public_key) { | ||
@@ -14,5 +14,3 @@ const { r, s } = decodeDER(new Uint8Array(signature)); | ||
const clientDataHash = await sha256(new Uint8Array(clientDataJSON)); | ||
const hash = await sha256( | ||
//@ts-expect-error | ||
Uint8Array.from([...authenticatorData, ...clientDataHash])); | ||
const hash = await sha256(Uint8Array.from([...new Uint8Array(authenticatorData), ...clientDataHash])); | ||
const rec_id = calculateRecID(public_key_bytes.slice(0, 33), { r: array_to_number(r), s: array_to_number(s) }, hash); | ||
@@ -29,3 +27,3 @@ return serialize_wa_signature({ v: rec_id, ...serializeArg }); | ||
...s, | ||
// @ts-ignore | ||
// @ts-expect-error - I want to check this | ||
...varuint32(authenticatorData.length ?? authenticatorData.byteLength) | ||
@@ -35,3 +33,3 @@ .match(/[a-z0-9]{2}/gmu) | ||
...new Uint8Array(authenticatorData), | ||
// @ts-ignore | ||
// @ts-expect-error - I want to check this | ||
...varuint32(clientDataJSON.length ?? clientDataJSON.byteLength) | ||
@@ -38,0 +36,0 @@ .match(/[a-z0-9]{2}/gmu) |
{ | ||
"name": "antelope-webauthn", | ||
"version": "1.0.0-rc.0", | ||
"version": "1.0.0-rc.1", | ||
"description": "A WebAuthn.io crypto utility for generating signatures, creating public keys, and verifying them, designed for Antelope-based blockchains such as EOSIO, WAX, and other related platforms. This package provides convenient tools to handle key pair generation, signing operations, and signature verification, supporting the WebAuthn standard for secure, decentralized authentication.", | ||
@@ -5,0 +5,0 @@ "engines": { |
@@ -1,4 +0,3 @@ | ||
# antelope-webauthn | ||
# Antelope-webauthn | ||
This project demonstrates how WebAuthn (Web Authentication) can be used to generate public keys and signatures for Antelope-based blockchains. WebAuthn is a web standard that provides a strong authentication mechanism using hardware-backed credentials like biometrics, security keys, or built-in device authenticators. | ||
@@ -8,6 +7,13 @@ | ||
### Installation | ||
``` | ||
$ npm i antelope-webauthn | ||
``` | ||
### Import | ||
```js | ||
import createWebAuthnSignature from "" | ||
import createWebAuthnSignature from "antelope-webauthn/create_wa_signature.js"; | ||
import createWebAuthnPublickey from "antelope-webauthn/create_wa_public_key.js"; | ||
``` |
48773
19
723