@blockchaincommons/tags 1.0.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","names":["IANA_URI","IANA_UUID","IANA_ENCODED_CBOR"],"sources":["../src/tags.ts","../src/register.ts"],"sourcesContent":["/**\n * The Blockchain Commons CBOR tag registry.\n *\n * Values are the CBOR tag numbers on the wire; names are wire too, since\n * `uniform-resources` derives UR types from them (`ur:envelope`). Neither\n * may change without a specification change. Every constant is frozen.\n *\n * Tags compare by value: `TAG_ENVELOPE === Tag.from(200, \"envelope\")` is\n * `false` (two objects), `Tag.equals(a, b)` and `a.value === b.value` are\n * the comparisons to write.\n *\n * @see https://github.com/BlockchainCommons/Research/blob/master/papers/bcr-2020-006-urtypes.md\n * @module tags\n */\nimport {\n Tag,\n TAG_ENCODED_CBOR as IANA_ENCODED_CBOR,\n TAG_URI as IANA_URI,\n TAG_UUID as IANA_UUID,\n} from \"@blockchaincommons/dcbor\";\n\n/**\n * One immutable tag. dcbor's `Tag.from` returns a plain object whose\n * `readonly` is a compile-time promise only; the names here are wire,\n * so nothing may rewrite them process-wide.\n */\nconst tag = (value: number, name: string): Tag => Object.freeze(Tag.from(value, name));\n\n// IANA standard tags this stack uses. dcbor owns the numbers (it defines\n// them unnamed); this registry owns the names.\n\n/** #6.32: URI (RFC 8949 §3.4.5.3), named `url` in this stack. */\nexport const TAG_URI: Tag = tag(IANA_URI, \"url\");\n/** #6.37: binary UUID (RFC 4122). */\nexport const TAG_UUID: Tag = tag(IANA_UUID, \"uuid\");\n\n// Core Envelope tags. #6.24 was used as the leaf header by an earlier spec\n// (incorrectly: RFC 8949 §3.4.5.1 requires a byte string); #6.201 replaced\n// it and #6.24 is still recognised on decode. #6.200 and #6.201 are the only\n// Blockchain Commons tags in IANA's \"Specification Required\" range.\n\n/** #6.24: encoded CBOR data item; the pre-#6.201 Envelope leaf header, accepted on decode only. */\nexport const TAG_ENCODED_CBOR: Tag = tag(IANA_ENCODED_CBOR, \"encoded-cbor\");\n/** #6.200: Gordian Envelope. */\nexport const TAG_ENVELOPE: Tag = tag(200, \"envelope\");\n/** #6.201: dCBOR data item; the Envelope leaf case. */\nexport const TAG_LEAF: Tag = tag(201, \"leaf\");\n/** #6.262: byte string holding UTF-8 JSON text. */\nexport const TAG_JSON: Tag = tag(262, \"json\");\n\n// Envelope extensions.\n\n/** #6.40000: known value, a registered unsigned integer with a fixed meaning. */\nexport const TAG_KNOWN_VALUE: Tag = tag(40000, \"known-value\");\n/** #6.40001: SHA-256 digest. */\nexport const TAG_DIGEST: Tag = tag(40001, \"digest\");\n/** #6.40002: encrypted message (IETF ChaCha20-Poly1305). */\nexport const TAG_ENCRYPTED: Tag = tag(40002, \"encrypted\");\n/** #6.40003: DEFLATE-compressed data with the digest of the original. */\nexport const TAG_COMPRESSED: Tag = tag(40003, \"compressed\");\n\n// Distributed function calls.\n\n/** #6.40004: request. */\nexport const TAG_REQUEST: Tag = tag(40004, \"request\");\n/** #6.40005: response. */\nexport const TAG_RESPONSE: Tag = tag(40005, \"response\");\n/** #6.40006: function identifier. */\nexport const TAG_FUNCTION: Tag = tag(40006, \"function\");\n/** #6.40007: parameter identifier. */\nexport const TAG_PARAMETER: Tag = tag(40007, \"parameter\");\n/** #6.40008: placeholder. */\nexport const TAG_PLACEHOLDER: Tag = tag(40008, \"placeholder\");\n/** #6.40009: replacement. */\nexport const TAG_REPLACEMENT: Tag = tag(40009, \"replacement\");\n\n// Cryptographic components.\n\n/** #6.40010: X25519 key-agreement private key. */\nexport const TAG_X25519_PRIVATE_KEY: Tag = tag(40010, \"agreement-private-key\");\n/** #6.40011: X25519 key-agreement public key. */\nexport const TAG_X25519_PUBLIC_KEY: Tag = tag(40011, \"agreement-public-key\");\n/** #6.40012: apparently random identifier (32 bytes). */\nexport const TAG_ARID: Tag = tag(40012, \"arid\");\n/** #6.40013: a signing and an encapsulation private key together. */\nexport const TAG_PRIVATE_KEYS: Tag = tag(40013, \"crypto-prvkeys\");\n/** #6.40014: nonce. */\nexport const TAG_NONCE: Tag = tag(40014, \"nonce\");\n/** #6.40015: password. */\nexport const TAG_PASSWORD: Tag = tag(40015, \"password\");\n/** #6.40016: private key base, the material every other key derives from. */\nexport const TAG_PRIVATE_KEY_BASE: Tag = tag(40016, \"crypto-prvkey-base\");\n/** #6.40017: a signing and an encapsulation public key together. */\nexport const TAG_PUBLIC_KEYS: Tag = tag(40017, \"crypto-pubkeys\");\n/** #6.40018: salt. */\nexport const TAG_SALT: Tag = tag(40018, \"salt\");\n/** #6.40019: sealed message, encrypted to a recipient's public keys. */\nexport const TAG_SEALED_MESSAGE: Tag = tag(40019, \"crypto-sealed\");\n/** #6.40020: signature. */\nexport const TAG_SIGNATURE: Tag = tag(40020, \"signature\");\n/** #6.40021: signing private key. */\nexport const TAG_SIGNING_PRIVATE_KEY: Tag = tag(40021, \"signing-private-key\");\n/** #6.40022: signing public key. */\nexport const TAG_SIGNING_PUBLIC_KEY: Tag = tag(40022, \"signing-public-key\");\n/** #6.40023: symmetric encryption key. */\nexport const TAG_SYMMETRIC_KEY: Tag = tag(40023, \"crypto-key\");\n/** #6.40024: extensible identifier (XID). */\nexport const TAG_XID: Tag = tag(40024, \"xid\");\n/** #6.40025: reference to an identifier by a prefix of it. */\nexport const TAG_REFERENCE: Tag = tag(40025, \"reference\");\n/** #6.40026: distributed function call event. */\nexport const TAG_EVENT: Tag = tag(40026, \"event\");\n/** #6.40027: symmetric key wrapped for a recipient. */\nexport const TAG_ENCRYPTED_KEY: Tag = tag(40027, \"encrypted-key\");\n\n// Post-quantum.\n\n/** #6.40100: ML-KEM (FIPS 203) private key. */\nexport const TAG_MLKEM_PRIVATE_KEY: Tag = tag(40100, \"mlkem-private-key\");\n/** #6.40101: ML-KEM (FIPS 203) public key. */\nexport const TAG_MLKEM_PUBLIC_KEY: Tag = tag(40101, \"mlkem-public-key\");\n/** #6.40102: ML-KEM (FIPS 203) encapsulated ciphertext. */\nexport const TAG_MLKEM_CIPHERTEXT: Tag = tag(40102, \"mlkem-ciphertext\");\n/** #6.40103: ML-DSA (FIPS 204) private key. */\nexport const TAG_MLDSA_PRIVATE_KEY: Tag = tag(40103, \"mldsa-private-key\");\n/** #6.40104: ML-DSA (FIPS 204) public key. */\nexport const TAG_MLDSA_PUBLIC_KEY: Tag = tag(40104, \"mldsa-public-key\");\n/** #6.40105: ML-DSA (FIPS 204) signature. */\nexport const TAG_MLDSA_SIGNATURE: Tag = tag(40105, \"mldsa-signature\");\n\n// Seeds, keys and wallets.\n\n/** #6.40300: cryptographic seed. */\nexport const TAG_SEED: Tag = tag(40300, \"seed\");\n/** #6.40303: BIP-32 hierarchical deterministic key. */\nexport const TAG_HDKEY: Tag = tag(40303, \"hdkey\");\n/** #6.40304: BIP-32 derivation path. */\nexport const TAG_DERIVATION_PATH: Tag = tag(40304, \"keypath\");\n/** #6.40305: coin type and network (`coin-info`). */\nexport const TAG_USE_INFO: Tag = tag(40305, \"coin-info\");\n/** #6.40306: elliptic-curve key. */\nexport const TAG_EC_KEY: Tag = tag(40306, \"eckey\");\n/** #6.40307: address. */\nexport const TAG_ADDRESS: Tag = tag(40307, \"address\");\n/** #6.40308: output descriptor. */\nexport const TAG_OUTPUT_DESCRIPTOR: Tag = tag(40308, \"output-descriptor\");\n/** #6.40309: SSKR share. */\nexport const TAG_SSKR_SHARE: Tag = tag(40309, \"sskr\");\n/** #6.40310: partially signed Bitcoin transaction. */\nexport const TAG_PSBT: Tag = tag(40310, \"psbt\");\n/** #6.40311: account descriptor. */\nexport const TAG_ACCOUNT_DESCRIPTOR: Tag = tag(40311, \"account-descriptor\");\n\n// SSH.\n\n/** #6.40800: OpenSSH text-format private key. */\nexport const TAG_SSH_TEXT_PRIVATE_KEY: Tag = tag(40800, \"ssh-private\");\n/** #6.40801: OpenSSH text-format public key. */\nexport const TAG_SSH_TEXT_PUBLIC_KEY: Tag = tag(40801, \"ssh-public\");\n/** #6.40802: OpenSSH text-format signature. */\nexport const TAG_SSH_TEXT_SIGNATURE: Tag = tag(40802, \"ssh-signature\");\n/** #6.40803: OpenSSH text-format certificate. */\nexport const TAG_SSH_TEXT_CERTIFICATE: Tag = tag(40803, \"ssh-certificate\");\n\n/** #6.1347571542: provenance mark. */\nexport const TAG_PROVENANCE_MARK: Tag = tag(1347571542, \"provenance\");\n\n// Output descriptor script types (subtypes of `crypto-output`).\n\n/** #6.400: output descriptor `sh` (script hash). */\nexport const TAG_OUTPUT_SCRIPT_HASH: Tag = tag(400, \"output-script-hash\");\n/** #6.401: output descriptor `wsh` (witness script hash). */\nexport const TAG_OUTPUT_WITNESS_SCRIPT_HASH: Tag = tag(401, \"output-witness-script-hash\");\n/** #6.402: output descriptor `pk` (public key). */\nexport const TAG_OUTPUT_PUBLIC_KEY: Tag = tag(402, \"output-public-key\");\n/** #6.403: output descriptor `pkh` (public key hash). */\nexport const TAG_OUTPUT_PUBLIC_KEY_HASH: Tag = tag(403, \"output-public-key-hash\");\n/** #6.404: output descriptor `wpkh` (witness public key hash). */\nexport const TAG_OUTPUT_WITNESS_PUBLIC_KEY_HASH: Tag = tag(404, \"output-witness-public-key-hash\");\n/** #6.405: output descriptor `combo`. */\nexport const TAG_OUTPUT_COMBO: Tag = tag(405, \"output-combo\");\n/** #6.406: output descriptor `multi` (multisig). */\nexport const TAG_OUTPUT_MULTISIG: Tag = tag(406, \"output-multisig\");\n/** #6.407: output descriptor `sortedmulti` (sorted multisig). */\nexport const TAG_OUTPUT_SORTED_MULTISIG: Tag = tag(407, \"output-sorted-multisig\");\n/** #6.408: output descriptor `raw` (raw script). */\nexport const TAG_OUTPUT_RAW_SCRIPT: Tag = tag(408, \"output-raw-script\");\n/** #6.409: output descriptor `tr` (taproot). */\nexport const TAG_OUTPUT_TAPROOT: Tag = tag(409, \"output-taproot\");\n/** #6.410: output descriptor cosigner. */\nexport const TAG_OUTPUT_COSIGNER: Tag = tag(410, \"output-cosigner\");\n\n/** The legacy tag set; see {@link LEGACY_TAGS}. */\nexport interface LegacyTags {\n /** #6.300: `crypto-seed`, superseded by {@link TAG_SEED}. */\n readonly SEED_V1: Tag;\n /** #6.306: `crypto-eckey`, superseded by {@link TAG_EC_KEY}. */\n readonly EC_KEY_V1: Tag;\n /** #6.309: `crypto-sskr`, superseded by {@link TAG_SSKR_SHARE}. */\n readonly SSKR_SHARE_V1: Tag;\n /** #6.303: `crypto-hdkey`, superseded by {@link TAG_HDKEY}. */\n readonly HDKEY_V1: Tag;\n /** #6.304: `crypto-keypath`, superseded by {@link TAG_DERIVATION_PATH}. */\n readonly DERIVATION_PATH_V1: Tag;\n /** #6.305: `crypto-coin-info`, superseded by {@link TAG_USE_INFO}. */\n readonly USE_INFO_V1: Tag;\n /** #6.307: `crypto-output`, superseded by {@link TAG_OUTPUT_DESCRIPTOR}. */\n readonly OUTPUT_DESCRIPTOR_V1: Tag;\n /** #6.310: `crypto-psbt`, superseded by {@link TAG_PSBT}. */\n readonly PSBT_V1: Tag;\n /** #6.311: `crypto-account`, superseded by {@link TAG_ACCOUNT_DESCRIPTOR}. */\n readonly ACCOUNT_V1: Tag;\n}\n\n/**\n * Superseded tags, accepted on decode only. They sit in IANA's\n * \"Specification Required\" range (300–311) and were replaced by the\n * first-come-first-served 40300+ tags above; existing data still uses them.\n * Never emit these for new data. Frozen, like every entry in it.\n */\nexport const LEGACY_TAGS: LegacyTags = Object.freeze({\n SEED_V1: tag(300, \"crypto-seed\"),\n EC_KEY_V1: tag(306, \"crypto-eckey\"),\n SSKR_SHARE_V1: tag(309, \"crypto-sskr\"),\n HDKEY_V1: tag(303, \"crypto-hdkey\"),\n DERIVATION_PATH_V1: tag(304, \"crypto-keypath\"),\n USE_INFO_V1: tag(305, \"crypto-coin-info\"),\n OUTPUT_DESCRIPTOR_V1: tag(307, \"crypto-output\"),\n PSBT_V1: tag(310, \"crypto-psbt\"),\n ACCOUNT_V1: tag(311, \"crypto-account\"),\n});\n\n/**\n * Every tag this package defines, in registration order (the order the\n * Rust reference registers them). Iterate this rather than the constants.\n * Frozen, like every entry in it.\n */\nexport const ALL_TAGS: readonly Tag[] = Object.freeze([\n TAG_URI,\n TAG_UUID,\n TAG_ENCODED_CBOR,\n TAG_ENVELOPE,\n TAG_LEAF,\n TAG_JSON,\n TAG_KNOWN_VALUE,\n TAG_DIGEST,\n TAG_ENCRYPTED,\n TAG_COMPRESSED,\n TAG_REQUEST,\n TAG_RESPONSE,\n TAG_FUNCTION,\n TAG_PARAMETER,\n TAG_PLACEHOLDER,\n TAG_REPLACEMENT,\n TAG_EVENT,\n LEGACY_TAGS.SEED_V1,\n LEGACY_TAGS.EC_KEY_V1,\n LEGACY_TAGS.SSKR_SHARE_V1,\n TAG_SEED,\n TAG_EC_KEY,\n TAG_SSKR_SHARE,\n TAG_X25519_PRIVATE_KEY,\n TAG_X25519_PUBLIC_KEY,\n TAG_ARID,\n TAG_PRIVATE_KEYS,\n TAG_NONCE,\n TAG_PASSWORD,\n TAG_PRIVATE_KEY_BASE,\n TAG_PUBLIC_KEYS,\n TAG_SALT,\n TAG_SEALED_MESSAGE,\n TAG_SIGNATURE,\n TAG_SIGNING_PRIVATE_KEY,\n TAG_SIGNING_PUBLIC_KEY,\n TAG_SYMMETRIC_KEY,\n TAG_XID,\n TAG_REFERENCE,\n TAG_ENCRYPTED_KEY,\n TAG_MLKEM_PRIVATE_KEY,\n TAG_MLKEM_PUBLIC_KEY,\n TAG_MLKEM_CIPHERTEXT,\n TAG_MLDSA_PRIVATE_KEY,\n TAG_MLDSA_PUBLIC_KEY,\n TAG_MLDSA_SIGNATURE,\n LEGACY_TAGS.HDKEY_V1,\n LEGACY_TAGS.DERIVATION_PATH_V1,\n LEGACY_TAGS.USE_INFO_V1,\n LEGACY_TAGS.OUTPUT_DESCRIPTOR_V1,\n LEGACY_TAGS.PSBT_V1,\n LEGACY_TAGS.ACCOUNT_V1,\n TAG_HDKEY,\n TAG_DERIVATION_PATH,\n TAG_USE_INFO,\n TAG_ADDRESS,\n TAG_OUTPUT_DESCRIPTOR,\n TAG_PSBT,\n TAG_ACCOUNT_DESCRIPTOR,\n TAG_SSH_TEXT_PRIVATE_KEY,\n TAG_SSH_TEXT_PUBLIC_KEY,\n TAG_SSH_TEXT_SIGNATURE,\n TAG_SSH_TEXT_CERTIFICATE,\n TAG_OUTPUT_SCRIPT_HASH,\n TAG_OUTPUT_WITNESS_SCRIPT_HASH,\n TAG_OUTPUT_PUBLIC_KEY,\n TAG_OUTPUT_PUBLIC_KEY_HASH,\n TAG_OUTPUT_WITNESS_PUBLIC_KEY_HASH,\n TAG_OUTPUT_COMBO,\n TAG_OUTPUT_MULTISIG,\n TAG_OUTPUT_SORTED_MULTISIG,\n TAG_OUTPUT_RAW_SCRIPT,\n TAG_OUTPUT_TAPROOT,\n TAG_OUTPUT_COSIGNER,\n TAG_PROVENANCE_MARK,\n]);\n","/**\n * Registration into a dCBOR tags store.\n *\n * @module register\n */\nimport { type TagsStore, getGlobalTagsStore, registerStandardTags } from \"@blockchaincommons/dcbor\";\nimport { ALL_TAGS } from \"./tags.js\";\n\n/**\n * Register dcbor's standard tags and every tag in {@link ALL_TAGS} into\n * `store` (default: the global store).\n *\n * Idempotent: the store compares names, so a value already registered under\n * the same name is a no-op, which is what makes repeated calls safe.\n *\n * @param store - The store to register into; defaults to dcbor's global store.\n * @throws {Error} dcbor's store throws a bare `Error` when a value is\n * already registered under a *different* name\n * (`Attempt to register tag: 200 'foo' with different name: 'envelope'`).\n */\nexport function registerTags(store: TagsStore = getGlobalTagsStore()): void {\n registerStandardTags(store);\n store.registerAll([...ALL_TAGS]);\n}\n"],"mappings":"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"}
package/package.json ADDED
@@ -0,0 +1,105 @@
1
+ {
2
+ "name": "@blockchaincommons/tags",
3
+ "version": "1.0.0-beta.1",
4
+ "type": "module",
5
+ "sideEffects": false,
6
+ "description": "Blockchain Commons CBOR Tags Registry for TypeScript",
7
+ "license": "BSD-2-Clause-Patent",
8
+ "author": {
9
+ "name": "Blockchain Commons",
10
+ "email": "info@blockchaincommons.com",
11
+ "url": "https://www.blockchaincommons.com"
12
+ },
13
+ "homepage": "https://github.com/BlockchainCommons/bc-tags-ts",
14
+ "repository": {
15
+ "type": "git",
16
+ "url": "git+https://github.com/BlockchainCommons/bc-tags-ts.git"
17
+ },
18
+ "bugs": {
19
+ "url": "https://github.com/BlockchainCommons/bc-tags-ts/issues"
20
+ },
21
+ "publishConfig": {
22
+ "access": "public"
23
+ },
24
+ "main": "dist/index.cjs",
25
+ "module": "dist/index.mjs",
26
+ "types": "dist/index.d.mts",
27
+ "exports": {
28
+ ".": {
29
+ "import": {
30
+ "types": "./dist/index.d.mts",
31
+ "default": "./dist/index.mjs"
32
+ },
33
+ "require": {
34
+ "types": "./dist/index.d.cts",
35
+ "default": "./dist/index.cjs"
36
+ },
37
+ "default": "./dist/index.mjs"
38
+ },
39
+ "./package.json": "./package.json"
40
+ },
41
+ "files": [
42
+ "dist",
43
+ "src",
44
+ "README.md",
45
+ "MIGRATION.md"
46
+ ],
47
+ "scripts": {
48
+ "build": "tsdown",
49
+ "test": "vitest run",
50
+ "test:watch": "vitest",
51
+ "test:coverage": "vitest run --coverage",
52
+ "lint": "eslint 'src/**/*.ts' 'tests/**/*.ts'",
53
+ "lint:fix": "eslint 'src/**/*.ts' 'tests/**/*.ts' --fix",
54
+ "format": "prettier --write 'src/**/*.ts' 'tests/**/*.ts'",
55
+ "format:check": "prettier --check 'src/**/*.ts' 'tests/**/*.ts'",
56
+ "typecheck": "tsc --noEmit",
57
+ "size": "size-limit",
58
+ "api:snapshot": "bun scripts/api-snapshot.mjs && node scripts/api-report.mjs --local",
59
+ "api:check": "bun scripts/api-snapshot.mjs --check && node scripts/api-report.mjs",
60
+ "clean": "rm -rf dist",
61
+ "docs": "typedoc",
62
+ "postinstall": "node scripts/pin-lint-typescript.mjs",
63
+ "prepublishOnly": "npm run build",
64
+ "lint:pkg": "publint && attw --pack . --profile node16",
65
+ "check:deps": "node scripts/check-deps.mjs",
66
+ "test:golden": "vitest run tests/golden-vectors.test.ts",
67
+ "test:differential": "vitest run tests/differential.test.ts",
68
+ "vectors:generate": "bun scripts/generate-vectors.mjs",
69
+ "baseline:build": "bun scripts/build-baseline.mjs"
70
+ },
71
+ "keywords": [
72
+ "cbor",
73
+ "tags",
74
+ "blockchain-commons",
75
+ "envelope",
76
+ "gordian",
77
+ "cryptography"
78
+ ],
79
+ "engines": {
80
+ "node": ">=22.12"
81
+ },
82
+ "devDependencies": {
83
+ "@arethetypeswrong/cli": "^0.18.5",
84
+ "@eslint/js": "^10.0.1",
85
+ "@microsoft/api-extractor": "^7.59.1",
86
+ "@size-limit/preset-small-lib": "^13.0.3",
87
+ "@types/node": "^26.1.1",
88
+ "@typescript-eslint/eslint-plugin": "^8.70.0",
89
+ "@typescript-eslint/parser": "^8.70.0",
90
+ "@vitest/coverage-v8": "^5.0.0",
91
+ "ajv": "^8.20.0",
92
+ "eslint": "^10.10.0",
93
+ "prettier": "3.9.6",
94
+ "publint": "^0.3.24",
95
+ "size-limit": "^13.0.3",
96
+ "tsdown": "^0.23.0",
97
+ "typedoc": "^0.28.20",
98
+ "typescript": "^7.0.2",
99
+ "typescript6": "npm:typescript@^6.0.3",
100
+ "vitest": "^5.0.0"
101
+ },
102
+ "dependencies": {
103
+ "@blockchaincommons/dcbor": "^1.0.0-beta.1"
104
+ }
105
+ }
package/src/index.ts ADDED
@@ -0,0 +1,81 @@
1
+ /**
2
+ * @blockchaincommons/tags - the CBOR tags used by Blockchain Commons
3
+ * protocols (Gordian Envelope, URs, crypto components), as frozen dcbor
4
+ * `Tag` values spelled `TAG_<NAME>`, plus {@link registerTags} to name them
5
+ * in a dcbor `TagsStore`. Compare tags with `Tag.equals` or by `.value`,
6
+ * never with `===`.
7
+ *
8
+ * @module @blockchaincommons/tags
9
+ */
10
+ export {
11
+ TAG_URI,
12
+ TAG_UUID,
13
+ TAG_ENCODED_CBOR,
14
+ TAG_ENVELOPE,
15
+ TAG_LEAF,
16
+ TAG_JSON,
17
+ TAG_KNOWN_VALUE,
18
+ TAG_DIGEST,
19
+ TAG_ENCRYPTED,
20
+ TAG_COMPRESSED,
21
+ TAG_REQUEST,
22
+ TAG_RESPONSE,
23
+ TAG_FUNCTION,
24
+ TAG_PARAMETER,
25
+ TAG_PLACEHOLDER,
26
+ TAG_REPLACEMENT,
27
+ TAG_X25519_PRIVATE_KEY,
28
+ TAG_X25519_PUBLIC_KEY,
29
+ TAG_ARID,
30
+ TAG_PRIVATE_KEYS,
31
+ TAG_NONCE,
32
+ TAG_PASSWORD,
33
+ TAG_PRIVATE_KEY_BASE,
34
+ TAG_PUBLIC_KEYS,
35
+ TAG_SALT,
36
+ TAG_SEALED_MESSAGE,
37
+ TAG_SIGNATURE,
38
+ TAG_SIGNING_PRIVATE_KEY,
39
+ TAG_SIGNING_PUBLIC_KEY,
40
+ TAG_SYMMETRIC_KEY,
41
+ TAG_XID,
42
+ TAG_REFERENCE,
43
+ TAG_EVENT,
44
+ TAG_ENCRYPTED_KEY,
45
+ TAG_MLKEM_PRIVATE_KEY,
46
+ TAG_MLKEM_PUBLIC_KEY,
47
+ TAG_MLKEM_CIPHERTEXT,
48
+ TAG_MLDSA_PRIVATE_KEY,
49
+ TAG_MLDSA_PUBLIC_KEY,
50
+ TAG_MLDSA_SIGNATURE,
51
+ TAG_SEED,
52
+ TAG_HDKEY,
53
+ TAG_DERIVATION_PATH,
54
+ TAG_USE_INFO,
55
+ TAG_EC_KEY,
56
+ TAG_ADDRESS,
57
+ TAG_OUTPUT_DESCRIPTOR,
58
+ TAG_SSKR_SHARE,
59
+ TAG_PSBT,
60
+ TAG_ACCOUNT_DESCRIPTOR,
61
+ TAG_SSH_TEXT_PRIVATE_KEY,
62
+ TAG_SSH_TEXT_PUBLIC_KEY,
63
+ TAG_SSH_TEXT_SIGNATURE,
64
+ TAG_SSH_TEXT_CERTIFICATE,
65
+ TAG_PROVENANCE_MARK,
66
+ TAG_OUTPUT_SCRIPT_HASH,
67
+ TAG_OUTPUT_WITNESS_SCRIPT_HASH,
68
+ TAG_OUTPUT_PUBLIC_KEY,
69
+ TAG_OUTPUT_PUBLIC_KEY_HASH,
70
+ TAG_OUTPUT_WITNESS_PUBLIC_KEY_HASH,
71
+ TAG_OUTPUT_COMBO,
72
+ TAG_OUTPUT_MULTISIG,
73
+ TAG_OUTPUT_SORTED_MULTISIG,
74
+ TAG_OUTPUT_RAW_SCRIPT,
75
+ TAG_OUTPUT_TAPROOT,
76
+ TAG_OUTPUT_COSIGNER,
77
+ LEGACY_TAGS,
78
+ type LegacyTags,
79
+ ALL_TAGS,
80
+ } from "./tags.js";
81
+ export { registerTags } from "./register.js";
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Registration into a dCBOR tags store.
3
+ *
4
+ * @module register
5
+ */
6
+ import { type TagsStore, getGlobalTagsStore, registerStandardTags } from "@blockchaincommons/dcbor";
7
+ import { ALL_TAGS } from "./tags.js";
8
+
9
+ /**
10
+ * Register dcbor's standard tags and every tag in {@link ALL_TAGS} into
11
+ * `store` (default: the global store).
12
+ *
13
+ * Idempotent: the store compares names, so a value already registered under
14
+ * the same name is a no-op, which is what makes repeated calls safe.
15
+ *
16
+ * @param store - The store to register into; defaults to dcbor's global store.
17
+ * @throws {Error} dcbor's store throws a bare `Error` when a value is
18
+ * already registered under a *different* name
19
+ * (`Attempt to register tag: 200 'foo' with different name: 'envelope'`).
20
+ */
21
+ export function registerTags(store: TagsStore = getGlobalTagsStore()): void {
22
+ registerStandardTags(store);
23
+ store.registerAll([...ALL_TAGS]);
24
+ }
package/src/tags.ts ADDED
@@ -0,0 +1,314 @@
1
+ /**
2
+ * The Blockchain Commons CBOR tag registry.
3
+ *
4
+ * Values are the CBOR tag numbers on the wire; names are wire too, since
5
+ * `uniform-resources` derives UR types from them (`ur:envelope`). Neither
6
+ * may change without a specification change. Every constant is frozen.
7
+ *
8
+ * Tags compare by value: `TAG_ENVELOPE === Tag.from(200, "envelope")` is
9
+ * `false` (two objects), `Tag.equals(a, b)` and `a.value === b.value` are
10
+ * the comparisons to write.
11
+ *
12
+ * @see https://github.com/BlockchainCommons/Research/blob/master/papers/bcr-2020-006-urtypes.md
13
+ * @module tags
14
+ */
15
+ import {
16
+ Tag,
17
+ TAG_ENCODED_CBOR as IANA_ENCODED_CBOR,
18
+ TAG_URI as IANA_URI,
19
+ TAG_UUID as IANA_UUID,
20
+ } from "@blockchaincommons/dcbor";
21
+
22
+ /**
23
+ * One immutable tag. dcbor's `Tag.from` returns a plain object whose
24
+ * `readonly` is a compile-time promise only; the names here are wire,
25
+ * so nothing may rewrite them process-wide.
26
+ */
27
+ const tag = (value: number, name: string): Tag => Object.freeze(Tag.from(value, name));
28
+
29
+ // IANA standard tags this stack uses. dcbor owns the numbers (it defines
30
+ // them unnamed); this registry owns the names.
31
+
32
+ /** #6.32: URI (RFC 8949 §3.4.5.3), named `url` in this stack. */
33
+ export const TAG_URI: Tag = tag(IANA_URI, "url");
34
+ /** #6.37: binary UUID (RFC 4122). */
35
+ export const TAG_UUID: Tag = tag(IANA_UUID, "uuid");
36
+
37
+ // Core Envelope tags. #6.24 was used as the leaf header by an earlier spec
38
+ // (incorrectly: RFC 8949 §3.4.5.1 requires a byte string); #6.201 replaced
39
+ // it and #6.24 is still recognised on decode. #6.200 and #6.201 are the only
40
+ // Blockchain Commons tags in IANA's "Specification Required" range.
41
+
42
+ /** #6.24: encoded CBOR data item; the pre-#6.201 Envelope leaf header, accepted on decode only. */
43
+ export const TAG_ENCODED_CBOR: Tag = tag(IANA_ENCODED_CBOR, "encoded-cbor");
44
+ /** #6.200: Gordian Envelope. */
45
+ export const TAG_ENVELOPE: Tag = tag(200, "envelope");
46
+ /** #6.201: dCBOR data item; the Envelope leaf case. */
47
+ export const TAG_LEAF: Tag = tag(201, "leaf");
48
+ /** #6.262: byte string holding UTF-8 JSON text. */
49
+ export const TAG_JSON: Tag = tag(262, "json");
50
+
51
+ // Envelope extensions.
52
+
53
+ /** #6.40000: known value, a registered unsigned integer with a fixed meaning. */
54
+ export const TAG_KNOWN_VALUE: Tag = tag(40000, "known-value");
55
+ /** #6.40001: SHA-256 digest. */
56
+ export const TAG_DIGEST: Tag = tag(40001, "digest");
57
+ /** #6.40002: encrypted message (IETF ChaCha20-Poly1305). */
58
+ export const TAG_ENCRYPTED: Tag = tag(40002, "encrypted");
59
+ /** #6.40003: DEFLATE-compressed data with the digest of the original. */
60
+ export const TAG_COMPRESSED: Tag = tag(40003, "compressed");
61
+
62
+ // Distributed function calls.
63
+
64
+ /** #6.40004: request. */
65
+ export const TAG_REQUEST: Tag = tag(40004, "request");
66
+ /** #6.40005: response. */
67
+ export const TAG_RESPONSE: Tag = tag(40005, "response");
68
+ /** #6.40006: function identifier. */
69
+ export const TAG_FUNCTION: Tag = tag(40006, "function");
70
+ /** #6.40007: parameter identifier. */
71
+ export const TAG_PARAMETER: Tag = tag(40007, "parameter");
72
+ /** #6.40008: placeholder. */
73
+ export const TAG_PLACEHOLDER: Tag = tag(40008, "placeholder");
74
+ /** #6.40009: replacement. */
75
+ export const TAG_REPLACEMENT: Tag = tag(40009, "replacement");
76
+
77
+ // Cryptographic components.
78
+
79
+ /** #6.40010: X25519 key-agreement private key. */
80
+ export const TAG_X25519_PRIVATE_KEY: Tag = tag(40010, "agreement-private-key");
81
+ /** #6.40011: X25519 key-agreement public key. */
82
+ export const TAG_X25519_PUBLIC_KEY: Tag = tag(40011, "agreement-public-key");
83
+ /** #6.40012: apparently random identifier (32 bytes). */
84
+ export const TAG_ARID: Tag = tag(40012, "arid");
85
+ /** #6.40013: a signing and an encapsulation private key together. */
86
+ export const TAG_PRIVATE_KEYS: Tag = tag(40013, "crypto-prvkeys");
87
+ /** #6.40014: nonce. */
88
+ export const TAG_NONCE: Tag = tag(40014, "nonce");
89
+ /** #6.40015: password. */
90
+ export const TAG_PASSWORD: Tag = tag(40015, "password");
91
+ /** #6.40016: private key base, the material every other key derives from. */
92
+ export const TAG_PRIVATE_KEY_BASE: Tag = tag(40016, "crypto-prvkey-base");
93
+ /** #6.40017: a signing and an encapsulation public key together. */
94
+ export const TAG_PUBLIC_KEYS: Tag = tag(40017, "crypto-pubkeys");
95
+ /** #6.40018: salt. */
96
+ export const TAG_SALT: Tag = tag(40018, "salt");
97
+ /** #6.40019: sealed message, encrypted to a recipient's public keys. */
98
+ export const TAG_SEALED_MESSAGE: Tag = tag(40019, "crypto-sealed");
99
+ /** #6.40020: signature. */
100
+ export const TAG_SIGNATURE: Tag = tag(40020, "signature");
101
+ /** #6.40021: signing private key. */
102
+ export const TAG_SIGNING_PRIVATE_KEY: Tag = tag(40021, "signing-private-key");
103
+ /** #6.40022: signing public key. */
104
+ export const TAG_SIGNING_PUBLIC_KEY: Tag = tag(40022, "signing-public-key");
105
+ /** #6.40023: symmetric encryption key. */
106
+ export const TAG_SYMMETRIC_KEY: Tag = tag(40023, "crypto-key");
107
+ /** #6.40024: extensible identifier (XID). */
108
+ export const TAG_XID: Tag = tag(40024, "xid");
109
+ /** #6.40025: reference to an identifier by a prefix of it. */
110
+ export const TAG_REFERENCE: Tag = tag(40025, "reference");
111
+ /** #6.40026: distributed function call event. */
112
+ export const TAG_EVENT: Tag = tag(40026, "event");
113
+ /** #6.40027: symmetric key wrapped for a recipient. */
114
+ export const TAG_ENCRYPTED_KEY: Tag = tag(40027, "encrypted-key");
115
+
116
+ // Post-quantum.
117
+
118
+ /** #6.40100: ML-KEM (FIPS 203) private key. */
119
+ export const TAG_MLKEM_PRIVATE_KEY: Tag = tag(40100, "mlkem-private-key");
120
+ /** #6.40101: ML-KEM (FIPS 203) public key. */
121
+ export const TAG_MLKEM_PUBLIC_KEY: Tag = tag(40101, "mlkem-public-key");
122
+ /** #6.40102: ML-KEM (FIPS 203) encapsulated ciphertext. */
123
+ export const TAG_MLKEM_CIPHERTEXT: Tag = tag(40102, "mlkem-ciphertext");
124
+ /** #6.40103: ML-DSA (FIPS 204) private key. */
125
+ export const TAG_MLDSA_PRIVATE_KEY: Tag = tag(40103, "mldsa-private-key");
126
+ /** #6.40104: ML-DSA (FIPS 204) public key. */
127
+ export const TAG_MLDSA_PUBLIC_KEY: Tag = tag(40104, "mldsa-public-key");
128
+ /** #6.40105: ML-DSA (FIPS 204) signature. */
129
+ export const TAG_MLDSA_SIGNATURE: Tag = tag(40105, "mldsa-signature");
130
+
131
+ // Seeds, keys and wallets.
132
+
133
+ /** #6.40300: cryptographic seed. */
134
+ export const TAG_SEED: Tag = tag(40300, "seed");
135
+ /** #6.40303: BIP-32 hierarchical deterministic key. */
136
+ export const TAG_HDKEY: Tag = tag(40303, "hdkey");
137
+ /** #6.40304: BIP-32 derivation path. */
138
+ export const TAG_DERIVATION_PATH: Tag = tag(40304, "keypath");
139
+ /** #6.40305: coin type and network (`coin-info`). */
140
+ export const TAG_USE_INFO: Tag = tag(40305, "coin-info");
141
+ /** #6.40306: elliptic-curve key. */
142
+ export const TAG_EC_KEY: Tag = tag(40306, "eckey");
143
+ /** #6.40307: address. */
144
+ export const TAG_ADDRESS: Tag = tag(40307, "address");
145
+ /** #6.40308: output descriptor. */
146
+ export const TAG_OUTPUT_DESCRIPTOR: Tag = tag(40308, "output-descriptor");
147
+ /** #6.40309: SSKR share. */
148
+ export const TAG_SSKR_SHARE: Tag = tag(40309, "sskr");
149
+ /** #6.40310: partially signed Bitcoin transaction. */
150
+ export const TAG_PSBT: Tag = tag(40310, "psbt");
151
+ /** #6.40311: account descriptor. */
152
+ export const TAG_ACCOUNT_DESCRIPTOR: Tag = tag(40311, "account-descriptor");
153
+
154
+ // SSH.
155
+
156
+ /** #6.40800: OpenSSH text-format private key. */
157
+ export const TAG_SSH_TEXT_PRIVATE_KEY: Tag = tag(40800, "ssh-private");
158
+ /** #6.40801: OpenSSH text-format public key. */
159
+ export const TAG_SSH_TEXT_PUBLIC_KEY: Tag = tag(40801, "ssh-public");
160
+ /** #6.40802: OpenSSH text-format signature. */
161
+ export const TAG_SSH_TEXT_SIGNATURE: Tag = tag(40802, "ssh-signature");
162
+ /** #6.40803: OpenSSH text-format certificate. */
163
+ export const TAG_SSH_TEXT_CERTIFICATE: Tag = tag(40803, "ssh-certificate");
164
+
165
+ /** #6.1347571542: provenance mark. */
166
+ export const TAG_PROVENANCE_MARK: Tag = tag(1347571542, "provenance");
167
+
168
+ // Output descriptor script types (subtypes of `crypto-output`).
169
+
170
+ /** #6.400: output descriptor `sh` (script hash). */
171
+ export const TAG_OUTPUT_SCRIPT_HASH: Tag = tag(400, "output-script-hash");
172
+ /** #6.401: output descriptor `wsh` (witness script hash). */
173
+ export const TAG_OUTPUT_WITNESS_SCRIPT_HASH: Tag = tag(401, "output-witness-script-hash");
174
+ /** #6.402: output descriptor `pk` (public key). */
175
+ export const TAG_OUTPUT_PUBLIC_KEY: Tag = tag(402, "output-public-key");
176
+ /** #6.403: output descriptor `pkh` (public key hash). */
177
+ export const TAG_OUTPUT_PUBLIC_KEY_HASH: Tag = tag(403, "output-public-key-hash");
178
+ /** #6.404: output descriptor `wpkh` (witness public key hash). */
179
+ export const TAG_OUTPUT_WITNESS_PUBLIC_KEY_HASH: Tag = tag(404, "output-witness-public-key-hash");
180
+ /** #6.405: output descriptor `combo`. */
181
+ export const TAG_OUTPUT_COMBO: Tag = tag(405, "output-combo");
182
+ /** #6.406: output descriptor `multi` (multisig). */
183
+ export const TAG_OUTPUT_MULTISIG: Tag = tag(406, "output-multisig");
184
+ /** #6.407: output descriptor `sortedmulti` (sorted multisig). */
185
+ export const TAG_OUTPUT_SORTED_MULTISIG: Tag = tag(407, "output-sorted-multisig");
186
+ /** #6.408: output descriptor `raw` (raw script). */
187
+ export const TAG_OUTPUT_RAW_SCRIPT: Tag = tag(408, "output-raw-script");
188
+ /** #6.409: output descriptor `tr` (taproot). */
189
+ export const TAG_OUTPUT_TAPROOT: Tag = tag(409, "output-taproot");
190
+ /** #6.410: output descriptor cosigner. */
191
+ export const TAG_OUTPUT_COSIGNER: Tag = tag(410, "output-cosigner");
192
+
193
+ /** The legacy tag set; see {@link LEGACY_TAGS}. */
194
+ export interface LegacyTags {
195
+ /** #6.300: `crypto-seed`, superseded by {@link TAG_SEED}. */
196
+ readonly SEED_V1: Tag;
197
+ /** #6.306: `crypto-eckey`, superseded by {@link TAG_EC_KEY}. */
198
+ readonly EC_KEY_V1: Tag;
199
+ /** #6.309: `crypto-sskr`, superseded by {@link TAG_SSKR_SHARE}. */
200
+ readonly SSKR_SHARE_V1: Tag;
201
+ /** #6.303: `crypto-hdkey`, superseded by {@link TAG_HDKEY}. */
202
+ readonly HDKEY_V1: Tag;
203
+ /** #6.304: `crypto-keypath`, superseded by {@link TAG_DERIVATION_PATH}. */
204
+ readonly DERIVATION_PATH_V1: Tag;
205
+ /** #6.305: `crypto-coin-info`, superseded by {@link TAG_USE_INFO}. */
206
+ readonly USE_INFO_V1: Tag;
207
+ /** #6.307: `crypto-output`, superseded by {@link TAG_OUTPUT_DESCRIPTOR}. */
208
+ readonly OUTPUT_DESCRIPTOR_V1: Tag;
209
+ /** #6.310: `crypto-psbt`, superseded by {@link TAG_PSBT}. */
210
+ readonly PSBT_V1: Tag;
211
+ /** #6.311: `crypto-account`, superseded by {@link TAG_ACCOUNT_DESCRIPTOR}. */
212
+ readonly ACCOUNT_V1: Tag;
213
+ }
214
+
215
+ /**
216
+ * Superseded tags, accepted on decode only. They sit in IANA's
217
+ * "Specification Required" range (300–311) and were replaced by the
218
+ * first-come-first-served 40300+ tags above; existing data still uses them.
219
+ * Never emit these for new data. Frozen, like every entry in it.
220
+ */
221
+ export const LEGACY_TAGS: LegacyTags = Object.freeze({
222
+ SEED_V1: tag(300, "crypto-seed"),
223
+ EC_KEY_V1: tag(306, "crypto-eckey"),
224
+ SSKR_SHARE_V1: tag(309, "crypto-sskr"),
225
+ HDKEY_V1: tag(303, "crypto-hdkey"),
226
+ DERIVATION_PATH_V1: tag(304, "crypto-keypath"),
227
+ USE_INFO_V1: tag(305, "crypto-coin-info"),
228
+ OUTPUT_DESCRIPTOR_V1: tag(307, "crypto-output"),
229
+ PSBT_V1: tag(310, "crypto-psbt"),
230
+ ACCOUNT_V1: tag(311, "crypto-account"),
231
+ });
232
+
233
+ /**
234
+ * Every tag this package defines, in registration order (the order the
235
+ * Rust reference registers them). Iterate this rather than the constants.
236
+ * Frozen, like every entry in it.
237
+ */
238
+ export const ALL_TAGS: readonly Tag[] = Object.freeze([
239
+ TAG_URI,
240
+ TAG_UUID,
241
+ TAG_ENCODED_CBOR,
242
+ TAG_ENVELOPE,
243
+ TAG_LEAF,
244
+ TAG_JSON,
245
+ TAG_KNOWN_VALUE,
246
+ TAG_DIGEST,
247
+ TAG_ENCRYPTED,
248
+ TAG_COMPRESSED,
249
+ TAG_REQUEST,
250
+ TAG_RESPONSE,
251
+ TAG_FUNCTION,
252
+ TAG_PARAMETER,
253
+ TAG_PLACEHOLDER,
254
+ TAG_REPLACEMENT,
255
+ TAG_EVENT,
256
+ LEGACY_TAGS.SEED_V1,
257
+ LEGACY_TAGS.EC_KEY_V1,
258
+ LEGACY_TAGS.SSKR_SHARE_V1,
259
+ TAG_SEED,
260
+ TAG_EC_KEY,
261
+ TAG_SSKR_SHARE,
262
+ TAG_X25519_PRIVATE_KEY,
263
+ TAG_X25519_PUBLIC_KEY,
264
+ TAG_ARID,
265
+ TAG_PRIVATE_KEYS,
266
+ TAG_NONCE,
267
+ TAG_PASSWORD,
268
+ TAG_PRIVATE_KEY_BASE,
269
+ TAG_PUBLIC_KEYS,
270
+ TAG_SALT,
271
+ TAG_SEALED_MESSAGE,
272
+ TAG_SIGNATURE,
273
+ TAG_SIGNING_PRIVATE_KEY,
274
+ TAG_SIGNING_PUBLIC_KEY,
275
+ TAG_SYMMETRIC_KEY,
276
+ TAG_XID,
277
+ TAG_REFERENCE,
278
+ TAG_ENCRYPTED_KEY,
279
+ TAG_MLKEM_PRIVATE_KEY,
280
+ TAG_MLKEM_PUBLIC_KEY,
281
+ TAG_MLKEM_CIPHERTEXT,
282
+ TAG_MLDSA_PRIVATE_KEY,
283
+ TAG_MLDSA_PUBLIC_KEY,
284
+ TAG_MLDSA_SIGNATURE,
285
+ LEGACY_TAGS.HDKEY_V1,
286
+ LEGACY_TAGS.DERIVATION_PATH_V1,
287
+ LEGACY_TAGS.USE_INFO_V1,
288
+ LEGACY_TAGS.OUTPUT_DESCRIPTOR_V1,
289
+ LEGACY_TAGS.PSBT_V1,
290
+ LEGACY_TAGS.ACCOUNT_V1,
291
+ TAG_HDKEY,
292
+ TAG_DERIVATION_PATH,
293
+ TAG_USE_INFO,
294
+ TAG_ADDRESS,
295
+ TAG_OUTPUT_DESCRIPTOR,
296
+ TAG_PSBT,
297
+ TAG_ACCOUNT_DESCRIPTOR,
298
+ TAG_SSH_TEXT_PRIVATE_KEY,
299
+ TAG_SSH_TEXT_PUBLIC_KEY,
300
+ TAG_SSH_TEXT_SIGNATURE,
301
+ TAG_SSH_TEXT_CERTIFICATE,
302
+ TAG_OUTPUT_SCRIPT_HASH,
303
+ TAG_OUTPUT_WITNESS_SCRIPT_HASH,
304
+ TAG_OUTPUT_PUBLIC_KEY,
305
+ TAG_OUTPUT_PUBLIC_KEY_HASH,
306
+ TAG_OUTPUT_WITNESS_PUBLIC_KEY_HASH,
307
+ TAG_OUTPUT_COMBO,
308
+ TAG_OUTPUT_MULTISIG,
309
+ TAG_OUTPUT_SORTED_MULTISIG,
310
+ TAG_OUTPUT_RAW_SCRIPT,
311
+ TAG_OUTPUT_TAPROOT,
312
+ TAG_OUTPUT_COSIGNER,
313
+ TAG_PROVENANCE_MARK,
314
+ ]);