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

@welshare/sdk

v0.1.2

Published

Primitives, schemas, utilities for interacting with Welshare's sovereign health data sharing platform

Downloads

259

Readme

Welshare shared library functions

This SDK contains provides functions, types, schemas and utilities to interact with Welshare's sovereign health data sharing protocol. It includes FHIR resource handling, Nillion integration, API clients, and validation schemas. If you're just looking for an easy way to submit data from your own frontend, the @welshare/react package might be a better fit. Use this SDK if you want to build infrastructure to manage, authenticate and profile users yourself. The bare minimum requirement is to support a signer function that users use to deterministically derive storage keypairs from their control wallets.

The package wraps Nillion's secretvaults / nuc / blindfold libraries. Some of which have server side dependencies (pino-pretty) that can create quirky side effects when running in browsers if not deliberately treeshaken. Make sure to not expose server facing features in this library (ie code that makes use of Nillion "standard" collections)

We're using tshy to build ESM compatible outputs. CommonJS is not supported.

You can find compiled API docs here: https://docs.welshare.app/sdk-docs/

Overview

Utilities

  • Base64 encoding/decoding: base64urlEncode(), base64urlDecode(), base64urlDecodeUtf()
  • Hex utilities: bytesToHex(), hexToBytes() (re-exported from viem)
  • UUID generation: makeUid()

Authentication Tools

  • JWT handling: createJWTForStorageKeys(), verifyJWT()
  • Key derivation: deriveKey() (with types Context, KeyId, UserSecret)
  • Storage keys: deriveApplicationKeypair(), deriveStorageKeypair(), verifyAuthProof()

FHIR Resources

  • FHIR namespace (Fhir):
    • validateQuestionnaire() - Validate FHIR Questionnaire resources
    • validateQuestionnaireResponse() - Validate FHIR QuestionnaireResponse resources
    • wrapFhirResourceForNillion() - Wrap FHIR resources for Nillion insertion
    • fhirDateRegex, fhirDateTimeRegex, fhirBase64BinaryRegex - Validation regex patterns
  • FHIR types: FhirCoding, FhirCodeableConcept, FhirQuantity, FhirSimpleQuantity, FhirRange, FhirRatio, FhirPeriod, FhirAttachment, FhirSampledData
  • Standard codes (StandardCodes namespace) - FHIR standard code definitions. This is VERY helpful to refer to commonly used health conditions and observations and they frequently are found in user facing questionnaires.

Nillion Integration

  • Nillion namespace (Nillion):
    • Keypair - Keypair class from @nillion/nuc (this will be replaced with a signer interface soon)
    • makeUserClient() - Create a SecretVault UserClient
    • summarizeUploadResults() - Processes an array of redundant "upload" result that's returned by cluster nodes to one single result
  • Nillion types: CollectionType, NillionClusterConfig, NillionByNodeName, NillionDid, NillionUuid, BlindfoldFactoryConfig

Welshare API Client

This namespace contains helpers that talk to the Welshare root infrastructure. While user data is stored in owned collections that conceptually aren't directly under our control, the application data (e.g. questionnaire definitions) is stored on Nillion collections that we maintain.

  • WelshareApi namespace:

    • fetchWelshareApp() - Fetches the AppRecord of a given applicationId
    • fetchDelegation() - users call this to request a delegation NUC that allows them to access to owned collections.
    • submitData() - A facade that helps submitting (questionnaire) data correctly. Fetches apps and delegations in the background, interpolates fields with client side knowledge, and pushes data to Nillion nodes.
  • Environment configuration:

    • WELSHARE_API_ENVIRONMENT - Pre-configured environments (production, staging, preview, development)
    • resolveEnvironment() - Resolve environment configuration with optional overrides
    • WelshareApiEnvironment - Type definition for environment config

Validation Schemas

All schemas are exported as Zod schemas for validation:

  • AppSchema - Application configuration
  • QuestionnaireSchema - FHIR Questionnaire
  • QuestionnaireResponseSchema - FHIR QuestionnaireResponse
  • PatientSchema - root FHIR Patient data
  • ObservationSchema - FHIR Observation
  • ObservationHelpers - Helper functions for observations
  • ConditionSchema - FHIR Condition
  • ConditionHelpers - Helper functions for conditions
  • BinaryFilesSchema - Binary files
  • NotificationsSchema - Notifications

Types

  • Session types: SessionKeyAuthMessage, AuthorizedSessionProof, SessionKeyData
  • Validation types: InsertableSubmission, InterpolateSocials, ValidatableSchema

Schemas

Fhir Resources

as an example, we're storing a subset of Fhir HL7 R5 QuestionnaireResponses. See questionnaire-response.schema.json.

  • A good json schema validation tester: https://www.jsonschemavalidator.net/
  • more tools https://forgetoolbox.com/
  • even more tools https://www.jsonforge.com/