@auditable/privacy-pool-zk-sdk 0.6.1-rc.5 → 0.7.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/cli.js +2 -0
- package/dist/cli.js.map +1 -1
- package/dist/index.mjs +24 -2
- package/dist/index.mjs.map +1 -1
- package/dist/kyt-flow.d.ts +7 -0
- package/dist/kyt-passage.d.ts +2 -1
- package/package.json +1 -1
- package/pkg/client_sdk_wasm_bg.wasm +0 -0
package/dist/index.mjs
CHANGED
|
@@ -2803,6 +2803,11 @@ function appendU32BE(parts, value) {
|
|
|
2803
2803
|
buf.writeUInt32BE(value >>> 0);
|
|
2804
2804
|
parts.push(buf);
|
|
2805
2805
|
}
|
|
2806
|
+
function appendU64BE(parts, value) {
|
|
2807
|
+
const buf = Buffer.alloc(8);
|
|
2808
|
+
buf.writeBigUInt64BE(BigInt(value));
|
|
2809
|
+
parts.push(buf);
|
|
2810
|
+
}
|
|
2806
2811
|
function appendU128BE(parts, value) {
|
|
2807
2812
|
const buf = Buffer.alloc(16);
|
|
2808
2813
|
buf.writeBigUInt64BE(value >> 64n, 0);
|
|
@@ -2896,10 +2901,11 @@ function hashPublicLegContext(layout, input) {
|
|
|
2896
2901
|
function hashOnboarding(onboarding) {
|
|
2897
2902
|
return hashOnboardingCanonical(onboarding);
|
|
2898
2903
|
}
|
|
2899
|
-
function derivePassageId(owner, publicSignalHash, publicLegContextHash, onboardingHash) {
|
|
2904
|
+
function derivePassageId(owner, nonce, publicSignalHash, publicLegContextHash, onboardingHash) {
|
|
2900
2905
|
const parts = [];
|
|
2901
2906
|
appendBytes(parts, Buffer.from(PASSAGE_ID_DOMAIN, 'utf8'));
|
|
2902
2907
|
appendAddressStrkey(parts, owner);
|
|
2908
|
+
appendU64BE(parts, nonce);
|
|
2903
2909
|
appendBytes32(parts, publicSignalHash);
|
|
2904
2910
|
appendBytes32(parts, publicLegContextHash);
|
|
2905
2911
|
appendBytes32(parts, onboardingHash);
|
|
@@ -2923,10 +2929,11 @@ function buildKytPassageAuthorization(input) {
|
|
|
2923
2929
|
}
|
|
2924
2930
|
function derivePassageFromTransactContext(input) {
|
|
2925
2931
|
const layout = input.layout ?? { publicNInputs: 1, publicNOutputs: 1 };
|
|
2932
|
+
const nonce = input.nonce ?? 0n;
|
|
2926
2933
|
const publicSignalHash = hashPublicSignalBytes(input.publicSignalsBytes);
|
|
2927
2934
|
const publicLegContextHash = hashPublicLegContext(layout, input.publicLegContext);
|
|
2928
2935
|
const onboardingHash = hashOnboarding(input.onboarding ?? null);
|
|
2929
|
-
const passageId = derivePassageId(input.owner, publicSignalHash, publicLegContextHash, onboardingHash);
|
|
2936
|
+
const passageId = derivePassageId(input.owner, nonce, publicSignalHash, publicLegContextHash, onboardingHash);
|
|
2930
2937
|
return {
|
|
2931
2938
|
publicSignalHash,
|
|
2932
2939
|
publicLegContextHash,
|
|
@@ -2983,6 +2990,15 @@ function passageIdHexToScVal(passageIdHex) {
|
|
|
2983
2990
|
function signatureToScVal(signature) {
|
|
2984
2991
|
return xdr.ScVal.scvBytes(signature);
|
|
2985
2992
|
}
|
|
2993
|
+
function kytAuthorizationOptionToScVal(authorization) {
|
|
2994
|
+
if (authorization === null || authorization === undefined) {
|
|
2995
|
+
return xdr.ScVal.scvVoid();
|
|
2996
|
+
}
|
|
2997
|
+
return nativeToScVal({
|
|
2998
|
+
expiration_ledger: authorization.expirationLedger,
|
|
2999
|
+
signature: authorization.signature,
|
|
3000
|
+
});
|
|
3001
|
+
}
|
|
2986
3002
|
function registerPassageOperation(kytRegistryId, passageId, expiresAtLedger, signature) {
|
|
2987
3003
|
return Operation.invokeContractFunction({
|
|
2988
3004
|
contract: kytRegistryId,
|
|
@@ -3000,9 +3016,11 @@ function poolTransactOperation(params) {
|
|
|
3000
3016
|
function: 'transact',
|
|
3001
3017
|
args: [
|
|
3002
3018
|
addressToScVal(params.owner),
|
|
3019
|
+
nativeToScVal(params.nonce, { type: 'u64' }),
|
|
3003
3020
|
xdr.ScVal.scvBytes(params.proofBytes),
|
|
3004
3021
|
xdr.ScVal.scvBytes(params.publicSignalsBytes),
|
|
3005
3022
|
onboardingOptionToScVal(params.onboarding),
|
|
3023
|
+
kytAuthorizationOptionToScVal(params.kytAuthorization),
|
|
3006
3024
|
],
|
|
3007
3025
|
});
|
|
3008
3026
|
}
|
|
@@ -3012,6 +3030,7 @@ function helperSubmitWithPassageOperation(helperContractId, params, passageId, e
|
|
|
3012
3030
|
function: 'submit_with_passage',
|
|
3013
3031
|
args: [
|
|
3014
3032
|
addressToScVal(params.owner),
|
|
3033
|
+
nativeToScVal(params.nonce, { type: 'u64' }),
|
|
3015
3034
|
xdr.ScVal.scvBytes(params.proofBytes),
|
|
3016
3035
|
xdr.ScVal.scvBytes(params.publicSignalsBytes),
|
|
3017
3036
|
onboardingOptionToScVal(params.onboarding),
|
|
@@ -3144,6 +3163,7 @@ function planKytSubmit(registerFirst, helperAvailable = false) {
|
|
|
3144
3163
|
async function registerKytPassage(params) {
|
|
3145
3164
|
const derivation = derivePassageFromTransactContext({
|
|
3146
3165
|
owner: params.owner,
|
|
3166
|
+
nonce: params.nonce,
|
|
3147
3167
|
publicSignalsBytes: params.publicSignalsBytes,
|
|
3148
3168
|
publicLegContext: params.publicLegContext,
|
|
3149
3169
|
onboarding: params.onboarding,
|
|
@@ -3193,6 +3213,7 @@ async function submitWithKytPassage(params) {
|
|
|
3193
3213
|
const approved = await inspect(params.inspectRequest);
|
|
3194
3214
|
const derivation = derivePassageFromTransactContext({
|
|
3195
3215
|
owner: params.owner,
|
|
3216
|
+
nonce: params.nonce,
|
|
3196
3217
|
publicSignalsBytes: params.publicSignalsBytes,
|
|
3197
3218
|
publicLegContext: params.publicLegContext,
|
|
3198
3219
|
onboarding: params.onboarding,
|
|
@@ -3207,6 +3228,7 @@ async function submitWithKytPassage(params) {
|
|
|
3207
3228
|
rpcUrl: params.rpcUrl,
|
|
3208
3229
|
poolContract: params.poolContract,
|
|
3209
3230
|
owner: params.owner,
|
|
3231
|
+
nonce: params.nonce,
|
|
3210
3232
|
proofBytes: params.proofBytes,
|
|
3211
3233
|
publicSignalsBytes: params.publicSignalsBytes,
|
|
3212
3234
|
onboarding: params.onboarding,
|