🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

@orangecheck/stamp-core

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@orangecheck/stamp-core

OC Stamp canonical message, envelope format, stamp and verify. See https://github.com/orangecheck/oc-stamp-protocol.

latest
Source
npmnpm
Version
1.0.0
Version published
Weekly downloads
105
-65.8%
Maintainers
1
Weekly downloads
 
Created
Source

@orangecheck/stamp-core

Canonical message, envelope format, stamp(), and verify() for OC Stamp.

Install

npm i @orangecheck/stamp-core

Usage

import { stamp, verify } from '@orangecheck/stamp-core';

// Produce a signed stamp envelope.
const env = await stamp({
    content: new TextEncoder().encode('hello world'),
    mime: 'text/plain',
    signer: {
        address: 'bc1qalice…',
        signMessage: async (msg) => walletSignBIP322(msg),
    },
});

// Share env as JSON, or via a URL fragment:
//   https://stamp.ochk.io/v#<base64url(JSON)>
// OTS anchoring is a separate step — see @orangecheck/stamp-ots.

// A verifier, later:
const result = await verify({
    envelope: env,
    content: new TextEncoder().encode('hello world'),
    verifyBip322: async (msg, sig, addr) => { /* your verifier */ },
});
if (!result.ok) throw new Error(`${result.code}: ${result.message}`);

Exports

  • stamp(input)StampEnvelope — build a signed envelope. Leaves ots: null; anchoring is a later step.
  • verify(input)VerifyResult — full verification algorithm per SPEC §8. Returns a discriminated {ok: true, ...} | {ok: false, code, message}.
  • canonicalMessage(input)string — the exact bytes the signer signs via BIP-322.
  • computeEnvelopeId(input)string — lowercase hex of sha256(canonical_message).
  • canonicalize(value) / canonicalizeEnvelope(env) — RFC 8785 JSON canonicalization.
  • StampError — typed error with protocol-defined code.
  • Full type definitions: StampEnvelope, StampInput, VerifyInput, StampStake, etc.

Composition

  • OTS anchoring: use @orangecheck/stamp-ots to submit an envelope's id to OpenTimestamps calendars, parse returned proofs, and upgrade pending → confirmed.
  • Stake context: populate input.stake with an OrangeCheck attestation reference. Verifiers who care should re-resolve via @orangecheck/sdk.
  • BIP-322 signing: plug in any wallet adapter — the SDK doesn't ship one. See @orangecheck/wallet-adapter for the cross-wallet reference adapter.
  • BIP-322 verification: plug in a verifier via verify({ verifyBip322 }). Node environments can use bip322-js; browser environments can use the same via a Buffer polyfill.

See SPEC.md for the normative spec.

Keywords

bitcoin

FAQs

Package last updated on 07 May 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts