npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

cryptoshepherds-sdk

v1.1.0

Published

Folder sharing without the need to share encryption keys in decentralized storage

Readme

CryptoShepherds SDK

暗号鍵を共有せずに、分散型ストレージ(Arweave)上のフォルダ/ファイルを共有できる SDK です。
Lit Protocol によるプログラマブルなアクセス制御を使い、オンチェーン条件(NFT保有、アドレス指定など)でアクセス権の付与・取消しができます。

インストール

npm install cryptoshepherds-sdk

クイックスタート

import CryptoShepherds from "cryptoshepherds-sdk";

const cs = new CryptoShepherds({
  walletKey: arweaveJWK,       // Arweave ウォレットキー(JWK形式)
  privateKey: "abc123...",     // secp256k1 秘密鍵(hex)
  evmPrivateKey: "def456...",  // Lit Protocol 署名用の EVM 秘密鍵
  arweaveNetwork: "testnet",   // "mainnet" | "testnet"
  litNetwork: "development",   // "development" | "testnet" | "mainnet"
});

await cs.init();

// フォルダを作成してデータを保存
await cs.createFolder("/photos/2024");
await cs.saveData("/photos/2024", "trip.txt", "旅行の思い出");

// 自分で読み直す
const data = await cs.loadData("/photos/2024", "trip.txt");
console.log(data); // "旅行の思い出"

// フォルダをアクセス条件付きで共有(例: 特定の NFT を持っているアドレス)
const condition = {
  contractAddress: "0x...",
  standardContractType: "ERC721",
  chain: "ethereum",
  method: "balanceOf",
  parameters: [":userAddress"],
  returnValueTest: { comparator: ">", value: "0" },
};
await cs.setShareFolder("/photos/2024", condition);

// 別のユーザーが共有データにアクセス
const shared = await cs.accessData("/photos/2024", "trip.txt");
console.log(shared); // "旅行の思い出"

設定オプション

| オプション | 型 | デフォルト | 説明 | |---|---|---|---| | walletKey | object | — | Arweave JWK ウォレットキー | | privateKey | string | — | secp256k1 秘密鍵(hex) | | publicKey | string | 自動導出 | secp256k1 公開鍵(省略時は privateKey から導出) | | evmPrivateKey | string | — | Lit Protocol 署名用の EVM 秘密鍵 | | arweaveNetwork | "mainnet" \| "testnet" | "testnet" | Arweave ネットワーク | | litNetwork | "development" \| "testnet" \| "mainnet" | "development" | Lit Protocol ネットワーク |

API リファレンス

init()

SDK を初期化します。他のメソッドを呼ぶ前に必ず呼び出してください。

createFolder(folderPath)

暗号化フォルダを新規作成します。フォルダキーが自動生成されます。

saveData(folderPath, fileName, data)

データ(string / Uint8Array / ArrayBuffer)を指定フォルダに暗号化して保存します。

loadData(folderPath, fileName)

自分が所有するフォルダからデータを取得・復号します。

setShareFolder(folderPath, decryptionCondition)

フォルダ全体を Lit Protocol のアクセス条件付きで共有します。

setShareData(folderPath, fileName, decryptionCondition)

ファイル単体を Lit Protocol のアクセス条件付きで共有します。

accessData(folderPath, fileName)

共有されたデータに(アクセス条件を満たしていれば)アクセスします。

必要環境

  • Node.js 18 以上
  • Arweave ウォレット(JWK 形式)
  • Lit Protocol 用の EVM ウォレット

環境変数(テスト用)

.env.example を参考に .env を作成してください:

TEST_EVM_PRIVATE_KEY=あなたのEVM秘密鍵(0xなし)

仕組み

createFolder("/a/b")
  → グローバルキーをECIESで暗号化 → Arweaveに保存
  → グループキーをグローバルキーで暗号化 → Arweaveに保存

setShareFolder("/a", condition)
  → フォルダキーをLit Protocolで暗号化(ACCに紐づけ)
  → リソースIDをArweaveに保存

accessData("/a/b", "file.txt")
  → LitからACCを満たす場合にフォルダキーを復号
  → 階層をたどってファイルキーを復号
  → Arweaveからデータを取得して復号

リンク

ライセンス

MIT