feat: alpha.12

This commit is contained in:
Codetrauma
2025-06-26 17:37:18 +01:00
parent 1519fafa09
commit d17948131a
17 changed files with 309 additions and 279 deletions

View File

@@ -9,7 +9,7 @@ COPY . .
RUN apt-get update && apt-get install -y curl && apt-get install netcat-openbsd -y
RUN curl --proto '=https' --tlsv1.2 https://sh.rustup.rs -sSf | sh -s -- -y
RUN npm install
RUN npm i --prefix rs/0.1.0-alpha.11/
RUN npm i --prefix rs/0.1.0-alpha.12/
RUN npm run build
EXPOSE ${PORT}

516
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -53,7 +53,7 @@
"redux-thunk": "^2.4.2",
"stream-browserify": "^3.0.0",
"tailwindcss": "^3.4.13",
"tlsn-js": "^0.1.0-alpha.11.0"
"tlsn-js": "^0.1.0-alpha.12.0"
},
"devDependencies": {
"@babel/core": "^7.25.2",

Binary file not shown.

File diff suppressed because one or more lines are too long

View File

@@ -942,8 +942,8 @@ dependencies = [
[[package]]
name = "tlsn-core"
version = "0.1.0-alpha.11"
source = "git+https://github.com/tlsnotary/tlsn.git?tag=v0.1.0-alpha.11#878fe7e87d6d3306b283148abecc5bc19e04579b"
version = "0.1.0-alpha.12"
source = "git+https://github.com/tlsnotary/tlsn.git?tag=v0.1.0-alpha.12#f2ff4ba79245ea641c485ce11efb2cb574292abb"
dependencies = [
"bcs",
"bimap",
@@ -969,8 +969,8 @@ dependencies = [
[[package]]
name = "tlsn-tls-core"
version = "0.1.0-alpha.11"
source = "git+https://github.com/tlsnotary/tlsn.git?tag=v0.1.0-alpha.11#878fe7e87d6d3306b283148abecc5bc19e04579b"
version = "0.1.0-alpha.12"
source = "git+https://github.com/tlsnotary/tlsn.git?tag=v0.1.0-alpha.12#f2ff4ba79245ea641c485ce11efb2cb574292abb"
dependencies = [
"futures",
"hmac",

View File

@@ -19,4 +19,4 @@ serde = { version = "1.0.147", features = ["derive"] }
serde_json = "1.0"
hex = "0.4"
bincode = { version = "1.3" }
tlsn-core = { git = "https://github.com/tlsnotary/tlsn.git", tag = "v0.1.0-alpha.11", package = "tlsn-core" }
tlsn-core = { git = "https://github.com/tlsnotary/tlsn.git", tag = "v0.1.0-alpha.12", package = "tlsn-core" }

BIN
rs/0.1.0-alpha.12/index.node Executable file

Binary file not shown.

File diff suppressed because one or more lines are too long

View File

@@ -1,5 +1,4 @@
use k256::pkcs8::DecodePublicKey;
use k256::pkcs8::EncodePublicKey;
use neon::prelude::*;
use tlsn_core::{
presentation::{Presentation, PresentationOutput},
@@ -45,11 +44,6 @@ fn verify_presentation(
.map_err(|x| format!("Invalid verifying key: {}", x))?;
if notary_key != verifying_key {
let verifying_key_pem = verifying_key
.to_public_key_pem(Default::default())
.map_err(|e| format!("Failed to encode verifying key to PEM: {}", e))?;
println!("Verifying key PEM:\n{}", verifying_key_pem);
Err("The verifying key does not match the notary key")?;
}
@@ -97,7 +91,7 @@ mod tests {
fn example_presentation() -> String {
let example = include_str!("example.json");
let presentation: Presentation = serde_json::from_str(&example).unwrap();
assert_eq!("0.1.0-alpha.11", presentation.version);
assert_eq!("0.1.0-alpha.7", presentation.version);
presentation.data
}
@@ -105,19 +99,19 @@ mod tests {
fn test_verify() {
let notary_key_cx = String::from(
"-----BEGIN PUBLIC KEY-----
MFYwEAYHKoZIzj0CAQYFK4EEAAoDQgAEDahdjamzQ2UA5S1g8sFcdgXtnwWVPQIp
SlugtbkoGpqLP+9Dczt2hVjQD/SXI2GL/mAgbOekjw1Kj/KcjrLBqw==
MDYwEAYHKoZIzj0CAQYFK4EEAAoDIgADe0jxnBObaIj7Xjg6TXLCM1GG/VhY5650
OrS/jgcbBuc=
-----END PUBLIC KEY-----",
);
let (sent, recv, time) =
verify_presentation(example_presentation(), notary_key_cx).unwrap();
assert_eq!(1748415894, time);
assert!(sent.contains("host: raw.githubusercontent.com"));
assert_eq!(1728416631, time);
assert!(sent.contains("host: example.com"));
assert!(sent.contains("XXXXXXXXXXXXXXXXXX"));
assert!(recv.contains("\"id\": 1234567890"));
assert!(recv.contains("\"city\": \"Anytown\""));
assert!(recv.contains("<title>Example Domain</title>"));
assert!(recv.contains("Date: Tue, 08 Oct 2024"));
}
#[test]

View File

@@ -7,7 +7,7 @@ import configureAppStore, { AppRootState } from '../web/store';
import { Provider } from 'react-redux';
import { Mutex } from 'async-mutex';
//@ts-ignore
import { verify } from '../rs/0.1.0-alpha.11/index.node';
import { verify } from '../rs/0.1.0-alpha.12/index.node';
import { convertNotaryWsToHttp, fetchPublicKeyFromNotary } from './util/index';
import { assignPoapToUser } from './util/index';
@@ -43,7 +43,7 @@ app.get('*', (req, res) => {
const storeConfig: AppRootState = {
attestation: {
raw: {
version: '0.1.0-alpha.11',
version: '0.1.0-alpha.12',
data: '',
meta: {
notaryUrl: '',

View File

@@ -3,7 +3,7 @@ import fs from 'fs';
import admin from 'firebase-admin';
const serviceAccount = JSON.parse(
fs.readFileSync(path.join(__dirname, 'util/firebase-admin.json'), 'utf8')
fs.readFileSync(path.join(__dirname, 'util/firebase-admin.json'), 'utf8'),
);
admin.initializeApp({
@@ -51,11 +51,11 @@ export const assignPoapToUser = async (
const existingPoap = await getUserPoap(screen_name);
if (existingPoap) return existingPoap;
const poapsDocRef = db.collection("poaps").doc("poaps");
const poapsDocRef = db.collection('poaps').doc('poaps');
const poapsDoc = await poapsDocRef.get();
if (!poapsDoc.exists) {
console.error("POAPs document not found in Firestore.");
console.error('POAPs document not found in Firestore.');
return null;
}
@@ -63,7 +63,7 @@ export const assignPoapToUser = async (
const poapKeys = Object.keys(poapsData);
if (poapKeys.length === 0) {
console.log("No available POAPs left.");
console.log('No available POAPs left.');
return null;
}
@@ -71,7 +71,7 @@ export const assignPoapToUser = async (
const poapLink = poapsData[firstKey];
if (!poapLink) {
console.error("Invalid POAP link found:", poapsData);
console.error('Invalid POAP link found:', poapsData);
return null;
}
@@ -93,7 +93,7 @@ export const assignPoapToUser = async (
return poapLink;
} catch (error) {
console.error("Error writing to Firestore:", error);
console.error('Error writing to Firestore:', error);
return null;
}
};

View File

@@ -21,7 +21,7 @@ export type State = {
export const initState: State = {
raw: {
version: '0.1.0-alpha.11',
version: '0.1.0-alpha.12',
data: '',
meta: {
notaryUrl: '',

View File

@@ -1,5 +1,5 @@
export interface AttestedData {
version: '0.1.0-alpha.11';
version: '0.1.0-alpha.12';
time: number;
sent: string;
recv: string;
@@ -10,7 +10,7 @@ export interface AttestedData {
}
export type Attestation = {
version: '0.1.0-alpha.11';
version: '0.1.0-alpha.12';
data: string;
meta: {
notaryUrl: string;