@dexterai/vault 0.4.2 → 0.6.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/README.md +62 -16
- package/dist/connect/index.cjs +455 -0
- package/dist/connect/index.d.cts +145 -0
- package/dist/connect/index.d.ts +145 -0
- package/dist/connect/index.js +419 -0
- package/dist/constants/index.cjs +13 -1
- package/dist/constants/index.d.cts +11 -1
- package/dist/constants/index.d.ts +11 -1
- package/dist/constants/index.js +12 -1
- package/dist/counterfactual.cjs +12 -1
- package/dist/counterfactual.js +12 -1
- package/dist/factoring/index.cjs +246 -0
- package/dist/factoring/index.d.cts +79 -0
- package/dist/factoring/index.d.ts +79 -0
- package/dist/factoring/index.js +220 -0
- package/dist/idl/dexter_vault.json +976 -1
- package/dist/index.cjs +12 -1
- package/dist/index.js +12 -1
- package/dist/instructions/index.cjs +249 -4400
- package/dist/instructions/index.d.cts +172 -1
- package/dist/instructions/index.d.ts +172 -1
- package/dist/instructions/index.js +235 -4396
- package/dist/kit/index.cjs +67 -0
- package/dist/kit/index.d.cts +13 -0
- package/dist/kit/index.d.ts +13 -0
- package/dist/kit/index.js +41 -0
- package/dist/messages/index.cjs +11 -1
- package/dist/messages/index.js +11 -1
- package/dist/precompile/index.cjs +11 -1
- package/dist/precompile/index.js +11 -1
- package/dist/tab/index.cjs +640 -0
- package/dist/tab/index.d.cts +145 -0
- package/dist/tab/index.d.ts +145 -0
- package/dist/tab/index.js +631 -0
- package/package.json +23 -1
|
@@ -0,0 +1,419 @@
|
|
|
1
|
+
// src/connect/verify.ts
|
|
2
|
+
import { PublicKey as PublicKey3, Transaction } from "@solana/web3.js";
|
|
3
|
+
import { createHash } from "crypto";
|
|
4
|
+
|
|
5
|
+
// src/instructions/provePasskey.ts
|
|
6
|
+
import {
|
|
7
|
+
TransactionInstruction,
|
|
8
|
+
SYSVAR_INSTRUCTIONS_PUBKEY
|
|
9
|
+
} from "@solana/web3.js";
|
|
10
|
+
|
|
11
|
+
// src/constants/index.ts
|
|
12
|
+
import { PublicKey } from "@solana/web3.js";
|
|
13
|
+
var DEXTER_VAULT_PROGRAM_ID = new PublicKey(
|
|
14
|
+
"Hg3wRaydFtJhYrdvYrKECacpJYDsC9Px7yKmpncj2fhc"
|
|
15
|
+
);
|
|
16
|
+
var SWIG_PROGRAM_ID = new PublicKey(
|
|
17
|
+
"swigypWHEksbC64pWKwah1WTeh9JXwx8H1rJHLdbQMB"
|
|
18
|
+
);
|
|
19
|
+
var SECP256R1_PROGRAM_ID = new PublicKey(
|
|
20
|
+
"Secp256r1SigVerify1111111111111111111111111"
|
|
21
|
+
);
|
|
22
|
+
var ED25519_PROGRAM_ID = new PublicKey(
|
|
23
|
+
"Ed25519SigVerify111111111111111111111111111"
|
|
24
|
+
);
|
|
25
|
+
var INSTRUCTIONS_SYSVAR_ID = new PublicKey(
|
|
26
|
+
"Sysvar1nstructions1111111111111111111111111"
|
|
27
|
+
);
|
|
28
|
+
var VAULT_SEED_PREFIX = Buffer.from("vault");
|
|
29
|
+
var LOCKED_CLAIM_SEED = Buffer.from("locked-claim");
|
|
30
|
+
var DISCRIMINATORS = Object.freeze({
|
|
31
|
+
initialize_vault: Uint8Array.from([48, 191, 163, 44, 71, 129, 63, 164]),
|
|
32
|
+
set_swig: Uint8Array.from([253, 229, 89, 206, 192, 118, 137, 165]),
|
|
33
|
+
settle_voucher: Uint8Array.from([144, 176, 128, 220, 156, 79, 41, 54]),
|
|
34
|
+
request_withdrawal: Uint8Array.from([251, 85, 121, 205, 56, 201, 12, 177]),
|
|
35
|
+
finalize_withdrawal: Uint8Array.from([178, 87, 206, 68, 201, 186, 164, 232]),
|
|
36
|
+
force_release: Uint8Array.from([122, 190, 243, 252, 54, 202, 208, 234]),
|
|
37
|
+
rotate_passkey: Uint8Array.from([28, 134, 49, 89, 196, 34, 58, 174]),
|
|
38
|
+
rotate_dexter_authority: Uint8Array.from([145, 60, 4, 119, 180, 205, 236, 134]),
|
|
39
|
+
prove_passkey: Uint8Array.from([35, 175, 41, 143, 201, 118, 49, 184]),
|
|
40
|
+
settle_tab_voucher: Uint8Array.from([173, 22, 98, 31, 110, 129, 59, 161]),
|
|
41
|
+
register_session_key: Uint8Array.from([69, 94, 60, 44, 49, 199, 183, 233]),
|
|
42
|
+
revoke_session_key: Uint8Array.from([81, 192, 32, 110, 104, 116, 144, 151]),
|
|
43
|
+
lock_voucher: Uint8Array.from([91, 138, 5, 227, 119, 239, 48, 254]),
|
|
44
|
+
settle_locked_voucher: Uint8Array.from([44, 80, 216, 43, 247, 253, 101, 45]),
|
|
45
|
+
transfer_lock_ownership: Uint8Array.from([193, 13, 131, 134, 95, 25, 229, 157]),
|
|
46
|
+
recover_abandoned_lock: Uint8Array.from([169, 213, 107, 64, 229, 49, 43, 234]),
|
|
47
|
+
open_standby: Uint8Array.from([234, 184, 232, 135, 246, 191, 90, 250]),
|
|
48
|
+
draw_credit: Uint8Array.from([20, 84, 47, 211, 78, 117, 195, 210]),
|
|
49
|
+
repay_credit: Uint8Array.from([38, 113, 240, 182, 109, 179, 154, 245]),
|
|
50
|
+
seize_collateral: Uint8Array.from([40, 250, 7, 243, 168, 184, 116, 154]),
|
|
51
|
+
migrate_v4_to_v5: Uint8Array.from([226, 105, 140, 184, 101, 39, 235, 116])
|
|
52
|
+
});
|
|
53
|
+
var OTS_SESSION_REGISTER_V1_DOMAIN = (() => {
|
|
54
|
+
const buf = new Uint8Array(32);
|
|
55
|
+
buf.set(new TextEncoder().encode("OTS_SESSION_REGISTER_V1"), 0);
|
|
56
|
+
return buf;
|
|
57
|
+
})();
|
|
58
|
+
var OTS_SESSION_REGISTER_V2_DOMAIN = (() => {
|
|
59
|
+
const buf = new Uint8Array(32);
|
|
60
|
+
buf.set(new TextEncoder().encode("OTS_SESSION_REGISTER_V2"), 0);
|
|
61
|
+
return buf;
|
|
62
|
+
})();
|
|
63
|
+
var OTS_SESSION_REVOKE_V1_DOMAIN = (() => {
|
|
64
|
+
const buf = new Uint8Array(32);
|
|
65
|
+
buf.set(new TextEncoder().encode("OTS_SESSION_REVOKE_V1"), 0);
|
|
66
|
+
return buf;
|
|
67
|
+
})();
|
|
68
|
+
|
|
69
|
+
// src/instructions/provePasskey.ts
|
|
70
|
+
function encodeBytesVec(buf) {
|
|
71
|
+
const out = Buffer.alloc(4 + buf.length);
|
|
72
|
+
out.writeUInt32LE(buf.length, 0);
|
|
73
|
+
Buffer.from(buf).copy(out, 4);
|
|
74
|
+
return out;
|
|
75
|
+
}
|
|
76
|
+
function encodeFixedBytes(buf, len) {
|
|
77
|
+
if (buf.length !== len) {
|
|
78
|
+
throw new Error(`expected ${len} bytes, got ${buf.length}`);
|
|
79
|
+
}
|
|
80
|
+
return Buffer.from(buf);
|
|
81
|
+
}
|
|
82
|
+
function buildProvePasskeyInstruction(p) {
|
|
83
|
+
const argsBuf = Buffer.concat([
|
|
84
|
+
encodeFixedBytes(p.challenge, 32),
|
|
85
|
+
encodeBytesVec(p.clientDataJSON),
|
|
86
|
+
encodeBytesVec(p.authenticatorData)
|
|
87
|
+
]);
|
|
88
|
+
const data = Buffer.concat([Buffer.from(DISCRIMINATORS.prove_passkey), argsBuf]);
|
|
89
|
+
return new TransactionInstruction({
|
|
90
|
+
programId: DEXTER_VAULT_PROGRAM_ID,
|
|
91
|
+
keys: [
|
|
92
|
+
{ pubkey: p.vaultPda, isSigner: false, isWritable: false },
|
|
93
|
+
{ pubkey: SYSVAR_INSTRUCTIONS_PUBKEY, isSigner: false, isWritable: false }
|
|
94
|
+
],
|
|
95
|
+
data
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// src/precompile/secp256r1.ts
|
|
100
|
+
import { TransactionInstruction as TransactionInstruction2 } from "@solana/web3.js";
|
|
101
|
+
var SIGNATURE_OFFSETS_SERIALIZED_SIZE = 14;
|
|
102
|
+
var SIGNATURE_SERIALIZED_SIZE = 64;
|
|
103
|
+
var COMPRESSED_PUBKEY_SERIALIZED_SIZE = 33;
|
|
104
|
+
var PRECOMPILE_DATA_START = 2;
|
|
105
|
+
function buildSecp256r1VerifyInstruction(publicKey, signature, message) {
|
|
106
|
+
if (publicKey.length !== COMPRESSED_PUBKEY_SERIALIZED_SIZE) {
|
|
107
|
+
throw new Error(`expected ${COMPRESSED_PUBKEY_SERIALIZED_SIZE}-byte pubkey`);
|
|
108
|
+
}
|
|
109
|
+
if (signature.length !== SIGNATURE_SERIALIZED_SIZE) {
|
|
110
|
+
throw new Error(`expected ${SIGNATURE_SERIALIZED_SIZE}-byte signature`);
|
|
111
|
+
}
|
|
112
|
+
const signatureOffset = PRECOMPILE_DATA_START + SIGNATURE_OFFSETS_SERIALIZED_SIZE;
|
|
113
|
+
const publicKeyOffset = signatureOffset + SIGNATURE_SERIALIZED_SIZE;
|
|
114
|
+
const messageOffset = publicKeyOffset + COMPRESSED_PUBKEY_SERIALIZED_SIZE;
|
|
115
|
+
const messageSize = message.length;
|
|
116
|
+
const totalLen = messageOffset + messageSize;
|
|
117
|
+
const data = Buffer.alloc(totalLen);
|
|
118
|
+
data[0] = 1;
|
|
119
|
+
data[1] = 0;
|
|
120
|
+
data.writeUInt16LE(signatureOffset, PRECOMPILE_DATA_START + 0);
|
|
121
|
+
data.writeUInt16LE(65535, PRECOMPILE_DATA_START + 2);
|
|
122
|
+
data.writeUInt16LE(publicKeyOffset, PRECOMPILE_DATA_START + 4);
|
|
123
|
+
data.writeUInt16LE(65535, PRECOMPILE_DATA_START + 6);
|
|
124
|
+
data.writeUInt16LE(messageOffset, PRECOMPILE_DATA_START + 8);
|
|
125
|
+
data.writeUInt16LE(messageSize, PRECOMPILE_DATA_START + 10);
|
|
126
|
+
data.writeUInt16LE(65535, PRECOMPILE_DATA_START + 12);
|
|
127
|
+
Buffer.from(signature).copy(data, signatureOffset);
|
|
128
|
+
Buffer.from(publicKey).copy(data, publicKeyOffset);
|
|
129
|
+
Buffer.from(message).copy(data, messageOffset);
|
|
130
|
+
return new TransactionInstruction2({
|
|
131
|
+
keys: [],
|
|
132
|
+
programId: SECP256R1_PROGRAM_ID,
|
|
133
|
+
data
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
async function buildPrecompileMessage(clientDataJSON, authenticatorData) {
|
|
137
|
+
const subtle = globalThis.crypto?.subtle;
|
|
138
|
+
let clientDataHash;
|
|
139
|
+
if (subtle) {
|
|
140
|
+
const buf = await subtle.digest("SHA-256", clientDataJSON);
|
|
141
|
+
clientDataHash = new Uint8Array(buf);
|
|
142
|
+
} else {
|
|
143
|
+
const { createHash: createHash2 } = await import("crypto");
|
|
144
|
+
clientDataHash = createHash2("sha256").update(clientDataJSON).digest();
|
|
145
|
+
}
|
|
146
|
+
const out = new Uint8Array(authenticatorData.length + 32);
|
|
147
|
+
out.set(authenticatorData, 0);
|
|
148
|
+
out.set(clientDataHash, authenticatorData.length);
|
|
149
|
+
return out;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
// src/connect/verify.ts
|
|
153
|
+
function decodeChallengeTo32Bytes(challenge) {
|
|
154
|
+
const decoded = tryBase64urlDecode(challenge);
|
|
155
|
+
if (decoded && decoded.length === 32) return decoded;
|
|
156
|
+
return new Uint8Array(createHash("sha256").update(challenge, "utf8").digest());
|
|
157
|
+
}
|
|
158
|
+
function tryBase64urlDecode(s) {
|
|
159
|
+
if (!/^[A-Za-z0-9\-_]+={0,2}$/.test(s)) return null;
|
|
160
|
+
try {
|
|
161
|
+
return new Uint8Array(Buffer.from(s, "base64url"));
|
|
162
|
+
} catch {
|
|
163
|
+
return null;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
async function verifyConnectProof(args) {
|
|
167
|
+
const { connection, challenge, proof } = args;
|
|
168
|
+
try {
|
|
169
|
+
const challengeBytes = decodeChallengeTo32Bytes(challenge);
|
|
170
|
+
const vaultPda = new PublicKey3(proof.vault);
|
|
171
|
+
const precompileMessage = await buildPrecompileMessage(
|
|
172
|
+
proof.clientDataJSON,
|
|
173
|
+
proof.authenticatorData
|
|
174
|
+
);
|
|
175
|
+
const ix0 = buildSecp256r1VerifyInstruction(
|
|
176
|
+
proof.passkeyPubkey,
|
|
177
|
+
proof.signature,
|
|
178
|
+
precompileMessage
|
|
179
|
+
);
|
|
180
|
+
const ix1 = buildProvePasskeyInstruction({
|
|
181
|
+
vaultPda,
|
|
182
|
+
challenge: challengeBytes,
|
|
183
|
+
clientDataJSON: proof.clientDataJSON,
|
|
184
|
+
authenticatorData: proof.authenticatorData
|
|
185
|
+
});
|
|
186
|
+
const tx = new Transaction();
|
|
187
|
+
tx.add(ix0, ix1);
|
|
188
|
+
tx.feePayer = vaultPda;
|
|
189
|
+
tx.recentBlockhash = PublicKey3.default.toBase58();
|
|
190
|
+
const simulate = args.simulate ?? ((t) => connection.simulateTransaction(t, void 0, false));
|
|
191
|
+
const res = await simulate(tx);
|
|
192
|
+
const err = res?.value?.err ?? null;
|
|
193
|
+
if (err === null) {
|
|
194
|
+
return { ok: true, vault: vaultPda };
|
|
195
|
+
}
|
|
196
|
+
return { ok: false, reason: `simulation rejected: ${stringifyErr(err)}` };
|
|
197
|
+
} catch (e) {
|
|
198
|
+
return { ok: false, reason: e instanceof Error ? e.message : String(e) };
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
function stringifyErr(err) {
|
|
202
|
+
try {
|
|
203
|
+
return JSON.stringify(err);
|
|
204
|
+
} catch {
|
|
205
|
+
return String(err);
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
// src/signers/browser/index.ts
|
|
210
|
+
var WebAuthnAssertionError = class extends Error {
|
|
211
|
+
code;
|
|
212
|
+
constructor(code, message) {
|
|
213
|
+
super(message);
|
|
214
|
+
this.code = code;
|
|
215
|
+
this.name = "WebAuthnAssertionError";
|
|
216
|
+
}
|
|
217
|
+
};
|
|
218
|
+
var WebAuthnAssertion = class {
|
|
219
|
+
credentialId;
|
|
220
|
+
publicKeyBase64;
|
|
221
|
+
rpId;
|
|
222
|
+
allowCredentials;
|
|
223
|
+
timeoutMs;
|
|
224
|
+
userVerification;
|
|
225
|
+
constructor(config) {
|
|
226
|
+
if (!(config.credentialId instanceof Uint8Array) || config.credentialId.length === 0) {
|
|
227
|
+
throw new WebAuthnAssertionError(
|
|
228
|
+
"invalid_credential_id",
|
|
229
|
+
"credentialId must be a non-empty Uint8Array"
|
|
230
|
+
);
|
|
231
|
+
}
|
|
232
|
+
this.credentialId = config.credentialId;
|
|
233
|
+
this.publicKeyBase64 = config.publicKeyBase64;
|
|
234
|
+
this.rpId = config.rpId;
|
|
235
|
+
this.allowCredentials = config.allowCredentials && config.allowCredentials.length > 0 ? config.allowCredentials : [{ id: config.credentialId }];
|
|
236
|
+
this.timeoutMs = config.timeoutMs ?? 6e4;
|
|
237
|
+
this.userVerification = config.userVerification ?? "preferred";
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* Run `navigator.credentials.get()` over `challenge` and return the
|
|
241
|
+
* three on-chain-ready buffers.
|
|
242
|
+
*
|
|
243
|
+
* The caller is responsible for what `challenge` *is*. For the vault
|
|
244
|
+
* program, this is typically `sha256(opMessage)` minted server-side
|
|
245
|
+
* with replay defense (see DexterApiBrowserPasskeySigner). The SDK
|
|
246
|
+
* does not impose policy here.
|
|
247
|
+
*/
|
|
248
|
+
async assertOver(challenge) {
|
|
249
|
+
ensureBrowser();
|
|
250
|
+
if (!(challenge instanceof Uint8Array) || challenge.length === 0) {
|
|
251
|
+
throw new WebAuthnAssertionError(
|
|
252
|
+
"invalid_challenge",
|
|
253
|
+
"challenge must be a non-empty Uint8Array"
|
|
254
|
+
);
|
|
255
|
+
}
|
|
256
|
+
const requestOptions = {
|
|
257
|
+
challenge: toBufferSource(challenge),
|
|
258
|
+
allowCredentials: this.allowCredentials.map((c) => ({
|
|
259
|
+
id: toBufferSource(c.id),
|
|
260
|
+
type: "public-key",
|
|
261
|
+
transports: c.transports
|
|
262
|
+
})),
|
|
263
|
+
timeout: this.timeoutMs,
|
|
264
|
+
userVerification: this.userVerification,
|
|
265
|
+
...this.rpId ? { rpId: this.rpId } : {}
|
|
266
|
+
};
|
|
267
|
+
const credential = await navigator.credentials.get({
|
|
268
|
+
publicKey: requestOptions
|
|
269
|
+
});
|
|
270
|
+
if (!credential) {
|
|
271
|
+
throw new WebAuthnAssertionError(
|
|
272
|
+
"user_cancelled",
|
|
273
|
+
"no assertion returned from authenticator"
|
|
274
|
+
);
|
|
275
|
+
}
|
|
276
|
+
if (credential.type !== "public-key") {
|
|
277
|
+
throw new WebAuthnAssertionError(
|
|
278
|
+
"credential_invalid",
|
|
279
|
+
`unexpected credential type: ${credential.type}`
|
|
280
|
+
);
|
|
281
|
+
}
|
|
282
|
+
const assertion = credential.response;
|
|
283
|
+
const derSignature = new Uint8Array(assertion.signature);
|
|
284
|
+
const compactSignature = derSignatureToCompactLowS(derSignature);
|
|
285
|
+
return {
|
|
286
|
+
signature: compactSignature,
|
|
287
|
+
signatureDer: derSignature,
|
|
288
|
+
clientDataJSON: new Uint8Array(assertion.clientDataJSON),
|
|
289
|
+
authenticatorData: new Uint8Array(assertion.authenticatorData)
|
|
290
|
+
};
|
|
291
|
+
}
|
|
292
|
+
/**
|
|
293
|
+
* `PasskeySigner` shape — alias for `assertOver`. Consumers that want
|
|
294
|
+
* to type against `PasskeySigner` (e.g. dexter-fe's
|
|
295
|
+
* `DexterApiBrowserPasskeySigner`) call `.sign(challenge)`; consumers
|
|
296
|
+
* that want the explicit name call `.assertOver(challenge)`. Same
|
|
297
|
+
* function, two names.
|
|
298
|
+
*/
|
|
299
|
+
sign(challenge) {
|
|
300
|
+
return this.assertOver(challenge);
|
|
301
|
+
}
|
|
302
|
+
};
|
|
303
|
+
function ensureBrowser() {
|
|
304
|
+
if (typeof globalThis === "undefined" || typeof globalThis.navigator === "undefined") {
|
|
305
|
+
throw new WebAuthnAssertionError(
|
|
306
|
+
"not_browser",
|
|
307
|
+
"WebAuthnAssertion requires a browser environment (navigator.credentials)"
|
|
308
|
+
);
|
|
309
|
+
}
|
|
310
|
+
const cred = globalThis.navigator.credentials;
|
|
311
|
+
if (!cred || typeof cred.get !== "function") {
|
|
312
|
+
throw new WebAuthnAssertionError(
|
|
313
|
+
"webauthn_unsupported",
|
|
314
|
+
"this environment does not implement navigator.credentials.get"
|
|
315
|
+
);
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
function toBufferSource(bytes) {
|
|
319
|
+
const out = new ArrayBuffer(bytes.length);
|
|
320
|
+
new Uint8Array(out).set(bytes);
|
|
321
|
+
return out;
|
|
322
|
+
}
|
|
323
|
+
var P256_ORDER = BigInt(
|
|
324
|
+
"0xffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551"
|
|
325
|
+
);
|
|
326
|
+
var P256_HALF_ORDER = P256_ORDER >> BigInt(1);
|
|
327
|
+
function bigintFromBytes(buf) {
|
|
328
|
+
let n = 0n;
|
|
329
|
+
for (const byte of buf) n = n << 8n | BigInt(byte);
|
|
330
|
+
return n;
|
|
331
|
+
}
|
|
332
|
+
function bytesFromBigint(n, length) {
|
|
333
|
+
const out = new Uint8Array(length);
|
|
334
|
+
for (let i = length - 1; i >= 0; i -= 1) {
|
|
335
|
+
out[i] = Number(n & 0xffn);
|
|
336
|
+
n >>= 8n;
|
|
337
|
+
}
|
|
338
|
+
return out;
|
|
339
|
+
}
|
|
340
|
+
function derSignatureToCompactLowS(der) {
|
|
341
|
+
let i = 0;
|
|
342
|
+
if (der[i++] !== 48) {
|
|
343
|
+
throw new WebAuthnAssertionError("bad_signature", "expected DER SEQUENCE");
|
|
344
|
+
}
|
|
345
|
+
i++;
|
|
346
|
+
if (der[i++] !== 2) {
|
|
347
|
+
throw new WebAuthnAssertionError("bad_signature", "expected r INTEGER");
|
|
348
|
+
}
|
|
349
|
+
const rLen = der[i++];
|
|
350
|
+
if (rLen === void 0) {
|
|
351
|
+
throw new WebAuthnAssertionError("bad_signature", "truncated DER (no r length)");
|
|
352
|
+
}
|
|
353
|
+
let r = der.slice(i, i + rLen);
|
|
354
|
+
i += rLen;
|
|
355
|
+
if (der[i++] !== 2) {
|
|
356
|
+
throw new WebAuthnAssertionError("bad_signature", "expected s INTEGER");
|
|
357
|
+
}
|
|
358
|
+
const sLen = der[i++];
|
|
359
|
+
if (sLen === void 0) {
|
|
360
|
+
throw new WebAuthnAssertionError("bad_signature", "truncated DER (no s length)");
|
|
361
|
+
}
|
|
362
|
+
let s = der.slice(i, i + sLen);
|
|
363
|
+
i += sLen;
|
|
364
|
+
if (r.length > 32 && r[0] === 0) r = r.slice(1);
|
|
365
|
+
if (s.length > 32 && s[0] === 0) s = s.slice(1);
|
|
366
|
+
if (r.length > 32 || s.length > 32) {
|
|
367
|
+
throw new WebAuthnAssertionError(
|
|
368
|
+
"bad_signature",
|
|
369
|
+
"DER component too large for P-256"
|
|
370
|
+
);
|
|
371
|
+
}
|
|
372
|
+
const rPadded = new Uint8Array(32);
|
|
373
|
+
rPadded.set(r, 32 - r.length);
|
|
374
|
+
let sN = bigintFromBytes(s);
|
|
375
|
+
if (sN > P256_HALF_ORDER) sN = P256_ORDER - sN;
|
|
376
|
+
const sPadded = bytesFromBigint(sN, 32);
|
|
377
|
+
const out = new Uint8Array(64);
|
|
378
|
+
out.set(rPadded, 0);
|
|
379
|
+
out.set(sPadded, 32);
|
|
380
|
+
return out;
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
// src/connect/ceremony.ts
|
|
384
|
+
var SIWX_LOGIN_PREFIX = "siwx_login";
|
|
385
|
+
async function connectTab(args) {
|
|
386
|
+
const challengeBytes = decodeChallengeTo32Bytes(args.challenge);
|
|
387
|
+
const prefix = new TextEncoder().encode(SIWX_LOGIN_PREFIX);
|
|
388
|
+
const opMessage = new Uint8Array(prefix.length + challengeBytes.length);
|
|
389
|
+
opMessage.set(prefix, 0);
|
|
390
|
+
opMessage.set(challengeBytes, prefix.length);
|
|
391
|
+
const signedDigest = await sha256(opMessage);
|
|
392
|
+
const signer = new WebAuthnAssertion({
|
|
393
|
+
credentialId: args.credentialId,
|
|
394
|
+
...args.rpId ? { rpId: args.rpId } : {}
|
|
395
|
+
});
|
|
396
|
+
const assertion = await signer.assertOver(signedDigest);
|
|
397
|
+
return {
|
|
398
|
+
passkeyPubkey: args.passkeyPubkey,
|
|
399
|
+
vault: args.vault,
|
|
400
|
+
clientDataJSON: assertion.clientDataJSON,
|
|
401
|
+
authenticatorData: assertion.authenticatorData,
|
|
402
|
+
signature: assertion.signature
|
|
403
|
+
// 64-byte compact lowS r||s
|
|
404
|
+
};
|
|
405
|
+
}
|
|
406
|
+
async function sha256(data) {
|
|
407
|
+
const subtle = globalThis.crypto?.subtle;
|
|
408
|
+
if (subtle) {
|
|
409
|
+
const buf = await subtle.digest("SHA-256", data);
|
|
410
|
+
return new Uint8Array(buf);
|
|
411
|
+
}
|
|
412
|
+
const { createHash: createHash2 } = await import("crypto");
|
|
413
|
+
return new Uint8Array(createHash2("sha256").update(data).digest());
|
|
414
|
+
}
|
|
415
|
+
export {
|
|
416
|
+
connectTab,
|
|
417
|
+
decodeChallengeTo32Bytes,
|
|
418
|
+
verifyConnectProof
|
|
419
|
+
};
|
package/dist/constants/index.cjs
CHANGED
|
@@ -24,6 +24,7 @@ __export(constants_exports, {
|
|
|
24
24
|
DISCRIMINATORS: () => DISCRIMINATORS,
|
|
25
25
|
ED25519_PROGRAM_ID: () => ED25519_PROGRAM_ID,
|
|
26
26
|
INSTRUCTIONS_SYSVAR_ID: () => INSTRUCTIONS_SYSVAR_ID,
|
|
27
|
+
LOCKED_CLAIM_SEED: () => LOCKED_CLAIM_SEED,
|
|
27
28
|
OTS_SESSION_REGISTER_V1_DOMAIN: () => OTS_SESSION_REGISTER_V1_DOMAIN,
|
|
28
29
|
OTS_SESSION_REGISTER_V2_DOMAIN: () => OTS_SESSION_REGISTER_V2_DOMAIN,
|
|
29
30
|
OTS_SESSION_REVOKE_V1_DOMAIN: () => OTS_SESSION_REVOKE_V1_DOMAIN,
|
|
@@ -53,6 +54,7 @@ var INSTRUCTIONS_SYSVAR_ID = new import_web3.PublicKey(
|
|
|
53
54
|
var USDC_MAINNET = "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v";
|
|
54
55
|
var USDC_DEVNET = "4zMMC9srt5Ri5X14GAgXhaHii3GnPAEERYPJgZJDncDU";
|
|
55
56
|
var VAULT_SEED_PREFIX = Buffer.from("vault");
|
|
57
|
+
var LOCKED_CLAIM_SEED = Buffer.from("locked-claim");
|
|
56
58
|
var DISCRIMINATORS = Object.freeze({
|
|
57
59
|
initialize_vault: Uint8Array.from([48, 191, 163, 44, 71, 129, 63, 164]),
|
|
58
60
|
set_swig: Uint8Array.from([253, 229, 89, 206, 192, 118, 137, 165]),
|
|
@@ -65,7 +67,16 @@ var DISCRIMINATORS = Object.freeze({
|
|
|
65
67
|
prove_passkey: Uint8Array.from([35, 175, 41, 143, 201, 118, 49, 184]),
|
|
66
68
|
settle_tab_voucher: Uint8Array.from([173, 22, 98, 31, 110, 129, 59, 161]),
|
|
67
69
|
register_session_key: Uint8Array.from([69, 94, 60, 44, 49, 199, 183, 233]),
|
|
68
|
-
revoke_session_key: Uint8Array.from([81, 192, 32, 110, 104, 116, 144, 151])
|
|
70
|
+
revoke_session_key: Uint8Array.from([81, 192, 32, 110, 104, 116, 144, 151]),
|
|
71
|
+
lock_voucher: Uint8Array.from([91, 138, 5, 227, 119, 239, 48, 254]),
|
|
72
|
+
settle_locked_voucher: Uint8Array.from([44, 80, 216, 43, 247, 253, 101, 45]),
|
|
73
|
+
transfer_lock_ownership: Uint8Array.from([193, 13, 131, 134, 95, 25, 229, 157]),
|
|
74
|
+
recover_abandoned_lock: Uint8Array.from([169, 213, 107, 64, 229, 49, 43, 234]),
|
|
75
|
+
open_standby: Uint8Array.from([234, 184, 232, 135, 246, 191, 90, 250]),
|
|
76
|
+
draw_credit: Uint8Array.from([20, 84, 47, 211, 78, 117, 195, 210]),
|
|
77
|
+
repay_credit: Uint8Array.from([38, 113, 240, 182, 109, 179, 154, 245]),
|
|
78
|
+
seize_collateral: Uint8Array.from([40, 250, 7, 243, 168, 184, 116, 154]),
|
|
79
|
+
migrate_v4_to_v5: Uint8Array.from([226, 105, 140, 184, 101, 39, 235, 116])
|
|
69
80
|
});
|
|
70
81
|
var OTS_SESSION_REGISTER_V1_DOMAIN = (() => {
|
|
71
82
|
const buf = new Uint8Array(32);
|
|
@@ -88,6 +99,7 @@ var OTS_SESSION_REVOKE_V1_DOMAIN = (() => {
|
|
|
88
99
|
DISCRIMINATORS,
|
|
89
100
|
ED25519_PROGRAM_ID,
|
|
90
101
|
INSTRUCTIONS_SYSVAR_ID,
|
|
102
|
+
LOCKED_CLAIM_SEED,
|
|
91
103
|
OTS_SESSION_REGISTER_V1_DOMAIN,
|
|
92
104
|
OTS_SESSION_REGISTER_V2_DOMAIN,
|
|
93
105
|
OTS_SESSION_REVOKE_V1_DOMAIN,
|
|
@@ -14,6 +14,7 @@ declare const INSTRUCTIONS_SYSVAR_ID: PublicKey;
|
|
|
14
14
|
declare const USDC_MAINNET = "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v";
|
|
15
15
|
declare const USDC_DEVNET = "4zMMC9srt5Ri5X14GAgXhaHii3GnPAEERYPJgZJDncDU";
|
|
16
16
|
declare const VAULT_SEED_PREFIX: Buffer<ArrayBuffer>;
|
|
17
|
+
declare const LOCKED_CLAIM_SEED: Buffer<ArrayBuffer>;
|
|
17
18
|
declare const DISCRIMINATORS: Readonly<{
|
|
18
19
|
initialize_vault: Uint8Array<ArrayBuffer>;
|
|
19
20
|
set_swig: Uint8Array<ArrayBuffer>;
|
|
@@ -27,9 +28,18 @@ declare const DISCRIMINATORS: Readonly<{
|
|
|
27
28
|
settle_tab_voucher: Uint8Array<ArrayBuffer>;
|
|
28
29
|
register_session_key: Uint8Array<ArrayBuffer>;
|
|
29
30
|
revoke_session_key: Uint8Array<ArrayBuffer>;
|
|
31
|
+
lock_voucher: Uint8Array<ArrayBuffer>;
|
|
32
|
+
settle_locked_voucher: Uint8Array<ArrayBuffer>;
|
|
33
|
+
transfer_lock_ownership: Uint8Array<ArrayBuffer>;
|
|
34
|
+
recover_abandoned_lock: Uint8Array<ArrayBuffer>;
|
|
35
|
+
open_standby: Uint8Array<ArrayBuffer>;
|
|
36
|
+
draw_credit: Uint8Array<ArrayBuffer>;
|
|
37
|
+
repay_credit: Uint8Array<ArrayBuffer>;
|
|
38
|
+
seize_collateral: Uint8Array<ArrayBuffer>;
|
|
39
|
+
migrate_v4_to_v5: Uint8Array<ArrayBuffer>;
|
|
30
40
|
}>;
|
|
31
41
|
declare const OTS_SESSION_REGISTER_V1_DOMAIN: Uint8Array;
|
|
32
42
|
declare const OTS_SESSION_REGISTER_V2_DOMAIN: Uint8Array;
|
|
33
43
|
declare const OTS_SESSION_REVOKE_V1_DOMAIN: Uint8Array;
|
|
34
44
|
|
|
35
|
-
export { DEXTER_VAULT_PROGRAM_ID, DISCRIMINATORS, ED25519_PROGRAM_ID, INSTRUCTIONS_SYSVAR_ID, OTS_SESSION_REGISTER_V1_DOMAIN, OTS_SESSION_REGISTER_V2_DOMAIN, OTS_SESSION_REVOKE_V1_DOMAIN, SECP256R1_PROGRAM_ID, SWIG_PROGRAM_ID, USDC_DEVNET, USDC_MAINNET, VAULT_SEED_PREFIX };
|
|
45
|
+
export { DEXTER_VAULT_PROGRAM_ID, DISCRIMINATORS, ED25519_PROGRAM_ID, INSTRUCTIONS_SYSVAR_ID, LOCKED_CLAIM_SEED, OTS_SESSION_REGISTER_V1_DOMAIN, OTS_SESSION_REGISTER_V2_DOMAIN, OTS_SESSION_REVOKE_V1_DOMAIN, SECP256R1_PROGRAM_ID, SWIG_PROGRAM_ID, USDC_DEVNET, USDC_MAINNET, VAULT_SEED_PREFIX };
|
|
@@ -14,6 +14,7 @@ declare const INSTRUCTIONS_SYSVAR_ID: PublicKey;
|
|
|
14
14
|
declare const USDC_MAINNET = "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v";
|
|
15
15
|
declare const USDC_DEVNET = "4zMMC9srt5Ri5X14GAgXhaHii3GnPAEERYPJgZJDncDU";
|
|
16
16
|
declare const VAULT_SEED_PREFIX: Buffer<ArrayBuffer>;
|
|
17
|
+
declare const LOCKED_CLAIM_SEED: Buffer<ArrayBuffer>;
|
|
17
18
|
declare const DISCRIMINATORS: Readonly<{
|
|
18
19
|
initialize_vault: Uint8Array<ArrayBuffer>;
|
|
19
20
|
set_swig: Uint8Array<ArrayBuffer>;
|
|
@@ -27,9 +28,18 @@ declare const DISCRIMINATORS: Readonly<{
|
|
|
27
28
|
settle_tab_voucher: Uint8Array<ArrayBuffer>;
|
|
28
29
|
register_session_key: Uint8Array<ArrayBuffer>;
|
|
29
30
|
revoke_session_key: Uint8Array<ArrayBuffer>;
|
|
31
|
+
lock_voucher: Uint8Array<ArrayBuffer>;
|
|
32
|
+
settle_locked_voucher: Uint8Array<ArrayBuffer>;
|
|
33
|
+
transfer_lock_ownership: Uint8Array<ArrayBuffer>;
|
|
34
|
+
recover_abandoned_lock: Uint8Array<ArrayBuffer>;
|
|
35
|
+
open_standby: Uint8Array<ArrayBuffer>;
|
|
36
|
+
draw_credit: Uint8Array<ArrayBuffer>;
|
|
37
|
+
repay_credit: Uint8Array<ArrayBuffer>;
|
|
38
|
+
seize_collateral: Uint8Array<ArrayBuffer>;
|
|
39
|
+
migrate_v4_to_v5: Uint8Array<ArrayBuffer>;
|
|
30
40
|
}>;
|
|
31
41
|
declare const OTS_SESSION_REGISTER_V1_DOMAIN: Uint8Array;
|
|
32
42
|
declare const OTS_SESSION_REGISTER_V2_DOMAIN: Uint8Array;
|
|
33
43
|
declare const OTS_SESSION_REVOKE_V1_DOMAIN: Uint8Array;
|
|
34
44
|
|
|
35
|
-
export { DEXTER_VAULT_PROGRAM_ID, DISCRIMINATORS, ED25519_PROGRAM_ID, INSTRUCTIONS_SYSVAR_ID, OTS_SESSION_REGISTER_V1_DOMAIN, OTS_SESSION_REGISTER_V2_DOMAIN, OTS_SESSION_REVOKE_V1_DOMAIN, SECP256R1_PROGRAM_ID, SWIG_PROGRAM_ID, USDC_DEVNET, USDC_MAINNET, VAULT_SEED_PREFIX };
|
|
45
|
+
export { DEXTER_VAULT_PROGRAM_ID, DISCRIMINATORS, ED25519_PROGRAM_ID, INSTRUCTIONS_SYSVAR_ID, LOCKED_CLAIM_SEED, OTS_SESSION_REGISTER_V1_DOMAIN, OTS_SESSION_REGISTER_V2_DOMAIN, OTS_SESSION_REVOKE_V1_DOMAIN, SECP256R1_PROGRAM_ID, SWIG_PROGRAM_ID, USDC_DEVNET, USDC_MAINNET, VAULT_SEED_PREFIX };
|
package/dist/constants/index.js
CHANGED
|
@@ -18,6 +18,7 @@ var INSTRUCTIONS_SYSVAR_ID = new PublicKey(
|
|
|
18
18
|
var USDC_MAINNET = "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v";
|
|
19
19
|
var USDC_DEVNET = "4zMMC9srt5Ri5X14GAgXhaHii3GnPAEERYPJgZJDncDU";
|
|
20
20
|
var VAULT_SEED_PREFIX = Buffer.from("vault");
|
|
21
|
+
var LOCKED_CLAIM_SEED = Buffer.from("locked-claim");
|
|
21
22
|
var DISCRIMINATORS = Object.freeze({
|
|
22
23
|
initialize_vault: Uint8Array.from([48, 191, 163, 44, 71, 129, 63, 164]),
|
|
23
24
|
set_swig: Uint8Array.from([253, 229, 89, 206, 192, 118, 137, 165]),
|
|
@@ -30,7 +31,16 @@ var DISCRIMINATORS = Object.freeze({
|
|
|
30
31
|
prove_passkey: Uint8Array.from([35, 175, 41, 143, 201, 118, 49, 184]),
|
|
31
32
|
settle_tab_voucher: Uint8Array.from([173, 22, 98, 31, 110, 129, 59, 161]),
|
|
32
33
|
register_session_key: Uint8Array.from([69, 94, 60, 44, 49, 199, 183, 233]),
|
|
33
|
-
revoke_session_key: Uint8Array.from([81, 192, 32, 110, 104, 116, 144, 151])
|
|
34
|
+
revoke_session_key: Uint8Array.from([81, 192, 32, 110, 104, 116, 144, 151]),
|
|
35
|
+
lock_voucher: Uint8Array.from([91, 138, 5, 227, 119, 239, 48, 254]),
|
|
36
|
+
settle_locked_voucher: Uint8Array.from([44, 80, 216, 43, 247, 253, 101, 45]),
|
|
37
|
+
transfer_lock_ownership: Uint8Array.from([193, 13, 131, 134, 95, 25, 229, 157]),
|
|
38
|
+
recover_abandoned_lock: Uint8Array.from([169, 213, 107, 64, 229, 49, 43, 234]),
|
|
39
|
+
open_standby: Uint8Array.from([234, 184, 232, 135, 246, 191, 90, 250]),
|
|
40
|
+
draw_credit: Uint8Array.from([20, 84, 47, 211, 78, 117, 195, 210]),
|
|
41
|
+
repay_credit: Uint8Array.from([38, 113, 240, 182, 109, 179, 154, 245]),
|
|
42
|
+
seize_collateral: Uint8Array.from([40, 250, 7, 243, 168, 184, 116, 154]),
|
|
43
|
+
migrate_v4_to_v5: Uint8Array.from([226, 105, 140, 184, 101, 39, 235, 116])
|
|
34
44
|
});
|
|
35
45
|
var OTS_SESSION_REGISTER_V1_DOMAIN = (() => {
|
|
36
46
|
const buf = new Uint8Array(32);
|
|
@@ -52,6 +62,7 @@ export {
|
|
|
52
62
|
DISCRIMINATORS,
|
|
53
63
|
ED25519_PROGRAM_ID,
|
|
54
64
|
INSTRUCTIONS_SYSVAR_ID,
|
|
65
|
+
LOCKED_CLAIM_SEED,
|
|
55
66
|
OTS_SESSION_REGISTER_V1_DOMAIN,
|
|
56
67
|
OTS_SESSION_REGISTER_V2_DOMAIN,
|
|
57
68
|
OTS_SESSION_REVOKE_V1_DOMAIN,
|
package/dist/counterfactual.cjs
CHANGED
|
@@ -39,6 +39,7 @@ var import_lib2 = require("@swig-wallet/lib");
|
|
|
39
39
|
var import_node_crypto = require("crypto");
|
|
40
40
|
var import_kit = require("@swig-wallet/kit");
|
|
41
41
|
var import_lib = require("@swig-wallet/lib");
|
|
42
|
+
var import_kit2 = require("@solana/kit");
|
|
42
43
|
var bs58Module = __toESM(require("bs58"), 1);
|
|
43
44
|
var import_web32 = require("@solana/web3.js");
|
|
44
45
|
|
|
@@ -60,6 +61,7 @@ var INSTRUCTIONS_SYSVAR_ID = new import_web3.PublicKey(
|
|
|
60
61
|
"Sysvar1nstructions1111111111111111111111111"
|
|
61
62
|
);
|
|
62
63
|
var VAULT_SEED_PREFIX = Buffer.from("vault");
|
|
64
|
+
var LOCKED_CLAIM_SEED = Buffer.from("locked-claim");
|
|
63
65
|
var DISCRIMINATORS = Object.freeze({
|
|
64
66
|
initialize_vault: Uint8Array.from([48, 191, 163, 44, 71, 129, 63, 164]),
|
|
65
67
|
set_swig: Uint8Array.from([253, 229, 89, 206, 192, 118, 137, 165]),
|
|
@@ -72,7 +74,16 @@ var DISCRIMINATORS = Object.freeze({
|
|
|
72
74
|
prove_passkey: Uint8Array.from([35, 175, 41, 143, 201, 118, 49, 184]),
|
|
73
75
|
settle_tab_voucher: Uint8Array.from([173, 22, 98, 31, 110, 129, 59, 161]),
|
|
74
76
|
register_session_key: Uint8Array.from([69, 94, 60, 44, 49, 199, 183, 233]),
|
|
75
|
-
revoke_session_key: Uint8Array.from([81, 192, 32, 110, 104, 116, 144, 151])
|
|
77
|
+
revoke_session_key: Uint8Array.from([81, 192, 32, 110, 104, 116, 144, 151]),
|
|
78
|
+
lock_voucher: Uint8Array.from([91, 138, 5, 227, 119, 239, 48, 254]),
|
|
79
|
+
settle_locked_voucher: Uint8Array.from([44, 80, 216, 43, 247, 253, 101, 45]),
|
|
80
|
+
transfer_lock_ownership: Uint8Array.from([193, 13, 131, 134, 95, 25, 229, 157]),
|
|
81
|
+
recover_abandoned_lock: Uint8Array.from([169, 213, 107, 64, 229, 49, 43, 234]),
|
|
82
|
+
open_standby: Uint8Array.from([234, 184, 232, 135, 246, 191, 90, 250]),
|
|
83
|
+
draw_credit: Uint8Array.from([20, 84, 47, 211, 78, 117, 195, 210]),
|
|
84
|
+
repay_credit: Uint8Array.from([38, 113, 240, 182, 109, 179, 154, 245]),
|
|
85
|
+
seize_collateral: Uint8Array.from([40, 250, 7, 243, 168, 184, 116, 154]),
|
|
86
|
+
migrate_v4_to_v5: Uint8Array.from([226, 105, 140, 184, 101, 39, 235, 116])
|
|
76
87
|
});
|
|
77
88
|
var OTS_SESSION_REGISTER_V1_DOMAIN = (() => {
|
|
78
89
|
const buf = new Uint8Array(32);
|
package/dist/counterfactual.js
CHANGED
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
createEd25519SessionAuthorityInfo,
|
|
16
16
|
getCreateSwigWithMultipleAuthoritiesInstructionContextBuilder
|
|
17
17
|
} from "@swig-wallet/lib";
|
|
18
|
+
import { address, createSolanaRpc } from "@solana/kit";
|
|
18
19
|
import * as bs58Module from "bs58";
|
|
19
20
|
import { PublicKey as PublicKey2 } from "@solana/web3.js";
|
|
20
21
|
|
|
@@ -36,6 +37,7 @@ var INSTRUCTIONS_SYSVAR_ID = new PublicKey(
|
|
|
36
37
|
"Sysvar1nstructions1111111111111111111111111"
|
|
37
38
|
);
|
|
38
39
|
var VAULT_SEED_PREFIX = Buffer.from("vault");
|
|
40
|
+
var LOCKED_CLAIM_SEED = Buffer.from("locked-claim");
|
|
39
41
|
var DISCRIMINATORS = Object.freeze({
|
|
40
42
|
initialize_vault: Uint8Array.from([48, 191, 163, 44, 71, 129, 63, 164]),
|
|
41
43
|
set_swig: Uint8Array.from([253, 229, 89, 206, 192, 118, 137, 165]),
|
|
@@ -48,7 +50,16 @@ var DISCRIMINATORS = Object.freeze({
|
|
|
48
50
|
prove_passkey: Uint8Array.from([35, 175, 41, 143, 201, 118, 49, 184]),
|
|
49
51
|
settle_tab_voucher: Uint8Array.from([173, 22, 98, 31, 110, 129, 59, 161]),
|
|
50
52
|
register_session_key: Uint8Array.from([69, 94, 60, 44, 49, 199, 183, 233]),
|
|
51
|
-
revoke_session_key: Uint8Array.from([81, 192, 32, 110, 104, 116, 144, 151])
|
|
53
|
+
revoke_session_key: Uint8Array.from([81, 192, 32, 110, 104, 116, 144, 151]),
|
|
54
|
+
lock_voucher: Uint8Array.from([91, 138, 5, 227, 119, 239, 48, 254]),
|
|
55
|
+
settle_locked_voucher: Uint8Array.from([44, 80, 216, 43, 247, 253, 101, 45]),
|
|
56
|
+
transfer_lock_ownership: Uint8Array.from([193, 13, 131, 134, 95, 25, 229, 157]),
|
|
57
|
+
recover_abandoned_lock: Uint8Array.from([169, 213, 107, 64, 229, 49, 43, 234]),
|
|
58
|
+
open_standby: Uint8Array.from([234, 184, 232, 135, 246, 191, 90, 250]),
|
|
59
|
+
draw_credit: Uint8Array.from([20, 84, 47, 211, 78, 117, 195, 210]),
|
|
60
|
+
repay_credit: Uint8Array.from([38, 113, 240, 182, 109, 179, 154, 245]),
|
|
61
|
+
seize_collateral: Uint8Array.from([40, 250, 7, 243, 168, 184, 116, 154]),
|
|
62
|
+
migrate_v4_to_v5: Uint8Array.from([226, 105, 140, 184, 101, 39, 235, 116])
|
|
52
63
|
});
|
|
53
64
|
var OTS_SESSION_REGISTER_V1_DOMAIN = (() => {
|
|
54
65
|
const buf = new Uint8Array(32);
|