@cardanotech/testing
@cardanotech/testing provides deterministic Wallet Proof fixtures, a fake
CIP-30 wallet API, and an in-memory typed gateway target for consumer contract
tests. Its cardano.tech dependencies are released protocol packages. It never
connects to a wallet, gateway, or Cardano network; its other runtime dependency
is the typed transport primitive from @api.global/typedrequest.
Issue Reporting and Security
For reporting bugs, issues, or security vulnerabilities, please visit community.foss.global/. This is the central community hub for all issue reporting. Developers who sign and comply with our contribution agreement and go through identification can also get a code.foss.global/ account to submit Pull Requests directly.
Install
pnpm add --save-dev @cardanotech/testing
Protocol fixtures
Challenge and receipt fixtures keep their duplicated protocol fields
synchronized. Challenge messages are produced with the canonical encoder from
@cardanotech/walletproof.
import {
createWalletProofChallengeFixture,
createWalletProofReceiptFixture,
createWireOnlyWalletProofSubmissionFixture,
} from '@cardanotech/testing';
const challenge = createWalletProofChallengeFixture({
audience: 'my-service',
purpose: 'link-wallet',
});
const receipt = createWalletProofReceiptFixture({ challenge });
const submission = createWireOnlyWalletProofSubmissionFixture({
challengeId: challenge.challengeId,
});
createWireOnlyWalletProofSubmissionFixture() intentionally returns an invalid
default signature and public key. It is for DTO, SDK, and transport tests only.
Use known-answer CIP-8 vectors with the server verifier from
@cardanotech/walletproof when testing cryptographic verification.
The default timestamps are fixed for deterministic assertions. Supply explicit timestamps or inject a matching clock into the component under test when validity-window behavior matters.
Fake browser wallet
FakeCip30WalletApi implements the exact wallet API accepted by
WalletProofBrowserClient. It records signing calls without discovering or
contacting a real browser wallet.
import { WalletProofBrowserClient } from '@cardanotech/walletproof/browser';
import {
FakeCip30WalletApi,
createWalletProofChallengeFixture,
} from '@cardanotech/testing';
const challenge = createWalletProofChallengeFixture();
const wallet = new FakeCip30WalletApi();
const client = new WalletProofBrowserClient({
expectedOrigin: challenge.messageData.origin,
clock: () => new Date('2026-07-27T12:01:00.000Z'),
});
const submission = await client.createSubmission(wallet, challenge);
const calls = wallet.calls;
wallet.dispose();
The fake only models the narrow CIP-30 boundary used by Wallet Proof. It does not emulate extension discovery, user consent UI, account switching, or a cryptographic wallet.
Typed gateway harness
CardanoGatewayTestHarness exposes a TypedTarget for the exact three
@cardanotech/interfaces Wallet Proof methods. Handlers return structured
success or error results and the harness records typed calls.
import {
CardanoGatewayTestHarness,
createWalletProofChallengeFixture,
createWalletProofReceiptFixture,
gatewayTestSuccess,
} from '@cardanotech/testing';
const challenge = createWalletProofChallengeFixture();
const receipt = createWalletProofReceiptFixture({ challenge });
const harness = new CardanoGatewayTestHarness({
createWalletProofChallenge: async () =>
gatewayTestSuccess({ challenge }),
completeWalletProofChallenge: async () =>
gatewayTestSuccess({ receipt }),
getWalletProofReceipt: async () =>
gatewayTestSuccess({ receipt }),
});
declare const setGatewayTarget: (targetArg: typeof harness.target) => void;
setGatewayTarget(harness.target);
harness.dispose();
Pass harness.target to the consumer's existing typed client boundary. The
harness deliberately does not define an endpoint, authentication scheme,
tenant resolver, retry policy, or network behavior.
Signing calls and typed gateway calls can contain proof material. Keep them in
test processes only and call clear() or dispose() after each test. The
accessors return snapshots so callers cannot mutate the harness's internal
records.
License and Legal Information
This repository contains open-source code licensed under the MIT License. A copy of the license can be found in the repository license file.
Please note: The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.
Trademarks
This project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH or third parties, and are not included within the scope of the MIT license granted herein.
Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines or the guidelines of the respective third-party owners, and any usage must be approved in writing. Third-party trademarks used herein are the property of their respective owners and used only in a descriptive manner, e.g. for an implementation of an API or similar.
Company Information
Task Venture Capital GmbH
Registered at District Court Bremen HRB 35230 HB, Germany
For any legal inquiries or further information, please contact us via email at hello@task.vc.
By using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.