@babylonlabs-io/ts-sdk 0.34.0 → 0.36.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/dist/{PayoutManager-DDnNB0mj.cjs → PayoutManager-BhJoQZsG.cjs} +2 -2
- package/dist/PayoutManager-BhJoQZsG.cjs.map +1 -0
- package/dist/{PayoutManager-C9XHKZ5j.js → PayoutManager-s_uH8Uuj.js} +2 -2
- package/dist/PayoutManager-s_uH8Uuj.js.map +1 -0
- package/dist/PeginManager-DF1oinIQ.js +1172 -0
- package/dist/PeginManager-DF1oinIQ.js.map +1 -0
- package/dist/PeginManager-cPQuJTB9.cjs +2 -0
- package/dist/PeginManager-cPQuJTB9.cjs.map +1 -0
- package/dist/{buildAndBroadcastRefund-C7hnNWbj.cjs → buildAndBroadcastRefund-BQ0CaL6Q.cjs} +2 -2
- package/dist/{buildAndBroadcastRefund-C7hnNWbj.cjs.map → buildAndBroadcastRefund-BQ0CaL6Q.cjs.map} +1 -1
- package/dist/{buildAndBroadcastRefund-B6fGRmvo.js → buildAndBroadcastRefund-DzX11N9S.js} +2 -2
- package/dist/{buildAndBroadcastRefund-B6fGRmvo.js.map → buildAndBroadcastRefund-DzX11N9S.js.map} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +124 -123
- package/dist/sha2-BYVxyZzX.js +274 -0
- package/dist/{sha2-6wN58S6R.js.map → sha2-BYVxyZzX.js.map} +1 -1
- package/dist/sha2-DsrLC4NM.cjs +2 -0
- package/dist/{sha2-CsTynrfJ.cjs.map → sha2-DsrLC4NM.cjs.map} +1 -1
- package/dist/tbv/core/clients/index.cjs +1 -1
- package/dist/tbv/core/clients/index.js +1 -1
- package/dist/tbv/core/clients/vault-provider/auth/gatedMethods.d.ts.map +1 -1
- package/dist/tbv/core/index.cjs +1 -1
- package/dist/tbv/core/index.js +134 -133
- package/dist/tbv/core/managers/PeginManager.d.ts.map +1 -1
- package/dist/tbv/core/managers/index.cjs +1 -1
- package/dist/tbv/core/managers/index.js +2 -2
- package/dist/tbv/core/services/index.cjs +1 -1
- package/dist/tbv/core/services/index.js +2 -2
- package/dist/tbv/core/utils/eth/__tests__/waitForTransactionReceiptSmartAware.test.d.ts +2 -0
- package/dist/tbv/core/utils/eth/__tests__/waitForTransactionReceiptSmartAware.test.d.ts.map +1 -0
- package/dist/tbv/core/utils/eth/index.d.ts +2 -0
- package/dist/tbv/core/utils/eth/index.d.ts.map +1 -0
- package/dist/tbv/core/utils/eth/waitForTransactionReceiptSmartAware.d.ts +18 -0
- package/dist/tbv/core/utils/eth/waitForTransactionReceiptSmartAware.d.ts.map +1 -0
- package/dist/tbv/core/utils/index.cjs +1 -1
- package/dist/tbv/core/utils/index.d.ts +1 -0
- package/dist/tbv/core/utils/index.d.ts.map +1 -1
- package/dist/tbv/core/utils/index.js +14 -13
- package/dist/tbv/core/vault-secrets/__tests__/deriveVaultRoot.test.d.ts +1 -1
- package/dist/tbv/core/vault-secrets/__tests__/expand.test.d.ts +4 -6
- package/dist/tbv/core/vault-secrets/__tests__/expand.test.d.ts.map +1 -1
- package/dist/tbv/core/vault-secrets/deriveVaultRoot.d.ts +1 -1
- package/dist/tbv/core/vault-secrets/deriveVaultRoot.d.ts.map +1 -1
- package/dist/tbv/core/vault-secrets/index.d.ts +1 -1
- package/dist/tbv/core/vault-secrets/index.d.ts.map +1 -1
- package/dist/tbv/index.cjs +1 -1
- package/dist/tbv/index.js +134 -133
- package/dist/testing/index.cjs +1 -1
- package/dist/testing/index.js +1 -1
- package/dist/{vault-registry-reader-CqhD3Iyd.js → vault-registry-reader-Bz8uu0dh.js} +13 -12
- package/dist/vault-registry-reader-Bz8uu0dh.js.map +1 -0
- package/dist/{vault-registry-reader-Brkh1j7p.cjs → vault-registry-reader-Cufa-ZkW.cjs} +2 -2
- package/dist/vault-registry-reader-Cufa-ZkW.cjs.map +1 -0
- package/dist/waitForTransactionReceiptSmartAware-Cj_DKm0G.js +217 -0
- package/dist/waitForTransactionReceiptSmartAware-Cj_DKm0G.js.map +1 -0
- package/dist/waitForTransactionReceiptSmartAware-D9ykVriz.cjs +2 -0
- package/dist/waitForTransactionReceiptSmartAware-D9ykVriz.cjs.map +1 -0
- package/package.json +1 -2
- package/dist/PayoutManager-C9XHKZ5j.js.map +0 -1
- package/dist/PayoutManager-DDnNB0mj.cjs.map +0 -1
- package/dist/PeginManager-C8-I4gFH.js +0 -1280
- package/dist/PeginManager-C8-I4gFH.js.map +0 -1
- package/dist/PeginManager-D0TW9RET.cjs +0 -2
- package/dist/PeginManager-D0TW9RET.cjs.map +0 -1
- package/dist/psbtInputFields-2224j2ZY.js +0 -128
- package/dist/psbtInputFields-2224j2ZY.js.map +0 -1
- package/dist/psbtInputFields-B1lrwYzH.cjs +0 -2
- package/dist/psbtInputFields-B1lrwYzH.cjs.map +0 -1
- package/dist/sha2-6wN58S6R.js +0 -280
- package/dist/sha2-CsTynrfJ.cjs +0 -2
- package/dist/tbv/core/vault-secrets/__tests__/info.test.d.ts +0 -8
- package/dist/tbv/core/vault-secrets/__tests__/info.test.d.ts.map +0 -1
- package/dist/tbv/core/vault-secrets/expand.d.ts +0 -58
- package/dist/tbv/core/vault-secrets/expand.d.ts.map +0 -1
- package/dist/tbv/core/vault-secrets/info.d.ts +0 -55
- package/dist/tbv/core/vault-secrets/info.d.ts.map +0 -1
- package/dist/vault-registry-reader-Brkh1j7p.cjs.map +0 -1
- package/dist/vault-registry-reader-CqhD3Iyd.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,173 +1,174 @@
|
|
|
1
1
|
import { a as s, b as t, c as r } from "./challengeAssert-BzxQmdZy.js";
|
|
2
|
-
import { computeMinClaimValue as i, deriveVaultId as n } from "@babylonlabs-io/babylon-tbv-rust-wasm";
|
|
3
|
-
import { c as
|
|
4
|
-
import { a as
|
|
5
|
-
import { a as
|
|
6
|
-
import { d as
|
|
7
|
-
import { c as
|
|
8
|
-
import { B as
|
|
9
|
-
import { P as
|
|
10
|
-
import { P as sa, c as ta, v as ra } from "./PayoutManager-
|
|
2
|
+
import { computeMinClaimValue as i, deriveVaultId as n, expandAuthAnchor as l, expandHashlockSecret as u, expandWotsSeed as d } from "@babylonlabs-io/babylon-tbv-rust-wasm";
|
|
3
|
+
import { c as P, a as c, b as T, e as S, f as A } from "./peginInput-C2QPvuhR.js";
|
|
4
|
+
import { a as R, b as g } from "./noPayout-DBX6G96_.js";
|
|
5
|
+
import { a as _, b as x, c as f, e as b } from "./payout-BNFMBXS6.js";
|
|
6
|
+
import { d as v, a as C, e as U, f as V, g as O, h as F, i as y, b as h, p as N, s as B, t as D, u as M, v as H } from "./bitcoin-B0S8SHCX.js";
|
|
7
|
+
import { c as k } from "./signing-DaLvGwQe.js";
|
|
8
|
+
import { B as w, H as X, K, M as G, T as Y } from "./validation-CxqROCno.js";
|
|
9
|
+
import { P as J, V as j, b as z, a as q, c as Q, e as $, d as aa } from "./PeginManager-DF1oinIQ.js";
|
|
10
|
+
import { P as sa, c as ta, v as ra } from "./PayoutManager-s_uH8Uuj.js";
|
|
11
11
|
import { A as ia, P as na } from "./ProtocolParams.abi-DXu8L0Fn.js";
|
|
12
12
|
import { B as ua } from "./BTCVaultRegistry.abi-DbJ5lsFJ.js";
|
|
13
13
|
import { C as pa, e as Pa, g as ca, h as Ta, i as Sa } from "./errors-CznAK5NB.js";
|
|
14
|
-
import { BitcoinNetworks as
|
|
15
|
-
import { B as
|
|
14
|
+
import { BitcoinNetworks as Ea } from "./shared/index.js";
|
|
15
|
+
import { B as ga, D as ma, F as _a, L as xa, M as fa, P as ba, b as Ia, a as va, S as Ca, T as Ua, W as Va, f as Oa, c as Fa, p as ya, r as ha } from "./fundPeginTransaction-oV-dNJOU.js";
|
|
16
16
|
import { U as Ba, a as Da, c as Ma, e as Ha, s as La, v as ka } from "./reservation-CHUGW0F_.js";
|
|
17
|
-
import { B as
|
|
18
|
-
import { M as
|
|
19
|
-
import { S as
|
|
20
|
-
import { D as
|
|
21
|
-
import { i as
|
|
22
|
-
import { B as
|
|
23
|
-
import { C as
|
|
17
|
+
import { B as wa, c as Xa, g as Ka, d as Ga, b as Ya, s as Za, a as Ja, w as ja } from "./waitForTransactionReceiptSmartAware-Cj_DKm0G.js";
|
|
18
|
+
import { M as qa, g as Qa, a as $a, b as ae, c as ee, d as se, e as te, f as re, p as oe } from "./mempoolApi-CAIge7Nj.js";
|
|
19
|
+
import { S as ne, V as le, j as ue, k as de, l as pe, m as Pe, a as ce, d as Te, b as Se, f as Ae, p as Ee, r as Re, g as ge, h as me, v as _e, i as xe, c as fe, e as be } from "./vault-registry-reader-Bz8uu0dh.js";
|
|
20
|
+
import { D as ve, b as Ce, J as Ue, a as Ve, d as Oe, P as Fe, R as ye, e as he, c as Ne, V as Be } from "./types-TiIjyo2b.js";
|
|
21
|
+
import { i as Me, p as He } from "./errors-9AkghWyk.js";
|
|
22
|
+
import { B as ke, C as We, R as we, a as Xe, k as Ke, l as Ge, i as Ye, j as Ze, h as Je, r as je, b as ze, s as qe, v as Qe, g as $e, d as as, c as es, e as ss, f as ts, w as rs } from "./buildAndBroadcastRefund-DzX11N9S.js";
|
|
23
|
+
import { C as is, P as ns, c as ls, g as us } from "./peginState-CBAlxgXk.js";
|
|
24
24
|
export {
|
|
25
25
|
ia as ApplicationRegistryABI,
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
ke as BIP68NotMatureError,
|
|
27
|
+
w as BITCOIN_ADDRESS_RE,
|
|
28
28
|
ua as BTCVaultRegistryABI,
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
ga as BTC_DUST_SAT,
|
|
30
|
+
Ea as BitcoinNetworks,
|
|
31
|
+
wa as BitcoinScriptType,
|
|
32
32
|
pa as CONTRACT_ERRORS,
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
We as ClaimerPegoutStatusValue,
|
|
34
|
+
is as ContractStatus,
|
|
35
35
|
ma as DUST_THRESHOLD,
|
|
36
|
-
|
|
36
|
+
ve as DaemonStatus,
|
|
37
37
|
_a as FEE_SAFETY_MARGIN,
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
38
|
+
X as HEX_RE,
|
|
39
|
+
Ce as JSON_RPC_ERROR_CODES,
|
|
40
|
+
Ue as JsonRpcClient,
|
|
41
|
+
Ve as JsonRpcError,
|
|
42
|
+
K as KNOWN_SCRIPT_PREFIXES,
|
|
43
43
|
xa as LOW_RATE_ESTIMATION_ACCURACY_BUFFER,
|
|
44
44
|
fa as MAX_NON_LEGACY_OUTPUT_SIZE,
|
|
45
|
-
|
|
46
|
-
|
|
45
|
+
G as MAX_REASONABLE_FEE_SATS,
|
|
46
|
+
qa as MEMPOOL_API_URLS,
|
|
47
47
|
ba as P2TR_INPUT_SIZE,
|
|
48
48
|
Ia as PEGIN_AUTH_ANCHOR_OUTPUTS,
|
|
49
49
|
va as PEGIN_FIXED_OUTPUTS,
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
Oe as POST_WOTS_STATUSES,
|
|
51
|
+
Fe as PRE_DEPOSITOR_SIGNATURES_STATES,
|
|
52
52
|
sa as PayoutManager,
|
|
53
|
-
|
|
54
|
-
|
|
53
|
+
ns as PeginAction,
|
|
54
|
+
J as PeginManager,
|
|
55
55
|
na as ProtocolParamsABI,
|
|
56
|
-
|
|
57
|
-
|
|
56
|
+
we as REFUND_VSIZE,
|
|
57
|
+
ye as RpcErrorCode,
|
|
58
58
|
Ca as SPLIT_TX_FEE_SAFETY_MULTIPLIER,
|
|
59
|
-
|
|
60
|
-
|
|
59
|
+
ne as ServerIdentityError,
|
|
60
|
+
Y as TXID_RE,
|
|
61
61
|
Ua as TX_BUFFER_SIZE_OVERHEAD,
|
|
62
62
|
Ba as UtxoNotAvailableError,
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
63
|
+
j as VAULT_APP_NAME,
|
|
64
|
+
he as VP_BATCH_MAX_SIZE,
|
|
65
|
+
Ne as VP_TERMINAL_STATUSES,
|
|
66
|
+
Be as VP_TRANSIENT_STATUSES,
|
|
67
|
+
le as VaultProviderRpcClient,
|
|
68
|
+
ue as ViemProtocolParamsReader,
|
|
69
|
+
de as ViemUniversalChallengerReader,
|
|
70
|
+
pe as ViemVaultKeeperReader,
|
|
71
|
+
Pe as ViemVaultRegistryReader,
|
|
72
|
+
ce as VpResponseValidationError,
|
|
73
|
+
Te as VpTokenRegistry,
|
|
74
74
|
Va as WALLET_RELAY_FEE_RATE_THRESHOLD,
|
|
75
75
|
Xe as activateVault,
|
|
76
|
-
|
|
76
|
+
_ as assertPayoutOutputMatchesRegistered,
|
|
77
77
|
Da as assertUtxosAvailable,
|
|
78
|
-
|
|
79
|
-
|
|
78
|
+
Se as batchPollByProvider,
|
|
79
|
+
Ke as buildAndBroadcastRefund,
|
|
80
80
|
s as buildChallengeAssertPsbt,
|
|
81
81
|
t as buildDepositorPayoutPsbt,
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
82
|
+
z as buildFundingOutpointsCommitment,
|
|
83
|
+
R as buildNoPayoutPsbt,
|
|
84
|
+
x as buildPayoutPsbt,
|
|
85
|
+
P as buildPeginInputPsbt,
|
|
86
|
+
c as buildPeginTxFromFundedPrePegin,
|
|
87
|
+
T as buildPrePeginPsbt,
|
|
88
|
+
g as buildRefundPsbt,
|
|
89
|
+
q as buildVaultContext,
|
|
90
|
+
Xa as calculateBtcTxHash,
|
|
91
|
+
ls as canPerformAction,
|
|
92
92
|
Ma as collectReservedUtxoRefs,
|
|
93
93
|
ta as computeHashlock,
|
|
94
94
|
i as computeMinClaimValue,
|
|
95
95
|
r as computeNumLocalChallengers,
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
96
|
+
Q as computeWotsBlockPublicKeysHash,
|
|
97
|
+
Ae as createAuthenticatedVpClient,
|
|
98
|
+
f as createPayoutScript,
|
|
99
|
+
k as createTaprootScriptPathSignOptions,
|
|
100
|
+
v as deriveNativeSegwitAddress,
|
|
101
|
+
C as deriveTaprootAddress,
|
|
102
102
|
n as deriveVaultId,
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
103
|
+
$ as deriveVaultRoot,
|
|
104
|
+
aa as deriveWotsBlocksFromSeed,
|
|
105
|
+
U as ensureHexPrefix,
|
|
106
|
+
Ge as estimateRefundFeeSats,
|
|
107
|
+
l as expandAuthAnchor,
|
|
108
|
+
u as expandHashlockSecret,
|
|
109
|
+
d as expandWotsSeed,
|
|
110
110
|
Pa as extractErrorData,
|
|
111
111
|
Ha as extractInputsFromTransaction,
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
112
|
+
b as extractPayoutSignature,
|
|
113
|
+
S as extractPeginInputSignature,
|
|
114
|
+
A as finalizePeginInputPsbt,
|
|
115
|
+
V as formatSatoshisToBtc,
|
|
116
116
|
Oa as fundPeginTransaction,
|
|
117
|
-
|
|
118
|
-
|
|
117
|
+
Qa as getAddressTxs,
|
|
118
|
+
$a as getAddressUtxos,
|
|
119
119
|
ca as getContractErrorMessage,
|
|
120
120
|
Ka as getDustThreshold,
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
121
|
+
ae as getMempoolApiUrl,
|
|
122
|
+
O as getNetwork,
|
|
123
|
+
ee as getNetworkFees,
|
|
124
|
+
us as getPeginProtocolState,
|
|
125
125
|
Ga as getPsbtInputFields,
|
|
126
126
|
Ya as getScriptType,
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
127
|
+
se as getTxHex,
|
|
128
|
+
te as getTxInfo,
|
|
129
|
+
re as getUtxoInfo,
|
|
130
130
|
Ta as handleContractError,
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
131
|
+
F as hexToUint8Array,
|
|
132
|
+
y as isAddressFromPublicKey,
|
|
133
|
+
Ye as isDepositAmountValid,
|
|
134
134
|
Sa as isKnownContractError,
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
135
|
+
Ze as isPegoutTerminalStatus,
|
|
136
|
+
Je as isRecognizedPegoutStatus,
|
|
137
|
+
h as isValidHex,
|
|
138
|
+
Me as isWotsMismatchError,
|
|
139
|
+
He as parseFundingOutpointsFromTx,
|
|
140
|
+
Fa as parseUnfundedWasmTransaction,
|
|
141
141
|
ya as peginOutputCount,
|
|
142
142
|
Ee as primeVpTokenRegistry,
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
143
|
+
N as processPublicKeyToXOnly,
|
|
144
|
+
oe as pushTx,
|
|
145
|
+
ha as rateBasedTxBufferFee,
|
|
146
|
+
Re as resolveProtocolAddresses,
|
|
147
|
+
je as runDepositorPresignFlow,
|
|
148
148
|
La as selectUtxosForDeposit,
|
|
149
149
|
Za as selectUtxosForPegin,
|
|
150
150
|
Ja as shouldAddChangeOutput,
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
151
|
+
ze as signDepositorGraph,
|
|
152
|
+
B as stripHexPrefix,
|
|
153
|
+
qe as submitWotsPublicKey,
|
|
154
|
+
D as toXOnly,
|
|
155
|
+
M as uint8ArrayToHex,
|
|
156
|
+
Qe as validateDepositAmount,
|
|
157
|
+
$e as validateMultiVaultDepositInputs,
|
|
158
158
|
ge as validateOffchainParams,
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
159
|
+
me as validatePegInConfiguration,
|
|
160
|
+
as as validateProviderSelection,
|
|
161
|
+
es as validateRemainingCapacity,
|
|
162
|
+
_e as validateRequestDepositorClaimerArtifactsResponse,
|
|
163
163
|
ra as validateSecretAgainstHashlock,
|
|
164
|
-
|
|
164
|
+
xe as validateTBVProtocolParams,
|
|
165
165
|
ka as validateUtxosAvailable,
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
166
|
+
ss as validateVaultAmounts,
|
|
167
|
+
ts as validateVaultProviderPubkey,
|
|
168
|
+
H as validateWalletPubkey,
|
|
169
|
+
fe as verifyServerIdentity,
|
|
170
|
+
be as vpTokenRegistry,
|
|
171
|
+
rs as waitForPeginStatus,
|
|
172
|
+
ja as waitForTransactionReceiptSmartAware
|
|
172
173
|
};
|
|
173
174
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
var U = Object.defineProperty;
|
|
2
|
+
var m = (e, t, s) => t in e ? U(e, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : e[t] = s;
|
|
3
|
+
var x = (e, t, s) => m(e, typeof t != "symbol" ? t + "" : t, s);
|
|
4
|
+
function B(e) {
|
|
5
|
+
return e instanceof Uint8Array || ArrayBuffer.isView(e) && e.constructor.name === "Uint8Array";
|
|
6
|
+
}
|
|
7
|
+
function W(e, t = "") {
|
|
8
|
+
if (!Number.isSafeInteger(e) || e < 0) {
|
|
9
|
+
const s = t && `"${t}" `;
|
|
10
|
+
throw new Error(`${s}expected integer >= 0, got ${e}`);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
function H(e, t, s = "") {
|
|
14
|
+
const n = B(e), i = e == null ? void 0 : e.length;
|
|
15
|
+
if (!n || t !== void 0) {
|
|
16
|
+
const o = s && `"${s}" `, c = "", a = n ? `length=${i}` : `type=${typeof e}`;
|
|
17
|
+
throw new Error(o + "expected Uint8Array" + c + ", got " + a);
|
|
18
|
+
}
|
|
19
|
+
return e;
|
|
20
|
+
}
|
|
21
|
+
function E(e, t = !0) {
|
|
22
|
+
if (e.destroyed)
|
|
23
|
+
throw new Error("Hash instance has been destroyed");
|
|
24
|
+
if (t && e.finished)
|
|
25
|
+
throw new Error("Hash#digest() has already been called");
|
|
26
|
+
}
|
|
27
|
+
function I(e, t) {
|
|
28
|
+
H(e, void 0, "digestInto() output");
|
|
29
|
+
const s = t.outputLen;
|
|
30
|
+
if (e.length < s)
|
|
31
|
+
throw new Error('"digestInto() output" expected to be of length >=' + s);
|
|
32
|
+
}
|
|
33
|
+
function N(e) {
|
|
34
|
+
return new Uint32Array(e.buffer, e.byteOffset, Math.floor(e.byteLength / 4));
|
|
35
|
+
}
|
|
36
|
+
function L(...e) {
|
|
37
|
+
for (let t = 0; t < e.length; t++)
|
|
38
|
+
e[t].fill(0);
|
|
39
|
+
}
|
|
40
|
+
function w(e) {
|
|
41
|
+
return new DataView(e.buffer, e.byteOffset, e.byteLength);
|
|
42
|
+
}
|
|
43
|
+
function h(e, t) {
|
|
44
|
+
return e << 32 - t | e >>> t;
|
|
45
|
+
}
|
|
46
|
+
function T(e, t) {
|
|
47
|
+
return e << t | e >>> 32 - t >>> 0;
|
|
48
|
+
}
|
|
49
|
+
const _ = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68;
|
|
50
|
+
function S(e) {
|
|
51
|
+
return e << 24 & 4278190080 | e << 8 & 16711680 | e >>> 8 & 65280 | e >>> 24 & 255;
|
|
52
|
+
}
|
|
53
|
+
function k(e) {
|
|
54
|
+
for (let t = 0; t < e.length; t++)
|
|
55
|
+
e[t] = S(e[t]);
|
|
56
|
+
return e;
|
|
57
|
+
}
|
|
58
|
+
const z = _ ? (e) => e : k;
|
|
59
|
+
function C(e, t = {}) {
|
|
60
|
+
const s = (i, f) => e(f).update(i).digest(), n = e(void 0);
|
|
61
|
+
return s.outputLen = n.outputLen, s.blockLen = n.blockLen, s.create = (i) => e(i), Object.assign(s, t), Object.freeze(s);
|
|
62
|
+
}
|
|
63
|
+
const D = (e) => ({
|
|
64
|
+
oid: Uint8Array.from([6, 9, 96, 134, 72, 1, 101, 3, 4, 2, e])
|
|
65
|
+
});
|
|
66
|
+
function O(e, t, s) {
|
|
67
|
+
return e & t ^ ~e & s;
|
|
68
|
+
}
|
|
69
|
+
function $(e, t, s) {
|
|
70
|
+
return e & t ^ e & s ^ t & s;
|
|
71
|
+
}
|
|
72
|
+
class F {
|
|
73
|
+
constructor(t, s, n, i) {
|
|
74
|
+
x(this, "blockLen");
|
|
75
|
+
x(this, "outputLen");
|
|
76
|
+
x(this, "padOffset");
|
|
77
|
+
x(this, "isLE");
|
|
78
|
+
// For partial updates less than block size
|
|
79
|
+
x(this, "buffer");
|
|
80
|
+
x(this, "view");
|
|
81
|
+
x(this, "finished", !1);
|
|
82
|
+
x(this, "length", 0);
|
|
83
|
+
x(this, "pos", 0);
|
|
84
|
+
x(this, "destroyed", !1);
|
|
85
|
+
this.blockLen = t, this.outputLen = s, this.padOffset = n, this.isLE = i, this.buffer = new Uint8Array(t), this.view = w(this.buffer);
|
|
86
|
+
}
|
|
87
|
+
update(t) {
|
|
88
|
+
E(this), H(t);
|
|
89
|
+
const { view: s, buffer: n, blockLen: i } = this, f = t.length;
|
|
90
|
+
for (let o = 0; o < f; ) {
|
|
91
|
+
const c = Math.min(i - this.pos, f - o);
|
|
92
|
+
if (c === i) {
|
|
93
|
+
const a = w(t);
|
|
94
|
+
for (; i <= f - o; o += i)
|
|
95
|
+
this.process(a, o);
|
|
96
|
+
continue;
|
|
97
|
+
}
|
|
98
|
+
n.set(t.subarray(o, o + c), this.pos), this.pos += c, o += c, this.pos === i && (this.process(s, 0), this.pos = 0);
|
|
99
|
+
}
|
|
100
|
+
return this.length += t.length, this.roundClean(), this;
|
|
101
|
+
}
|
|
102
|
+
digestInto(t) {
|
|
103
|
+
E(this), I(t, this), this.finished = !0;
|
|
104
|
+
const { buffer: s, view: n, blockLen: i, isLE: f } = this;
|
|
105
|
+
let { pos: o } = this;
|
|
106
|
+
s[o++] = 128, L(this.buffer.subarray(o)), this.padOffset > i - o && (this.process(n, 0), o = 0);
|
|
107
|
+
for (let r = o; r < i; r++)
|
|
108
|
+
s[r] = 0;
|
|
109
|
+
n.setBigUint64(i - 8, BigInt(this.length * 8), f), this.process(n, 0);
|
|
110
|
+
const c = w(t), a = this.outputLen;
|
|
111
|
+
if (a % 4)
|
|
112
|
+
throw new Error("_sha2: outputLen must be aligned to 32bit");
|
|
113
|
+
const u = a / 4, b = this.get();
|
|
114
|
+
if (u > b.length)
|
|
115
|
+
throw new Error("_sha2: outputLen bigger than state");
|
|
116
|
+
for (let r = 0; r < u; r++)
|
|
117
|
+
c.setUint32(4 * r, b[r], f);
|
|
118
|
+
}
|
|
119
|
+
digest() {
|
|
120
|
+
const { buffer: t, outputLen: s } = this;
|
|
121
|
+
this.digestInto(t);
|
|
122
|
+
const n = t.slice(0, s);
|
|
123
|
+
return this.destroy(), n;
|
|
124
|
+
}
|
|
125
|
+
_cloneInto(t) {
|
|
126
|
+
t || (t = new this.constructor()), t.set(...this.get());
|
|
127
|
+
const { blockLen: s, buffer: n, length: i, finished: f, destroyed: o, pos: c } = this;
|
|
128
|
+
return t.destroyed = o, t.finished = f, t.length = i, t.pos = c, i % s && t.buffer.set(n), t;
|
|
129
|
+
}
|
|
130
|
+
clone() {
|
|
131
|
+
return this._cloneInto();
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
const d = /* @__PURE__ */ Uint32Array.from([
|
|
135
|
+
1779033703,
|
|
136
|
+
3144134277,
|
|
137
|
+
1013904242,
|
|
138
|
+
2773480762,
|
|
139
|
+
1359893119,
|
|
140
|
+
2600822924,
|
|
141
|
+
528734635,
|
|
142
|
+
1541459225
|
|
143
|
+
]), G = /* @__PURE__ */ Uint32Array.from([
|
|
144
|
+
1116352408,
|
|
145
|
+
1899447441,
|
|
146
|
+
3049323471,
|
|
147
|
+
3921009573,
|
|
148
|
+
961987163,
|
|
149
|
+
1508970993,
|
|
150
|
+
2453635748,
|
|
151
|
+
2870763221,
|
|
152
|
+
3624381080,
|
|
153
|
+
310598401,
|
|
154
|
+
607225278,
|
|
155
|
+
1426881987,
|
|
156
|
+
1925078388,
|
|
157
|
+
2162078206,
|
|
158
|
+
2614888103,
|
|
159
|
+
3248222580,
|
|
160
|
+
3835390401,
|
|
161
|
+
4022224774,
|
|
162
|
+
264347078,
|
|
163
|
+
604807628,
|
|
164
|
+
770255983,
|
|
165
|
+
1249150122,
|
|
166
|
+
1555081692,
|
|
167
|
+
1996064986,
|
|
168
|
+
2554220882,
|
|
169
|
+
2821834349,
|
|
170
|
+
2952996808,
|
|
171
|
+
3210313671,
|
|
172
|
+
3336571891,
|
|
173
|
+
3584528711,
|
|
174
|
+
113926993,
|
|
175
|
+
338241895,
|
|
176
|
+
666307205,
|
|
177
|
+
773529912,
|
|
178
|
+
1294757372,
|
|
179
|
+
1396182291,
|
|
180
|
+
1695183700,
|
|
181
|
+
1986661051,
|
|
182
|
+
2177026350,
|
|
183
|
+
2456956037,
|
|
184
|
+
2730485921,
|
|
185
|
+
2820302411,
|
|
186
|
+
3259730800,
|
|
187
|
+
3345764771,
|
|
188
|
+
3516065817,
|
|
189
|
+
3600352804,
|
|
190
|
+
4094571909,
|
|
191
|
+
275423344,
|
|
192
|
+
430227734,
|
|
193
|
+
506948616,
|
|
194
|
+
659060556,
|
|
195
|
+
883997877,
|
|
196
|
+
958139571,
|
|
197
|
+
1322822218,
|
|
198
|
+
1537002063,
|
|
199
|
+
1747873779,
|
|
200
|
+
1955562222,
|
|
201
|
+
2024104815,
|
|
202
|
+
2227730452,
|
|
203
|
+
2361852424,
|
|
204
|
+
2428436474,
|
|
205
|
+
2756734187,
|
|
206
|
+
3204031479,
|
|
207
|
+
3329325298
|
|
208
|
+
]), l = /* @__PURE__ */ new Uint32Array(64);
|
|
209
|
+
class V extends F {
|
|
210
|
+
constructor(t) {
|
|
211
|
+
super(64, t, 8, !1);
|
|
212
|
+
}
|
|
213
|
+
get() {
|
|
214
|
+
const { A: t, B: s, C: n, D: i, E: f, F: o, G: c, H: a } = this;
|
|
215
|
+
return [t, s, n, i, f, o, c, a];
|
|
216
|
+
}
|
|
217
|
+
// prettier-ignore
|
|
218
|
+
set(t, s, n, i, f, o, c, a) {
|
|
219
|
+
this.A = t | 0, this.B = s | 0, this.C = n | 0, this.D = i | 0, this.E = f | 0, this.F = o | 0, this.G = c | 0, this.H = a | 0;
|
|
220
|
+
}
|
|
221
|
+
process(t, s) {
|
|
222
|
+
for (let r = 0; r < 16; r++, s += 4)
|
|
223
|
+
l[r] = t.getUint32(s, !1);
|
|
224
|
+
for (let r = 16; r < 64; r++) {
|
|
225
|
+
const g = l[r - 15], p = l[r - 2], A = h(g, 7) ^ h(g, 18) ^ g >>> 3, y = h(p, 17) ^ h(p, 19) ^ p >>> 10;
|
|
226
|
+
l[r] = y + l[r - 7] + A + l[r - 16] | 0;
|
|
227
|
+
}
|
|
228
|
+
let { A: n, B: i, C: f, D: o, E: c, F: a, G: u, H: b } = this;
|
|
229
|
+
for (let r = 0; r < 64; r++) {
|
|
230
|
+
const g = h(c, 6) ^ h(c, 11) ^ h(c, 25), p = b + g + O(c, a, u) + G[r] + l[r] | 0, y = (h(n, 2) ^ h(n, 13) ^ h(n, 22)) + $(n, i, f) | 0;
|
|
231
|
+
b = u, u = a, a = c, c = o + p | 0, o = f, f = i, i = n, n = p + y | 0;
|
|
232
|
+
}
|
|
233
|
+
n = n + this.A | 0, i = i + this.B | 0, f = f + this.C | 0, o = o + this.D | 0, c = c + this.E | 0, a = a + this.F | 0, u = u + this.G | 0, b = b + this.H | 0, this.set(n, i, f, o, c, a, u, b);
|
|
234
|
+
}
|
|
235
|
+
roundClean() {
|
|
236
|
+
L(l);
|
|
237
|
+
}
|
|
238
|
+
destroy() {
|
|
239
|
+
this.set(0, 0, 0, 0, 0, 0, 0, 0), L(this.buffer);
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
class M extends V {
|
|
243
|
+
constructor() {
|
|
244
|
+
super(32);
|
|
245
|
+
// We cannot use array here since array allows indexing by variable
|
|
246
|
+
// which means optimizer/compiler cannot use registers.
|
|
247
|
+
x(this, "A", d[0] | 0);
|
|
248
|
+
x(this, "B", d[1] | 0);
|
|
249
|
+
x(this, "C", d[2] | 0);
|
|
250
|
+
x(this, "D", d[3] | 0);
|
|
251
|
+
x(this, "E", d[4] | 0);
|
|
252
|
+
x(this, "F", d[5] | 0);
|
|
253
|
+
x(this, "G", d[6] | 0);
|
|
254
|
+
x(this, "H", d[7] | 0);
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
const K = /* @__PURE__ */ C(
|
|
258
|
+
() => new M(),
|
|
259
|
+
/* @__PURE__ */ D(1)
|
|
260
|
+
);
|
|
261
|
+
export {
|
|
262
|
+
F as H,
|
|
263
|
+
L as a,
|
|
264
|
+
W as b,
|
|
265
|
+
C as c,
|
|
266
|
+
z as d,
|
|
267
|
+
E as e,
|
|
268
|
+
H as f,
|
|
269
|
+
I as g,
|
|
270
|
+
T as r,
|
|
271
|
+
K as s,
|
|
272
|
+
N as u
|
|
273
|
+
};
|
|
274
|
+
//# sourceMappingURL=sha2-BYVxyZzX.js.map
|