Skip to main content

Crypto utils for import/export/gen ec keys

Works with
It is unknown whether this package works with Bun
It is unknown whether this package works with Cloudflare Workers
This package works with Node.js
This package works with Deno
This package works with Browsers
JSR Score
100%
Published
2 weeks ago (0.1.2)

Crypto utils

JSR CI

Provide crypto utils for import/export/gen ec keys.

Usage

import key

import {importKeyRaw} from '@maks11060/crypto'

const pub = await importKeyRaw({
  alg: 'Ed25519',
  public: '8a4f5d16b246de737965a97ee997f4e4080ccf361d3a16178b689b10321453d4'
})
const priv = await importKeyRaw({
  alg: 'Ed25519',
  public: "8a4f5d16b246de737965a97ee997f4e4080ccf361d3a16178b689b10321453d4",
  private: "3ac0c3792c389759ae813828b9efffb4bdc13b47b71cfab869f365423b3c4e57"
})

import key pair

import {importKeyPairRaw} from '@maks11060/crypto'

const keys = await importKeyPairRaw({
  alg: 'Ed25519',
  public: "8a4f5d16b246de737965a97ee997f4e4080ccf361d3a16178b689b10321453d4",
  private: "3ac0c3792c389759ae813828b9efffb4bdc13b47b71cfab869f365423b3c4e57"
})
keys // {privateKey, publicKey}

generate / export key

import {generateKeyPair, exportKeyRaw} from '@maks11060/crypto'

const keyPair = await generateKeyPair('Ed25519')
const keys = await exportKeyRaw(keyPair.privateKey)
keys.private // 88f913..8491ab
keys.public // 372375..eaf2e9

Algorithm supported

Algorithm Deno Node.js
Ed25519
P-256 / ES256
P-384 / ES384
P-521 / ES512
Built and signed on
GitHub Actions
View transparency log

Add Package

deno add @maks11060/crypto

Import symbol

import * as mod from "@maks11060/crypto";

Add Package

npx jsr add @maks11060/crypto

Import symbol

import * as mod from "@maks11060/crypto";

Add Package

yarn dlx jsr add @maks11060/crypto

Import symbol

import * as mod from "@maks11060/crypto";

Add Package

pnpm dlx jsr add @maks11060/crypto

Import symbol

import * as mod from "@maks11060/crypto";

Add Package

bunx jsr add @maks11060/crypto

Import symbol

import * as mod from "@maks11060/crypto";