サンプル
node-int64 0.4.0: Int64
検証済みサンプル — npm node-int64 0.4.0: Int64. node 22 · linux alpine/x64 · docker で contract を実行し、成功しました: new Int64(number) converts a JavaScript number to a…
sha256:9bb6093f86aa6e7899c2aed876490385e978917a43c3724955f557a5f0274b92
このネットワークが提供するのは一つだけです。ビルドされるサンプル。サンドボックスで実行し、署名済みの受領証を保管します。等級はつけず、何も保証しません — 同じコードがあなたの環境でビルドされるかは測定していません。
合格した契約受領証を提出した異なる署名鍵の数です。1 なら作者だけ、2 以上なら他の誰かもビルドしています。鍵は自己生成で背後に登録された身元がないため、数えているのは人ではなく鍵です。
MIT-0
実行証拠
宣言された環境と署名済みの実行を分けてあります。このサンプルが何をどこで実行したかをそのまま確認できます。
- 証拠の基準
- 署名済みコントラクト合格
- 検証レシート
- 1
- ビルドした署名鍵
- 1
宣言された環境
linux 24 · ubuntu · glibc 2.39 x64 npm
検証実行環境
| 環境 | コントラクト | ステージ | 実行日 |
|---|---|---|---|
| node 22 · linux alpine/x64 · docker ed25519:c1973797be207ac4 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · node-typescript@1node:22-alpine@sha256:c610fcdfb1d5… |
2026-08-26 |
ケース
HOW- ゴール
- verify pkg:npm/node-int64@0.4.0
- パッケージ
- シンボル
-
- Int64
- 作成日
- 2026-08-26T08:20:22Z
コントラクト
- new Int64(number) converts a JavaScript number to a 64-bit integer representation
- new Int64(hi, lo) constructs an Int64 from high and low 32-bit integer values
- new Int64(string) parses a hexadecimal string into an Int64 value
- new Int64(buffer, offset) reads an 8-byte big-endian integer from a Buffer at the given offset
- Int64.prototype.toOctetString(separator) formats the 64-bit integer as an octet hex string
- Int64.prototype.toNumber(allowImprecise) converts to a JavaScript number or returns Infinity for values outside safe integer precision
- Int64.prototype.toBuffer() returns an 8-byte Buffer copy containing the raw int64 bytes
- Int64.prototype.copy(targetBuffer, targetOffset) writes the 8 int64 bytes into a destination buffer
- Int64.prototype.compare(other) and equals(other) perform signed 64-bit integer comparisons
ファイル
- PROMPT.md
- csx.json
- index.mjs
- package-lock.json
- package.json
- spec.json
- test/contract.mjs
ソース
Clean-room public code sample — generation instructions
Write a brand-new, minimal, self-contained code sample in this clean-room directory.
Do not copy, paraphrase, or reference any existing project source. Work only from this spec.
A csx.json manifest scaffold already exists. Do not recreate it from memory. Preserve its case.goal, packages and symbols; fill its empty case.contract with exact assertions and correct its environment, commands and verifierAdapter for the files you generate.
Goal: verify pkg:npm/node-int64@0.4.0
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/node-int64@0.4.0
Demonstrate these symbols/APIs:
- Int64
Rules:
- One focused purpose; the smallest project that proves the goal.
- Include a contract test (test/contract.*) that runs OFFLINE and exits 0 exactly when the goal behavior works.
- Pin every dependency with a lockfile so resolution is reproducible.
- No secrets, credentials, or tokens. No real URLs (only example.com or localhost). No absolute paths.
- No personal names, emails, company names, or project identifiers of any kind.
- No binaries and no generated output (node_modules, dist, target, venv, .git, .env).
- Keep it under 200 files and 256KB packed.
{"case":{"caseId":"case:sha256:9e301c89115a0d3f104c76d13997830b8e2b9c13e6c9a10abd77f21a12d8383c","contract":["new Int64(number) converts a JavaScript number to a 64-bit integer representation","new Int64(hi, lo) constructs an Int64 from high and low 32-bit integer values","new Int64(string) parses a hexadecimal string into an Int64 value","new Int64(buffer, offset) reads an 8-byte big-endian integer from a Buffer at the given offset","Int64.prototype.toOctetString(separator) formats the 64-bit integer as an octet hex string","Int64.prototype.toNumber(allowImprecise) converts to a JavaScript number or returns Infinity for values outside safe integer precision","Int64.prototype.toBuffer() returns an 8-byte Buffer copy containing the raw int64 bytes","Int64.prototype.copy(targetBuffer, targetOffset) writes the 8 int64 bytes into a destination buffer","Int64.prototype.compare(other) and equals(other) perform signed 64-bit integer comparisons"],"goal":"verify pkg:npm/node-int64@0.4.0","kind":"HOW","packages":["pkg:npm/node-int64@0.4.0"],"schemaVersion":1,"symbols":["Int64"]},"contractCommand":["node","test/contract.mjs"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"npm","libc":"glibc","libcVersion":"2.39","os":"linux","osVersionBucket":"24","packageManager":"npm","schemaVersion":1},"license":"MIT-0","packages":["pkg:npm/node-int64@0.4.0"],"schemaVersion":1,"subject":"pkg:npm/node-int64@0.4.0","symbols":["Int64"],"verifierAdapter":"node-typescript@1"}
import Int64 from 'node-int64';
export function createInt64(value, low) {
if (low !== undefined) {
return new Int64(value, low);
}
return new Int64(value);
}
export function fromBuffer(buf, offset = 0) {
return new Int64(buf, offset);
}
export function formatHex(int64, sep = '') {
return int64.toOctetString(sep);
}
export function toNativeNumber(int64, allowImprecise = false) {
return int64.toNumber(allowImprecise);
}
export function compareInt64(a, b) {
return a.compare(b);
}
export function equalsInt64(a, b) {
return a.equals(b);
}
export { Int64 };
{
"name": "sample-node-int64",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-node-int64",
"version": "1.0.0",
"dependencies": {
"node-int64": "0.4.0"
}
},
"node_modules/node-int64": {
"version": "0.4.0",
"resolved": "https://registry.npmjs.org/node-int64/-/node-int64-0.4.0.tgz",
"integrity": "sha512-O5lz91xSOeoXP6DulyHfllpq+Eg00MWitZIbtPfoSEvqIHdl5gfcY6hYzDWnj0qD5tz52PI08u9qUvSVeUBeHw==",
"license": "MIT"
}
}
}
{
"name": "sample-node-int64",
"version": "1.0.0",
"type": "module",
"private": true,
"dependencies": {
"node-int64": "0.4.0"
},
"scripts": {
"test": "node test/contract.mjs"
}
}
{
"schemaVersion": 1,
"goal": "verify pkg:npm/node-int64@0.4.0",
"kind": "HOW",
"packages": [
"pkg:npm/node-int64@0.4.0"
],
"symbols": [
"Int64"
]
}
import assert from 'node:assert/strict';
import Int64 from 'node-int64';
import {
createInt64,
fromBuffer,
formatHex,
toNativeNumber,
compareInt64,
equalsInt64
} from '../index.mjs';
// 1. new Int64(number) converts a JavaScript number to a 64-bit integer representation
{
const positive = createInt64(12345678);
assert.equal(positive.toNumber(), 12345678);
assert.equal(positive.toString(), '12345678');
const negative = createInt64(-987654);
assert.equal(negative.toNumber(), -987654);
assert.equal(negative.toString(), '-987654');
}
// 2. new Int64(hi, lo) constructs an Int64 from high and low 32-bit integer values
{
const hiLo = createInt64(0x01234567, 0x89abcdef);
assert.equal(hiLo.toOctetString(), '0123456789abcdef');
}
// 3. new Int64(string) parses a hexadecimal string into an Int64 value
{
const fromHexStr = createInt64('0x0123456789abcdef');
const expected = createInt64(0x01234567, 0x89abcdef);
assert.equal(fromHexStr.toOctetString(), '0123456789abcdef');
assert.ok(fromHexStr.equals(expected));
}
// 4. new Int64(buffer, offset) reads an 8-byte big-endian integer from a Buffer at the given offset
{
const raw = Buffer.from([0xaa, 0xbb, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00]);
const fromBuf = fromBuffer(raw, 2);
assert.equal(fromBuf.toNumber(), 256);
assert.equal(fromBuf.toOctetString(), '0000000000000100');
}
// 5. Int64.prototype.toOctetString(separator) formats the 64-bit integer as an octet hex string
{
const val = createInt64(0x01234567, 0x89abcdef);
assert.equal(formatHex(val), '0123456789abcdef');
assert.equal(formatHex(val, ' '), '01 23 45 67 89 ab cd ef');
assert.equal(formatHex(val, '-'), '01-23-45-67-89-ab-cd-ef');
}
// 6. Int64.prototype.toNumber(allowImprecise) converts to a JavaScript number or returns Infinity for values outside safe integer precision
{
const safeVal = createInt64(42);
assert.equal(toNativeNumber(safeVal), 42);
const overflow = createInt64('7fffffffffffffff');
assert.equal(toNativeNumber(overflow, false), Infinity);
assert.notEqual(toNativeNumber(overflow, true), Infinity);
}
// 7. Int64.prototype.toBuffer() returns an 8-byte Buffer copy containing the raw int64 bytes
{
const val = createInt64(0x12345678, 0x90abcdef);
const buf = val.toBuffer();
assert.ok(Buffer.isBuffer(buf));
assert.equal(buf.length, 8);
assert.equal(buf[0], 0x12);
assert.equal(buf[7], 0xef);
}
// 8. Int64.prototype.copy(targetBuffer, targetOffset) writes the 8 int64 bytes into a destination buffer
{
const val = createInt64(0x12345678, 0x90abcdef);
const dest = Buffer.alloc(12, 0);
val.copy(dest, 2);
assert.equal(dest[2], 0x12);
assert.equal(dest[9], 0xef);
assert.equal(dest[0], 0);
assert.equal(dest[10], 0);
}
// 9. Int64.prototype.compare(other) and equals(other) perform signed 64-bit integer comparisons
{
const small = createInt64(100);
const medium = createInt64(200);
const duplicateSmall = createInt64(100);
assert.ok(compareInt64(small, medium) < 0);
assert.ok(compareInt64(medium, small) > 0);
assert.equal(compareInt64(small, duplicateSmall), 0);
assert.equal(equalsInt64(small, duplicateSmall), true);
assert.equal(equalsInt64(small, medium), false);
}
console.log('Contract tests passed successfully.');
オリジンシーダー
匿名