@p2pdotme/sdk 1.2.6 → 1.2.8

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/react.cjs CHANGED
@@ -368,8 +368,9 @@ function cleanupSeonStorage() {
368
368
  // src/fraud-engine/signing.ts
369
369
  async function getSignedHeaders(signer, action) {
370
370
  const signingAddress = (signer.signerAddress ?? signer.address).toLowerCase();
371
+ const subjectAddress = signer.address.toLowerCase();
371
372
  const timestamp = Math.floor(Date.now() / 1e3).toString();
372
- const message = `${action}:${signingAddress}:${timestamp}`;
373
+ const message = `${action}:${signingAddress}:${subjectAddress}:${timestamp}`;
373
374
  try {
374
375
  const signature = await signer.signMessage(message);
375
376
  return {
@@ -1497,6 +1498,38 @@ var reputationManagerAbi = [
1497
1498
  outputs: [{ internalType: "bool", name: "", type: "bool" }],
1498
1499
  stateMutability: "view",
1499
1500
  type: "function"
1501
+ },
1502
+ // ── BVN (Nigerian Bank Verification Number) attestation ─────────────────
1503
+ { inputs: [], name: "BvnSignerNotSet", type: "error" },
1504
+ { inputs: [], name: "BvnAttestationExpired", type: "error" },
1505
+ { inputs: [], name: "BvnNullifierAlreadySpent", type: "error" },
1506
+ { inputs: [], name: "BvnAlreadyVerified", type: "error" },
1507
+ { inputs: [], name: "BvnInvalidSignature", type: "error" },
1508
+ {
1509
+ inputs: [
1510
+ { internalType: "bytes32", name: "nullifier", type: "bytes32" },
1511
+ { internalType: "uint256", name: "limit", type: "uint256" },
1512
+ { internalType: "uint256", name: "expiry", type: "uint256" },
1513
+ { internalType: "bytes", name: "signature", type: "bytes" }
1514
+ ],
1515
+ name: "submitBvnAttestation",
1516
+ outputs: [],
1517
+ stateMutability: "nonpayable",
1518
+ type: "function"
1519
+ },
1520
+ {
1521
+ inputs: [],
1522
+ name: "bvnRp",
1523
+ outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
1524
+ stateMutability: "view",
1525
+ type: "function"
1526
+ },
1527
+ {
1528
+ inputs: [{ internalType: "address", name: "", type: "address" }],
1529
+ name: "bvnVerified",
1530
+ outputs: [{ internalType: "bool", name: "", type: "bool" }],
1531
+ stateMutability: "view",
1532
+ type: "function"
1500
1533
  }
1501
1534
  ];
1502
1535
 
@@ -5842,6 +5875,20 @@ var ZodSimpleKycSubmitParamsSchema = import_zod9.z.object({
5842
5875
  message: "signature must be a hex string"
5843
5876
  })
5844
5877
  });
5878
+ var ZodBvnSubmitParamsSchema = import_zod9.z.object({
5879
+ /** Per-(tenant, identity) Sybil nullifier (bytes32 hex). */
5880
+ nullifier: import_zod9.z.string().refine((v) => /^0x[a-fA-F0-9]{64}$/.test(v), {
5881
+ message: "nullifier must be a bytes32 hex string"
5882
+ }),
5883
+ /** Remaining limit in micro-USDC (part of the signed struct). */
5884
+ limit: import_zod9.z.bigint(),
5885
+ /** Attestation expiry (unix seconds). */
5886
+ expiry: import_zod9.z.bigint(),
5887
+ /** 65-byte secp256k1 signature (hex). */
5888
+ signature: import_zod9.z.string().refine((v) => /^0x[a-fA-F0-9]+$/.test(v), {
5889
+ message: "signature must be a hex string"
5890
+ })
5891
+ });
5845
5892
 
5846
5893
  // src/contracts/reputation-manager/writes.ts
5847
5894
  function prepareSocialVerify(reputationManagerAddress, params) {
@@ -5935,6 +5982,33 @@ function prepareSubmitKycAttestation(reputationManagerAddress, params) {
5935
5982
  )()
5936
5983
  );
5937
5984
  }
5985
+ function prepareSubmitBvnAttestation(reputationManagerAddress, params) {
5986
+ return validate(
5987
+ ZodBvnSubmitParamsSchema,
5988
+ params,
5989
+ (message, cause, data) => new ZkkycError(message, { code: "VALIDATION_ERROR", cause, context: { params: data } })
5990
+ ).andThen(
5991
+ (validated) => import_neverthrow12.Result.fromThrowable(
5992
+ () => ({
5993
+ to: reputationManagerAddress,
5994
+ data: (0, import_viem14.encodeFunctionData)({
5995
+ abi: ABIS.EXTERNAL.REPUTATION_MANAGER,
5996
+ functionName: "submitBvnAttestation",
5997
+ args: [
5998
+ validated.nullifier,
5999
+ validated.limit,
6000
+ validated.expiry,
6001
+ validated.signature
6002
+ ]
6003
+ })
6004
+ }),
6005
+ (error) => new ZkkycError("Failed to encode submitBvnAttestation", {
6006
+ code: "ENCODE_ERROR",
6007
+ cause: error
6008
+ })
6009
+ )()
6010
+ );
6011
+ }
5938
6012
  function prepareZkPassportRegister(reputationManagerAddress, params) {
5939
6013
  return validate(
5940
6014
  ZodZkPassportRegisterParamsSchema,
@@ -7027,7 +7101,8 @@ function createZkkyc(config) {
7027
7101
  prepareSocialVerify: (params) => prepareSocialVerify(reputationManagerAddress, params),
7028
7102
  prepareSubmitAnonAadharProof: (params) => prepareSubmitAnonAadharProof(reputationManagerAddress, params),
7029
7103
  prepareZkPassportRegister: (params) => prepareZkPassportRegister(reputationManagerAddress, params),
7030
- prepareSubmitKycAttestation: (params) => prepareSubmitKycAttestation(reputationManagerAddress, params)
7104
+ prepareSubmitKycAttestation: (params) => prepareSubmitKycAttestation(reputationManagerAddress, params),
7105
+ prepareSubmitBvnAttestation: (params) => prepareSubmitBvnAttestation(reputationManagerAddress, params)
7031
7106
  };
7032
7107
  }
7033
7108