@umbra-privacy/sdk 1.0.0
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.
- package/LICENSE +21 -0
- package/README.md +122 -0
- package/dist/addresses-Brzgurv_.d.ts +145 -0
- package/dist/addresses-D_0YAS6B.d.cts +145 -0
- package/dist/chunk-2Q75CQQJ.js +12 -0
- package/dist/chunk-2Q75CQQJ.js.map +1 -0
- package/dist/chunk-7QVYU63E.js +6 -0
- package/dist/chunk-7QVYU63E.js.map +1 -0
- package/dist/chunk-BM7N6N7E.js +1883 -0
- package/dist/chunk-BM7N6N7E.js.map +1 -0
- package/dist/chunk-GXKSUB2U.cjs +4416 -0
- package/dist/chunk-GXKSUB2U.cjs.map +1 -0
- package/dist/chunk-HOEXDXRC.cjs +792 -0
- package/dist/chunk-HOEXDXRC.cjs.map +1 -0
- package/dist/chunk-MDFSBU5W.cjs +2033 -0
- package/dist/chunk-MDFSBU5W.cjs.map +1 -0
- package/dist/chunk-MQY7HDIA.js +600 -0
- package/dist/chunk-MQY7HDIA.js.map +1 -0
- package/dist/chunk-MVKTV3FT.cjs +20 -0
- package/dist/chunk-MVKTV3FT.cjs.map +1 -0
- package/dist/chunk-PG2J6V6Y.js +4094 -0
- package/dist/chunk-PG2J6V6Y.js.map +1 -0
- package/dist/chunk-PK6SKIKE.cjs +8 -0
- package/dist/chunk-PK6SKIKE.cjs.map +1 -0
- package/dist/chunk-VEGLTTYQ.cjs +621 -0
- package/dist/chunk-VEGLTTYQ.cjs.map +1 -0
- package/dist/chunk-WVHQ46DD.js +758 -0
- package/dist/chunk-WVHQ46DD.js.map +1 -0
- package/dist/constants/index.cjs +316 -0
- package/dist/constants/index.cjs.map +1 -0
- package/dist/constants/index.d.cts +739 -0
- package/dist/constants/index.d.ts +739 -0
- package/dist/constants/index.js +193 -0
- package/dist/constants/index.js.map +1 -0
- package/dist/cryptography-BTGC72u-.d.cts +4809 -0
- package/dist/cryptography-BTGC72u-.d.ts +4809 -0
- package/dist/errors/index.cjs +141 -0
- package/dist/errors/index.cjs.map +1 -0
- package/dist/errors/index.d.cts +1415 -0
- package/dist/errors/index.d.ts +1415 -0
- package/dist/errors/index.js +4 -0
- package/dist/errors/index.js.map +1 -0
- package/dist/index-B9pDY73x.d.ts +12933 -0
- package/dist/index-CLj_zWSD.d.ts +235 -0
- package/dist/index-CX6_pIRS.d.cts +235 -0
- package/dist/index-D33yo0qB.d.cts +12933 -0
- package/dist/index.cjs +22464 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +11694 -0
- package/dist/index.d.ts +11694 -0
- package/dist/index.js +22314 -0
- package/dist/index.js.map +1 -0
- package/dist/interfaces/index.cjs +4 -0
- package/dist/interfaces/index.cjs.map +1 -0
- package/dist/interfaces/index.d.cts +8 -0
- package/dist/interfaces/index.d.ts +8 -0
- package/dist/interfaces/index.js +3 -0
- package/dist/interfaces/index.js.map +1 -0
- package/dist/networks-C-orpSFW.d.ts +65 -0
- package/dist/networks-FxYERGD1.d.cts +65 -0
- package/dist/types/index.cjs +605 -0
- package/dist/types/index.cjs.map +1 -0
- package/dist/types/index.d.cts +1853 -0
- package/dist/types/index.d.ts +1853 -0
- package/dist/types/index.js +4 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types-BBuELtY8.d.cts +495 -0
- package/dist/types-n-sHFcgr.d.ts +495 -0
- package/dist/utils/index.cjs +1295 -0
- package/dist/utils/index.cjs.map +1 -0
- package/dist/utils/index.d.cts +9559 -0
- package/dist/utils/index.d.ts +9559 -0
- package/dist/utils/index.js +6 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/versions-D9PqsEvj.d.cts +173 -0
- package/dist/versions-D9PqsEvj.d.ts +173 -0
- package/package.json +151 -0
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { ConversionError, POOL_SEED, asBase85Limb, asBn254FieldElement, asCurve25519FieldElement, asPoseidonKey, asRcCiphertext, asRcEncryptionNonce, asRcKey, asRcPlaintext, asU128, asU256, asU64, bigintToBinaryArrayLSB, calculateNetAmountAfterFee, calculateTransferFee, convertBn254FieldElementToCurve25519FieldElement, convertBn254FieldElementToPoseidonCiphertext, convertBn254FieldElementToPoseidonHash, convertBn254FieldElementToPoseidonKey, convertBn254FieldElementToPoseidonPlaintext, convertBn254FieldElementToU256, convertCurve25519FieldElementToBn254FieldElement, convertCurve25519FieldElementToRcCiphertext, convertCurve25519FieldElementToRcCounter, convertCurve25519FieldElementToRcKey, convertCurve25519FieldElementToRcPlaintext, convertCurve25519FieldElementToU256, convertI1024ToI128, convertI1024ToI16, convertI1024ToI256, convertI1024ToI32, convertI1024ToI512, convertI1024ToI64, convertI1024ToI8, convertI1024ToU1024, convertI128ToI1024, convertI128ToI16, convertI128ToI256, convertI128ToI32, convertI128ToI512, convertI128ToI64, convertI128ToI8, convertI128ToU128, convertI16ToI1024, convertI16ToI128, convertI16ToI256, convertI16ToI32, convertI16ToI512, convertI16ToI64, convertI16ToI8, convertI16ToU16, convertI256ToI1024, convertI256ToI128, convertI256ToI16, convertI256ToI32, convertI256ToI512, convertI256ToI64, convertI256ToI8, convertI256ToU256, convertI32ToI1024, convertI32ToI128, convertI32ToI16, convertI32ToI256, convertI32ToI512, convertI32ToI64, convertI32ToI8, convertI32ToU32, convertI512ToI1024, convertI512ToI128, convertI512ToI16, convertI512ToI256, convertI512ToI32, convertI512ToI64, convertI512ToI8, convertI512ToU512, convertI64ToI1024, convertI64ToI128, convertI64ToI16, convertI64ToI256, convertI64ToI32, convertI64ToI512, convertI64ToI8, convertI64ToU64, convertI8ToI1024, convertI8ToI128, convertI8ToI16, convertI8ToI256, convertI8ToI32, convertI8ToI512, convertI8ToI64, convertI8ToU8, convertPoseidonCiphertextToBn254FieldElement, convertPoseidonHashToBn254FieldElement, convertPoseidonKeyToBn254FieldElement, convertPoseidonPlaintextToBn254FieldElement, convertRcCiphertextToCurve25519FieldElement, convertRcCounterToCurve25519FieldElement, convertRcEncryptionNonceToU128, convertRcKeyToCurve25519FieldElement, convertRcPlaintextToCurve25519FieldElement, convertSharedSecretToX25519Bytes, convertU1024BeBytesToU1024LeBytes, convertU1024LeBytesToU1024BeBytes, convertU1024ToI1024, convertU1024ToU128, convertU1024ToU16, convertU1024ToU256, convertU1024ToU32, convertU1024ToU512, convertU1024ToU64, convertU1024ToU8, convertU128BeBytesToU128LeBytes, convertU128LeBytesToU128BeBytes, convertU128ToI128, convertU128ToRcEncryptionNonce, convertU128ToU1024, convertU128ToU16, convertU128ToU256, convertU128ToU32, convertU128ToU512, convertU128ToU64, convertU128ToU8, convertU16BeBytesToU16LeBytes, convertU16LeBytesToU16BeBytes, convertU16ToI16, convertU16ToU1024, convertU16ToU128, convertU16ToU256, convertU16ToU32, convertU16ToU512, convertU16ToU64, convertU16ToU8, convertU256BeBytesToU256LeBytes, convertU256LeBytesToU256BeBytes, convertU256ToBase85Limbs, convertU256ToBn254FieldElement, convertU256ToCurve25519FieldElement, convertU256ToI256, convertU256ToU1024, convertU256ToU128, convertU256ToU16, convertU256ToU32, convertU256ToU512, convertU256ToU64, convertU256ToU8, convertU32BeBytesToU32LeBytes, convertU32LeBytesToU32BeBytes, convertU32ToI32, convertU32ToU1024, convertU32ToU128, convertU32ToU16, convertU32ToU256, convertU32ToU512, convertU32ToU64, convertU32ToU8, convertU512BeBytesToU512LeBytes, convertU512LeBytesToU512BeBytes, convertU512ToI512, convertU512ToU1024, convertU512ToU128, convertU512ToU16, convertU512ToU256, convertU512ToU32, convertU512ToU64, convertU512ToU8, convertU64BeBytesToU64LeBytes, convertU64LeBytesToU64BeBytes, convertU64ToI64, convertU64ToU1024, convertU64ToU128, convertU64ToU16, convertU64ToU256, convertU64ToU32, convertU64ToU512, convertU64ToU8, convertU8BeBytesToU8LeBytes, convertU8LeBytesToU8BeBytes, convertU8ToI8, convertU8ToU1024, convertU8ToU128, convertU8ToU16, convertU8ToU256, convertU8ToU32, convertU8ToU512, convertU8ToU64, convertX25519BytesToSharedSecret, convertX25519BytesToX25519PrivateKey, convertX25519BytesToX25519PublicKey, convertX25519PrivateKeyToX25519Bytes, convertX25519PublicKeyToX25519Bytes, createBeBytes, createBn254FieldElement, createBytes, createCurve25519FieldElement, createI1024, createI128, createI16, createI256, createI32, createI512, createI64, createI8, createLeBytes, createPoseidonCiphertext, createPoseidonHash, createPoseidonKey, createPoseidonPlaintext, createRcCiphertext, createRcCounter, createRcEncryptionNonce, createRcKey, createRcPlaintext, createSharedSecret, createSignedInteger, createU1024, createU1024BeBytes, createU1024LeBytes, createU128, createU128BeBytes, createU128LeBytes, createU16, createU16BeBytes, createU16LeBytes, createU256, createU256BeBytes, createU256LeBytes, createU32, createU32BeBytes, createU32LeBytes, createU512, createU512BeBytes, createU512LeBytes, createU64, createU64BeBytes, createU64LeBytes, createU8, createU8BeBytes, createU8LeBytes, createUnsignedInteger, createX25519Bytes, createX25519PrivateKey, createX25519PublicKey, decodeU1024BeBytesToU1024, decodeU1024LeBytesToU1024, decodeU128BeBytesToU128, decodeU128LeBytesToU128, decodeU16BeBytesToU16, decodeU16LeBytesToU16, decodeU256BeBytesToU256, decodeU256LeBytesToU256, decodeU32BeBytesToU32, decodeU32LeBytesToU32, decodeU512BeBytesToU512, decodeU512LeBytesToU512, decodeU64BeBytesToU64, decodeU64LeBytesToU64, decodeU8BeBytesToU8, decodeU8LeBytesToU8, defaultExtractUtcComponents, defaultGetUtcNow, encodeU1024ToU1024BeBytes, encodeU1024ToU1024LeBytes, encodeU128ToU128BeBytes, encodeU128ToU128LeBytes, encodeU16ToU16BeBytes, encodeU16ToU16LeBytes, encodeU256ToU256BeBytes, encodeU256ToU256LeBytes, encodeU32ToU32BeBytes, encodeU32ToU32LeBytes, encodeU512ToU512BeBytes, encodeU512ToU512LeBytes, encodeU64ToU64BeBytes, encodeU64ToU64LeBytes, encodeU8ToU8BeBytes, encodeU8ToU8LeBytes, extractTransferFeeConfig, extractUtcComponents, generateRandomNonce, generateRandomU128, generateRandomU256, generateRandomU64, getActiveMixerTreeAddress, getArciumAccountAddresses, getArciumEncryptedTokenAccountPda, getArciumEncryptedUserAccountPda, getByteAt, getClusterAccountAddress, getCompDefAccountAddress, getCompDefOffset, getComputationAccountAddress, getConfUtxoBurnerPda, getConfidentialClaimProofAccountPda, getConfidentialUtxoProofAccountPda, getExecutingPoolAccountAddress, getExtractUtcComponentsFunction, getMempoolAccountAddress, getMixerTreeAddress, getMxeAccountAddress, getNetworkMxeComplianceGrantPda, getNetworkSharedComplianceGrantPda, getPoolPda, getProgramInformationPda, getProtocolFeesConfigurationPda, getProtocolOnlyUnifiedFeesPoolPda, getPubUtxoBurnerPda, getPublicClaimMxeMpcCallbackDataPda, getPublicClaimProofAccountPda, getRandomComputationOffset, getRelayerAccountPda, getRelayerUnifiedFeesPoolPda, getTreapPdas, getUserGrantedComplianceGrantPda, getUtcNow, getUtcNowFunction, getZkVerifyingKeyPda, splitAddressToLowHigh, splitU256IntoTwoU128s, splitX25519PublicKeyIntoTwoU128s, structSeed } from '../chunk-PG2J6V6Y.js';
|
|
2
|
+
import '../chunk-2Q75CQQJ.js';
|
|
3
|
+
import '../chunk-BM7N6N7E.js';
|
|
4
|
+
import '../chunk-7QVYU63E.js';
|
|
5
|
+
//# sourceMappingURL=index.js.map
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Versioning System for Umbra Privacy SDK
|
|
3
|
+
*
|
|
4
|
+
* This module defines the versioning system for key derivation and cryptographic operations.
|
|
5
|
+
* All version information is included in the key derivation context to ensure that keys
|
|
6
|
+
* derived with different versions produce different outputs.
|
|
7
|
+
*
|
|
8
|
+
* @module constants/versions
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Supported Solana network environments.
|
|
12
|
+
*
|
|
13
|
+
* @remarks
|
|
14
|
+
* - `mainnet`: Production Solana mainnet
|
|
15
|
+
* - `devnet`: Solana devnet for development
|
|
16
|
+
* - `localnet`: Local Solana test validator
|
|
17
|
+
*/
|
|
18
|
+
type Network = "mainnet" | "devnet" | "localnet";
|
|
19
|
+
/**
|
|
20
|
+
* Validates and asserts that a value is a valid Network.
|
|
21
|
+
*
|
|
22
|
+
* @param value - The value to validate
|
|
23
|
+
* @param name - Optional parameter name for error messages
|
|
24
|
+
* @throws {UmbraError} If the value is not a valid network
|
|
25
|
+
*/
|
|
26
|
+
declare function assertNetwork(value: string, name?: string): asserts value is Network;
|
|
27
|
+
/**
|
|
28
|
+
* Protocol version information.
|
|
29
|
+
*
|
|
30
|
+
* @remarks
|
|
31
|
+
* The protocol version tracks changes to the overall Umbra protocol.
|
|
32
|
+
* Changes to protocol semantics or behavior should increment this version.
|
|
33
|
+
*/
|
|
34
|
+
interface ProtocolVersion {
|
|
35
|
+
/**
|
|
36
|
+
* Protocol name (always "umbra")
|
|
37
|
+
*/
|
|
38
|
+
readonly name: string;
|
|
39
|
+
/**
|
|
40
|
+
* Protocol version in semver format (e.g., "1.0.0")
|
|
41
|
+
*/
|
|
42
|
+
readonly version: string;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Algorithm version information.
|
|
46
|
+
*
|
|
47
|
+
* @remarks
|
|
48
|
+
* The algorithm version tracks changes to the underlying cryptographic algorithm.
|
|
49
|
+
* For example, switching from KMAC256 to a different hash function would increment this.
|
|
50
|
+
*/
|
|
51
|
+
interface AlgorithmVersion {
|
|
52
|
+
/**
|
|
53
|
+
* Algorithm name (e.g., "kmac256")
|
|
54
|
+
*/
|
|
55
|
+
readonly name: string;
|
|
56
|
+
/**
|
|
57
|
+
* Algorithm version in semver format (e.g., "1.0.0")
|
|
58
|
+
*/
|
|
59
|
+
readonly version: string;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Key derivation scheme version information.
|
|
63
|
+
*
|
|
64
|
+
* @remarks
|
|
65
|
+
* The scheme version tracks changes to the key derivation logic.
|
|
66
|
+
* Changes to how keys are derived from the master seed should increment this version.
|
|
67
|
+
*/
|
|
68
|
+
interface SchemeVersion {
|
|
69
|
+
/**
|
|
70
|
+
* Scheme name (e.g., "kdf")
|
|
71
|
+
*/
|
|
72
|
+
readonly name: string;
|
|
73
|
+
/**
|
|
74
|
+
* Scheme version in semver format (e.g., "1.0.0")
|
|
75
|
+
*/
|
|
76
|
+
readonly version: string;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Function that provides protocol version information.
|
|
80
|
+
*
|
|
81
|
+
* @returns Protocol version with name and semver version
|
|
82
|
+
*/
|
|
83
|
+
type ProtocolVersionSpecifierFunction = () => ProtocolVersion;
|
|
84
|
+
/**
|
|
85
|
+
* Function that provides algorithm version information.
|
|
86
|
+
*
|
|
87
|
+
* @returns Algorithm version with name and semver version
|
|
88
|
+
*/
|
|
89
|
+
type AlgorithmVersionSpecifierFunction = () => AlgorithmVersion;
|
|
90
|
+
/**
|
|
91
|
+
* Function that provides key derivation scheme version information.
|
|
92
|
+
*
|
|
93
|
+
* @returns Scheme version with name and semver version
|
|
94
|
+
*/
|
|
95
|
+
type SchemeVersionSpecifierFunction = () => SchemeVersion;
|
|
96
|
+
/**
|
|
97
|
+
* Function that provides the current network.
|
|
98
|
+
*
|
|
99
|
+
* @returns Network identifier (mainnet, devnet, or localnet)
|
|
100
|
+
*/
|
|
101
|
+
type NetworkSpecifierFunction = () => Network;
|
|
102
|
+
/**
|
|
103
|
+
* Default protocol version (Umbra v1.0.0).
|
|
104
|
+
*/
|
|
105
|
+
declare const DEFAULT_PROTOCOL_VERSION: ProtocolVersion;
|
|
106
|
+
/**
|
|
107
|
+
* Default algorithm version (KMAC256 v1.0.0).
|
|
108
|
+
*/
|
|
109
|
+
declare const DEFAULT_ALGORITHM_VERSION: AlgorithmVersion;
|
|
110
|
+
/**
|
|
111
|
+
* Default key derivation scheme version (KDF v1.0.0).
|
|
112
|
+
*/
|
|
113
|
+
declare const DEFAULT_SCHEME_VERSION: SchemeVersion;
|
|
114
|
+
/**
|
|
115
|
+
* Default network (mainnet).
|
|
116
|
+
*/
|
|
117
|
+
declare const DEFAULT_NETWORK: Network;
|
|
118
|
+
/**
|
|
119
|
+
* Validates that a version string matches semver format.
|
|
120
|
+
*
|
|
121
|
+
* @param version - The version string to validate
|
|
122
|
+
* @param name - Optional parameter name for error messages
|
|
123
|
+
* @throws {UmbraError} If the version string is invalid
|
|
124
|
+
*/
|
|
125
|
+
declare function assertValidVersion(version: string, name?: string): void;
|
|
126
|
+
/**
|
|
127
|
+
* Validates protocol version structure and format.
|
|
128
|
+
*
|
|
129
|
+
* @param version - The protocol version to validate
|
|
130
|
+
* @throws {UmbraError} If the version structure or format is invalid
|
|
131
|
+
*/
|
|
132
|
+
declare function assertValidProtocolVersion(version: ProtocolVersion): void;
|
|
133
|
+
/**
|
|
134
|
+
* Validates algorithm version structure and format.
|
|
135
|
+
*
|
|
136
|
+
* @param version - The algorithm version to validate
|
|
137
|
+
* @throws {UmbraError} If the version structure or format is invalid
|
|
138
|
+
*/
|
|
139
|
+
declare function assertValidAlgorithmVersion(version: AlgorithmVersion): void;
|
|
140
|
+
/**
|
|
141
|
+
* Validates scheme version structure and format.
|
|
142
|
+
*
|
|
143
|
+
* @param version - The scheme version to validate
|
|
144
|
+
* @throws {UmbraError} If the version structure or format is invalid
|
|
145
|
+
*/
|
|
146
|
+
declare function assertValidSchemeVersion(version: SchemeVersion): void;
|
|
147
|
+
/**
|
|
148
|
+
* Default protocol version specifier function.
|
|
149
|
+
*
|
|
150
|
+
* @returns Default protocol version (umbra-1.0.0)
|
|
151
|
+
*/
|
|
152
|
+
declare const getDefaultProtocolVersion: ProtocolVersionSpecifierFunction;
|
|
153
|
+
/**
|
|
154
|
+
* Default algorithm version specifier function.
|
|
155
|
+
*
|
|
156
|
+
* @returns Default algorithm version (kmac256-1.0.0)
|
|
157
|
+
*/
|
|
158
|
+
declare const getDefaultAlgorithmVersion: AlgorithmVersionSpecifierFunction;
|
|
159
|
+
/**
|
|
160
|
+
* Default scheme version specifier function.
|
|
161
|
+
*
|
|
162
|
+
* @returns Default scheme version (kdf-1.0.0)
|
|
163
|
+
*/
|
|
164
|
+
declare const getDefaultSchemeVersion: SchemeVersionSpecifierFunction;
|
|
165
|
+
/**
|
|
166
|
+
* Creates a network specifier function for a given network.
|
|
167
|
+
*
|
|
168
|
+
* @param network - The network to use
|
|
169
|
+
* @returns Function that returns the specified network
|
|
170
|
+
*/
|
|
171
|
+
declare function getNetworkSpecifier(network: Network): NetworkSpecifierFunction;
|
|
172
|
+
|
|
173
|
+
export { type AlgorithmVersion as A, DEFAULT_ALGORITHM_VERSION as D, type Network as N, type ProtocolVersion as P, type SchemeVersion as S, type AlgorithmVersionSpecifierFunction as a, DEFAULT_NETWORK as b, DEFAULT_PROTOCOL_VERSION as c, DEFAULT_SCHEME_VERSION as d, type NetworkSpecifierFunction as e, type ProtocolVersionSpecifierFunction as f, type SchemeVersionSpecifierFunction as g, assertNetwork as h, assertValidAlgorithmVersion as i, assertValidProtocolVersion as j, assertValidSchemeVersion as k, assertValidVersion as l, getDefaultAlgorithmVersion as m, getDefaultProtocolVersion as n, getDefaultSchemeVersion as o, getNetworkSpecifier as p };
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Versioning System for Umbra Privacy SDK
|
|
3
|
+
*
|
|
4
|
+
* This module defines the versioning system for key derivation and cryptographic operations.
|
|
5
|
+
* All version information is included in the key derivation context to ensure that keys
|
|
6
|
+
* derived with different versions produce different outputs.
|
|
7
|
+
*
|
|
8
|
+
* @module constants/versions
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Supported Solana network environments.
|
|
12
|
+
*
|
|
13
|
+
* @remarks
|
|
14
|
+
* - `mainnet`: Production Solana mainnet
|
|
15
|
+
* - `devnet`: Solana devnet for development
|
|
16
|
+
* - `localnet`: Local Solana test validator
|
|
17
|
+
*/
|
|
18
|
+
type Network = "mainnet" | "devnet" | "localnet";
|
|
19
|
+
/**
|
|
20
|
+
* Validates and asserts that a value is a valid Network.
|
|
21
|
+
*
|
|
22
|
+
* @param value - The value to validate
|
|
23
|
+
* @param name - Optional parameter name for error messages
|
|
24
|
+
* @throws {UmbraError} If the value is not a valid network
|
|
25
|
+
*/
|
|
26
|
+
declare function assertNetwork(value: string, name?: string): asserts value is Network;
|
|
27
|
+
/**
|
|
28
|
+
* Protocol version information.
|
|
29
|
+
*
|
|
30
|
+
* @remarks
|
|
31
|
+
* The protocol version tracks changes to the overall Umbra protocol.
|
|
32
|
+
* Changes to protocol semantics or behavior should increment this version.
|
|
33
|
+
*/
|
|
34
|
+
interface ProtocolVersion {
|
|
35
|
+
/**
|
|
36
|
+
* Protocol name (always "umbra")
|
|
37
|
+
*/
|
|
38
|
+
readonly name: string;
|
|
39
|
+
/**
|
|
40
|
+
* Protocol version in semver format (e.g., "1.0.0")
|
|
41
|
+
*/
|
|
42
|
+
readonly version: string;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Algorithm version information.
|
|
46
|
+
*
|
|
47
|
+
* @remarks
|
|
48
|
+
* The algorithm version tracks changes to the underlying cryptographic algorithm.
|
|
49
|
+
* For example, switching from KMAC256 to a different hash function would increment this.
|
|
50
|
+
*/
|
|
51
|
+
interface AlgorithmVersion {
|
|
52
|
+
/**
|
|
53
|
+
* Algorithm name (e.g., "kmac256")
|
|
54
|
+
*/
|
|
55
|
+
readonly name: string;
|
|
56
|
+
/**
|
|
57
|
+
* Algorithm version in semver format (e.g., "1.0.0")
|
|
58
|
+
*/
|
|
59
|
+
readonly version: string;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Key derivation scheme version information.
|
|
63
|
+
*
|
|
64
|
+
* @remarks
|
|
65
|
+
* The scheme version tracks changes to the key derivation logic.
|
|
66
|
+
* Changes to how keys are derived from the master seed should increment this version.
|
|
67
|
+
*/
|
|
68
|
+
interface SchemeVersion {
|
|
69
|
+
/**
|
|
70
|
+
* Scheme name (e.g., "kdf")
|
|
71
|
+
*/
|
|
72
|
+
readonly name: string;
|
|
73
|
+
/**
|
|
74
|
+
* Scheme version in semver format (e.g., "1.0.0")
|
|
75
|
+
*/
|
|
76
|
+
readonly version: string;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Function that provides protocol version information.
|
|
80
|
+
*
|
|
81
|
+
* @returns Protocol version with name and semver version
|
|
82
|
+
*/
|
|
83
|
+
type ProtocolVersionSpecifierFunction = () => ProtocolVersion;
|
|
84
|
+
/**
|
|
85
|
+
* Function that provides algorithm version information.
|
|
86
|
+
*
|
|
87
|
+
* @returns Algorithm version with name and semver version
|
|
88
|
+
*/
|
|
89
|
+
type AlgorithmVersionSpecifierFunction = () => AlgorithmVersion;
|
|
90
|
+
/**
|
|
91
|
+
* Function that provides key derivation scheme version information.
|
|
92
|
+
*
|
|
93
|
+
* @returns Scheme version with name and semver version
|
|
94
|
+
*/
|
|
95
|
+
type SchemeVersionSpecifierFunction = () => SchemeVersion;
|
|
96
|
+
/**
|
|
97
|
+
* Function that provides the current network.
|
|
98
|
+
*
|
|
99
|
+
* @returns Network identifier (mainnet, devnet, or localnet)
|
|
100
|
+
*/
|
|
101
|
+
type NetworkSpecifierFunction = () => Network;
|
|
102
|
+
/**
|
|
103
|
+
* Default protocol version (Umbra v1.0.0).
|
|
104
|
+
*/
|
|
105
|
+
declare const DEFAULT_PROTOCOL_VERSION: ProtocolVersion;
|
|
106
|
+
/**
|
|
107
|
+
* Default algorithm version (KMAC256 v1.0.0).
|
|
108
|
+
*/
|
|
109
|
+
declare const DEFAULT_ALGORITHM_VERSION: AlgorithmVersion;
|
|
110
|
+
/**
|
|
111
|
+
* Default key derivation scheme version (KDF v1.0.0).
|
|
112
|
+
*/
|
|
113
|
+
declare const DEFAULT_SCHEME_VERSION: SchemeVersion;
|
|
114
|
+
/**
|
|
115
|
+
* Default network (mainnet).
|
|
116
|
+
*/
|
|
117
|
+
declare const DEFAULT_NETWORK: Network;
|
|
118
|
+
/**
|
|
119
|
+
* Validates that a version string matches semver format.
|
|
120
|
+
*
|
|
121
|
+
* @param version - The version string to validate
|
|
122
|
+
* @param name - Optional parameter name for error messages
|
|
123
|
+
* @throws {UmbraError} If the version string is invalid
|
|
124
|
+
*/
|
|
125
|
+
declare function assertValidVersion(version: string, name?: string): void;
|
|
126
|
+
/**
|
|
127
|
+
* Validates protocol version structure and format.
|
|
128
|
+
*
|
|
129
|
+
* @param version - The protocol version to validate
|
|
130
|
+
* @throws {UmbraError} If the version structure or format is invalid
|
|
131
|
+
*/
|
|
132
|
+
declare function assertValidProtocolVersion(version: ProtocolVersion): void;
|
|
133
|
+
/**
|
|
134
|
+
* Validates algorithm version structure and format.
|
|
135
|
+
*
|
|
136
|
+
* @param version - The algorithm version to validate
|
|
137
|
+
* @throws {UmbraError} If the version structure or format is invalid
|
|
138
|
+
*/
|
|
139
|
+
declare function assertValidAlgorithmVersion(version: AlgorithmVersion): void;
|
|
140
|
+
/**
|
|
141
|
+
* Validates scheme version structure and format.
|
|
142
|
+
*
|
|
143
|
+
* @param version - The scheme version to validate
|
|
144
|
+
* @throws {UmbraError} If the version structure or format is invalid
|
|
145
|
+
*/
|
|
146
|
+
declare function assertValidSchemeVersion(version: SchemeVersion): void;
|
|
147
|
+
/**
|
|
148
|
+
* Default protocol version specifier function.
|
|
149
|
+
*
|
|
150
|
+
* @returns Default protocol version (umbra-1.0.0)
|
|
151
|
+
*/
|
|
152
|
+
declare const getDefaultProtocolVersion: ProtocolVersionSpecifierFunction;
|
|
153
|
+
/**
|
|
154
|
+
* Default algorithm version specifier function.
|
|
155
|
+
*
|
|
156
|
+
* @returns Default algorithm version (kmac256-1.0.0)
|
|
157
|
+
*/
|
|
158
|
+
declare const getDefaultAlgorithmVersion: AlgorithmVersionSpecifierFunction;
|
|
159
|
+
/**
|
|
160
|
+
* Default scheme version specifier function.
|
|
161
|
+
*
|
|
162
|
+
* @returns Default scheme version (kdf-1.0.0)
|
|
163
|
+
*/
|
|
164
|
+
declare const getDefaultSchemeVersion: SchemeVersionSpecifierFunction;
|
|
165
|
+
/**
|
|
166
|
+
* Creates a network specifier function for a given network.
|
|
167
|
+
*
|
|
168
|
+
* @param network - The network to use
|
|
169
|
+
* @returns Function that returns the specified network
|
|
170
|
+
*/
|
|
171
|
+
declare function getNetworkSpecifier(network: Network): NetworkSpecifierFunction;
|
|
172
|
+
|
|
173
|
+
export { type AlgorithmVersion as A, DEFAULT_ALGORITHM_VERSION as D, type Network as N, type ProtocolVersion as P, type SchemeVersion as S, type AlgorithmVersionSpecifierFunction as a, DEFAULT_NETWORK as b, DEFAULT_PROTOCOL_VERSION as c, DEFAULT_SCHEME_VERSION as d, type NetworkSpecifierFunction as e, type ProtocolVersionSpecifierFunction as f, type SchemeVersionSpecifierFunction as g, assertNetwork as h, assertValidAlgorithmVersion as i, assertValidProtocolVersion as j, assertValidSchemeVersion as k, assertValidVersion as l, getDefaultAlgorithmVersion as m, getDefaultProtocolVersion as n, getDefaultSchemeVersion as o, getNetworkSpecifier as p };
|
package/package.json
ADDED
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@umbra-privacy/sdk",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "A comprehensive TypeScript SDK for Umbra Privacy",
|
|
5
|
+
"author": "",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"main": "./dist/index.cjs",
|
|
9
|
+
"module": "./dist/index.js",
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"typesVersions": {
|
|
12
|
+
"*": {
|
|
13
|
+
"types": [
|
|
14
|
+
"./dist/types/index.d.ts"
|
|
15
|
+
],
|
|
16
|
+
"interfaces": [
|
|
17
|
+
"./dist/interfaces/index.d.ts"
|
|
18
|
+
],
|
|
19
|
+
"utils": [
|
|
20
|
+
"./dist/utils/index.d.ts"
|
|
21
|
+
],
|
|
22
|
+
"constants": [
|
|
23
|
+
"./dist/constants/index.d.ts"
|
|
24
|
+
],
|
|
25
|
+
"errors": [
|
|
26
|
+
"./dist/errors/index.d.ts"
|
|
27
|
+
]
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"exports": {
|
|
31
|
+
".": {
|
|
32
|
+
"import": {
|
|
33
|
+
"types": "./dist/index.d.ts",
|
|
34
|
+
"default": "./dist/index.js"
|
|
35
|
+
},
|
|
36
|
+
"require": {
|
|
37
|
+
"types": "./dist/index.d.cts",
|
|
38
|
+
"default": "./dist/index.cjs"
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
"./types": {
|
|
42
|
+
"import": {
|
|
43
|
+
"types": "./dist/types/index.d.ts",
|
|
44
|
+
"default": "./dist/types/index.js"
|
|
45
|
+
},
|
|
46
|
+
"require": {
|
|
47
|
+
"types": "./dist/types/index.d.cts",
|
|
48
|
+
"default": "./dist/types/index.cjs"
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
"./interfaces": {
|
|
52
|
+
"import": {
|
|
53
|
+
"types": "./dist/interfaces/index.d.ts",
|
|
54
|
+
"default": "./dist/interfaces/index.js"
|
|
55
|
+
},
|
|
56
|
+
"require": {
|
|
57
|
+
"types": "./dist/interfaces/index.d.cts",
|
|
58
|
+
"default": "./dist/interfaces/index.cjs"
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
"./utils": {
|
|
62
|
+
"import": {
|
|
63
|
+
"types": "./dist/utils/index.d.ts",
|
|
64
|
+
"default": "./dist/utils/index.js"
|
|
65
|
+
},
|
|
66
|
+
"require": {
|
|
67
|
+
"types": "./dist/utils/index.d.cts",
|
|
68
|
+
"default": "./dist/utils/index.cjs"
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
"./constants": {
|
|
72
|
+
"import": {
|
|
73
|
+
"types": "./dist/constants/index.d.ts",
|
|
74
|
+
"default": "./dist/constants/index.js"
|
|
75
|
+
},
|
|
76
|
+
"require": {
|
|
77
|
+
"types": "./dist/constants/index.d.cts",
|
|
78
|
+
"default": "./dist/constants/index.cjs"
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
"./errors": {
|
|
82
|
+
"import": {
|
|
83
|
+
"types": "./dist/errors/index.d.ts",
|
|
84
|
+
"default": "./dist/errors/index.js"
|
|
85
|
+
},
|
|
86
|
+
"require": {
|
|
87
|
+
"types": "./dist/errors/index.d.cts",
|
|
88
|
+
"default": "./dist/errors/index.cjs"
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
"./package.json": "./package.json"
|
|
92
|
+
},
|
|
93
|
+
"files": [
|
|
94
|
+
"dist",
|
|
95
|
+
"README.md",
|
|
96
|
+
"LICENSE"
|
|
97
|
+
],
|
|
98
|
+
"sideEffects": false,
|
|
99
|
+
"dependencies": {
|
|
100
|
+
"@noble/ciphers": "^2.1.1",
|
|
101
|
+
"@noble/curves": "^2.0.1",
|
|
102
|
+
"@noble/hashes": "^2.0.1",
|
|
103
|
+
"@solana/kit": "^6.0.1",
|
|
104
|
+
"@solana/wallet-standard-features": "^1.3.0",
|
|
105
|
+
"@wallet-standard/core": "^1.1.0",
|
|
106
|
+
"@umbra-privacy/codama": "1.0.0",
|
|
107
|
+
"@umbra-privacy/indexer-read-service-client": "1.0.0"
|
|
108
|
+
},
|
|
109
|
+
"devDependencies": {
|
|
110
|
+
"@arcium-hq/client": "0.8.3",
|
|
111
|
+
"@types/node": "^22.10.5",
|
|
112
|
+
"@typescript-eslint/eslint-plugin": "^8.20.0",
|
|
113
|
+
"@typescript-eslint/parser": "^8.20.0",
|
|
114
|
+
"@vitest/coverage-v8": "^2.1.8",
|
|
115
|
+
"eslint": "^9.28.0",
|
|
116
|
+
"eslint-config-prettier": "^9.1.0",
|
|
117
|
+
"eslint-plugin-import": "^2.31.0",
|
|
118
|
+
"eslint-plugin-unicorn": "^56.0.1",
|
|
119
|
+
"tsup": "^8.3.5",
|
|
120
|
+
"typescript": "^5.9.3",
|
|
121
|
+
"typescript-eslint": "^8.55.0",
|
|
122
|
+
"vitest": "^2.1.8"
|
|
123
|
+
},
|
|
124
|
+
"engines": {
|
|
125
|
+
"node": ">=18.0.0"
|
|
126
|
+
},
|
|
127
|
+
"publishConfig": {
|
|
128
|
+
"access": "public",
|
|
129
|
+
"registry": "https://registry.npmjs.org/"
|
|
130
|
+
},
|
|
131
|
+
"keywords": [
|
|
132
|
+
"umbra",
|
|
133
|
+
"privacy",
|
|
134
|
+
"sdk",
|
|
135
|
+
"typescript",
|
|
136
|
+
"solana",
|
|
137
|
+
"cryptography"
|
|
138
|
+
],
|
|
139
|
+
"scripts": {
|
|
140
|
+
"build": "tsup",
|
|
141
|
+
"build:watch": "tsup --watch",
|
|
142
|
+
"dev": "tsup --watch",
|
|
143
|
+
"clean": "rm -rf dist node_modules/.cache",
|
|
144
|
+
"typecheck": "tsc --noEmit",
|
|
145
|
+
"lint": "eslint . --max-warnings 0",
|
|
146
|
+
"lint:fix": "eslint . --fix",
|
|
147
|
+
"test": "vitest run",
|
|
148
|
+
"test:watch": "vitest",
|
|
149
|
+
"test:coverage": "vitest run --coverage"
|
|
150
|
+
}
|
|
151
|
+
}
|