@interchainjs/auth
TypeScript icon, indicating that this package has built-in type declarations

0.0.8 • Public • Published

@interchainjs/auth

Authentication/Wallet for web3 accounts.

Usage

npm install @interchainjs/auth

Taking secp256k1 as example.

// import * from "@interchainjs/auth"; // Error: use sub-imports, to ensure small app size
import { Secp256k1Auth } from "@interchainjs/auth/secp256k1";

const auth = Secp256k1Auth.fromMnemonic("<MNEMONIC_WORDS>", "<HD path>");
const signature = auth.sign(Uint8Array.from([1, 2, 3]));
console.log(signature.toHex());

It's easy to derive cosmos/injective/ethereum network HD path (taking cosmos as example)

// derive with Cosmos default HD path "m/44'/118'/0'/0/0"
const auth = Secp256k1Auth.fromMnemonic("<MNEMONIC_WORDS>", "cosmos");
// is identical to 
const auth = Secp256k1Auth.fromMnemonic("<MNEMONIC_WORDS>", "m/44'/118'/0'/0/0");

Auth objected can be utilized by different signers. See

Implementations

  • secp256k1 auth from @interchainjs/auth/secp256k1
  • ed25519 auth from @interchainjs/auth/ed25519 (Not fully implemented yet)

License

MIT License (MIT) & Apache License

Copyright (c) 2024 Cosmology (https://cosmology.zone/)

Package Sidebar

Install

npm i @interchainjs/auth

Weekly Downloads

2

Version

0.0.8

License

MIT

Unpacked Size

35 kB

Total Files

29

Last publish

Collaborators

  • zetazz
  • ljun
  • pyramation