-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: fetch BIP-353 with DNSSEC prover (#700)
- Loading branch information
1 parent
7703f36
commit e1991a6
Showing
15 changed files
with
629 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
[submodule "regtest"] | ||
path = regtest | ||
url = https://github.com/BoltzExchange/regtest.git | ||
[submodule "dnssec-prover"] | ||
path = dnssec-prover | ||
url = https://git.bitcoin.ninja/dnssec-prover |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
src/utils/dnssec/dnssec* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#! /bin/python3 | ||
|
||
import os | ||
import shutil | ||
from pathlib import Path | ||
|
||
def build(): | ||
target_dir = Path(os.path.dirname(__file__)).joinpath("src/utils/dnssec") | ||
|
||
build_dir = Path(os.path.dirname(__file__)).joinpath("dnssec-prover/wasmpack") | ||
os.chdir(build_dir) | ||
os.system("wasm-pack build --target web --release && rm Cargo.lock && rm -r target/") | ||
|
||
os.chdir(os.path.dirname(__file__)) | ||
os.makedirs(target_dir, exist_ok=True) | ||
|
||
for base, _, files in os.walk(build_dir.joinpath("pkg")): | ||
for file in files: | ||
if file in ["package.json", ".gitignore"]: | ||
continue | ||
|
||
shutil.copy2( | ||
Path(base).joinpath(file), | ||
Path(target_dir).joinpath(file) | ||
) | ||
|
||
build() |
Submodule dnssec-prover
added at
c4e06c
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# DNSSEC prover | ||
|
||
## Copyright | ||
|
||
Compiled artifacts of https://git.bitcoin.ninja/dnssec-prover which was created | ||
by Matt Corallo and is licensed under the MIT or Apache 2.0 open source | ||
licenses. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
/* tslint:disable */ | ||
/* eslint-disable */ | ||
/** | ||
* Builds a proof builder which can generate a proof for records of the given `ty`pe at the given | ||
* `name`. | ||
* | ||
* After calling this [`get_next_query`] should be called to fetch the initial query. | ||
* @param {string} name | ||
* @param {number} ty | ||
* @returns {WASMProofBuilder | undefined} | ||
*/ | ||
export function init_proof_builder(name: string, ty: number): WASMProofBuilder | undefined; | ||
/** | ||
* Processes a response to a query previously fetched from [`get_next_query`]. | ||
* | ||
* After calling this, [`get_next_query`] should be called until pending queries are exhausted and | ||
* no more pending queries exist, at which point [`get_unverified_proof`] should be called. | ||
* @param {WASMProofBuilder} proof_builder | ||
* @param {Uint8Array} response | ||
*/ | ||
export function process_query_response(proof_builder: WASMProofBuilder, response: Uint8Array): void; | ||
/** | ||
* Gets the next query (if any) that should be sent to the resolver for the given proof builder. | ||
* | ||
* Once the resolver responds [`process_query_response`] should be called with the response. | ||
* @param {WASMProofBuilder} proof_builder | ||
* @returns {Uint8Array | undefined} | ||
*/ | ||
export function get_next_query(proof_builder: WASMProofBuilder): Uint8Array | undefined; | ||
/** | ||
* Gets the final, unverified, proof once all queries fetched via [`get_next_query`] have | ||
* completed and their responses passed to [`process_query_response`]. | ||
* @param {WASMProofBuilder} proof_builder | ||
* @returns {Uint8Array} | ||
*/ | ||
export function get_unverified_proof(proof_builder: WASMProofBuilder): Uint8Array; | ||
/** | ||
* Verifies an RFC 9102-formatted proof and returns verified records matching the given name | ||
* (resolving any C/DNAMEs as required). | ||
* @param {Uint8Array} stream | ||
* @param {string} name_to_resolve | ||
* @returns {string} | ||
*/ | ||
export function verify_byte_stream(stream: Uint8Array, name_to_resolve: string): string; | ||
export class WASMProofBuilder { | ||
free(): void; | ||
} | ||
|
||
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module; | ||
|
||
export interface InitOutput { | ||
readonly memory: WebAssembly.Memory; | ||
readonly __wbg_wasmproofbuilder_free: (a: number, b: number) => void; | ||
readonly init_proof_builder: (a: number, b: number, c: number) => number; | ||
readonly process_query_response: (a: number, b: number, c: number) => void; | ||
readonly get_next_query: (a: number) => Array; | ||
readonly get_unverified_proof: (a: number) => Array; | ||
readonly verify_byte_stream: (a: number, b: number, c: number, d: number) => Array; | ||
readonly __wbindgen_export_0: WebAssembly.Table; | ||
readonly __wbindgen_malloc: (a: number, b: number) => number; | ||
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number; | ||
readonly __wbindgen_free: (a: number, b: number, c: number) => void; | ||
readonly __externref_table_dealloc: (a: number) => void; | ||
readonly __wbindgen_start: () => void; | ||
} | ||
|
||
export type SyncInitInput = BufferSource | WebAssembly.Module; | ||
/** | ||
* Instantiates the given `module`, which can either be bytes or | ||
* a precompiled `WebAssembly.Module`. | ||
* | ||
* @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated. | ||
* | ||
* @returns {InitOutput} | ||
*/ | ||
export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput; | ||
|
||
/** | ||
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and | ||
* for everything else, calls `WebAssembly.instantiate` directly. | ||
* | ||
* @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated. | ||
* | ||
* @returns {Promise<InitOutput>} | ||
*/ | ||
export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>; |
Oops, something went wrong.