0.0.1-beta.34 • Published 8 months ago

@interchainjs/auth v0.0.1-beta.34

Weekly downloads
-
License
MIT
Repository
github
Last release
8 months ago

@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 [directAuth] = Secp256k1Auth.fromMnemonic(generateMnemonic(), [
  "m/44'/118'/0'/0/0",
]);
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)

import { HDPath } from "@interchainjs/types";

// derive with Cosmos default HD path "m/44'/118'/0'/0/0"
const [auth] = Secp256k1Auth.fromMnemonic("<MNEMONIC_WORDS>", [
  // use cosmos hdpath built by HDPath
  // we can get cosmos hdpath "m/44'/118'/0'/0/0" by this:
  HDPath.cosmos().toString(),
]);
// 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
  • ethSecp256k1 auth from @interchainjs/auth/ethSecp256k1 (Not fully implemented yet)

License

MIT License (MIT) & Apache License

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

0.0.1-alpha.33

8 months ago

0.0.1-alpha.32

8 months ago

0.0.1-beta.34

8 months ago

0.0.1-beta.33

8 months ago

0.0.1-alpha.30

8 months ago

0.0.1-alpha.31

8 months ago

0.0.1-beta.16

9 months ago

0.0.1-beta.13

9 months ago

0.0.1-beta.12

9 months ago

0.0.1-beta.11

9 months ago

0.0.1-beta.9

10 months ago

0.0.1-beta.10

10 months ago

0.0.1-beta.7

11 months ago

0.0.1-beta.6

11 months ago

0.0.1-beta.8

11 months ago

0.0.1-beta.3

11 months ago

0.0.1-beta.2

1 year ago

0.0.1-beta.4

11 months ago

0.0.1-beta.1

1 year ago

0.0.1-beta.0

1 year ago

0.0.8

1 year ago

0.0.7

1 year ago

0.0.6

1 year ago