hyli-noir 0.2.2 → 0.2.4

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.
@@ -1,6 +1,6 @@
1
1
  import { Fr } from "@aztec/bb.js";
2
2
  import { CompiledCircuit } from "@noir-lang/noir_js";
3
- import { Blob } from "hyli";
3
+ import { Blob, NodeApiHttpClient } from "hyli";
4
4
  export declare const contract_name = "check_jwt";
5
5
  /**
6
6
  * Generates a cryptographic proof for a transaction using a JWT circuit.
@@ -44,26 +44,14 @@ export declare const extract_jwt_claims: (jwt: string) => {
44
44
  kid: string;
45
45
  };
46
46
  /**
47
- * Builds a blob representing a JWT, used for proof generation in the circuit.
47
+ * Registers the Noir contract with the node if it is not already registered.
48
+ * The contract is identified by its name "check_secret".
49
+ * If the contract is not found, it registers the contract using the provided circuit.
48
50
  *
49
- * @param {Uint8Array} mail_hash - The hashed email value.
50
- * @param {string} nonce - The nonce value from the JWT.
51
- * @param {string} pubkey - The public key (base64url encoded).
52
- * @returns {Blob} A structured Blob object containing the JWT data.
51
+ * @param node - The NodeApiHttpClient instance to interact with the NodeApiHttpClient
52
+ * @returns A Promise that resolves when the contract is registered
53
53
  */
54
- export declare const build_blob: (mail_hash: Uint8Array, nonce: string, pubkey: string) => Blob;
55
- /**
56
- * Builds a blob to register the check_jwt contract.
57
- *
58
- * @param {CompiledCircuit} circuit - The compiled circuit to execute (defaults to check-jwt).
59
- * @param {Uint8Array} circuit - The hashed email value.
60
- */
61
- export declare const build_register_contract: (circuit?: CompiledCircuit) => Promise<{
62
- verifier: string;
63
- program_id: number[];
64
- state_commitment: number[];
65
- contract_name: string;
66
- }>;
54
+ export declare const register_contract: (node: NodeApiHttpClient, circuit?: CompiledCircuit) => Promise<undefined | number[]>;
67
55
  /**
68
56
  * Computes the Poseidon2 hash of a string.
69
57
  *
@@ -71,3 +59,23 @@ export declare const build_register_contract: (circuit?: CompiledCircuit) => Pro
71
59
  * @returns {Promise<Fr>} The Poseidon2 hash result.
72
60
  */
73
61
  export declare const poseidon_hash: (string: string) => Promise<Fr>;
62
+ export declare const build_blob_from_jwt: <T extends {
63
+ kid: string;
64
+ } & JsonWebKey>(jwt: string, keys: T[]) => Promise<{
65
+ blob: Blob;
66
+ nonce: number;
67
+ mail_hash: number[];
68
+ pubkey: string;
69
+ }>;
70
+ /**
71
+ * Builds a blob representing a JWT, used for proof generation in the circuit.
72
+ *
73
+ * @param {Uint8Array} email - The hashed email value.
74
+ * @param {string} nonce - The nonce value from the JWT.
75
+ * @param {string} pubkey - The public key (base64url encoded).
76
+ * @returns {Blob} A structured Blob object containing the JWT data.
77
+ */
78
+ export declare const build_stored_hash: (email: string, nonce: number, pubkey: string) => Promise<{
79
+ mail_hash: number[];
80
+ stored_hash: number[];
81
+ }>;