Skip to content

Commit

Permalink
Change the structure of key pair and openfort client
Browse files Browse the repository at this point in the history
  • Loading branch information
tsviatkov committed May 29, 2023
1 parent 533fc62 commit fff6e2c
Show file tree
Hide file tree
Showing 14 changed files with 292 additions and 92 deletions.
9 changes: 5 additions & 4 deletions example/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { getRandomBytesSync } from 'ethereum-cryptography/random';
import Openfort from '../src/openfort';
import Openfort from "../src";
import {getRandomBytesSync} from "ethereum-cryptography/random";

async function example(): Promise<void> {
const openfort = new Openfort('pk_test_a6508438-48d2-4af9-a557-51b638800a14', 'http://localhost:3002');
const openfort = new Openfort("pk_test_a6508438-48d2-4af9-a557-51b638800a14", "http://localhost:3002");
if (!(await openfort.loadSessionKeyFromFile())) {
openfort.createSessionKey();
// TODO: call server to authenticate user and register session
Expand All @@ -12,7 +12,8 @@ async function example(): Promise<void> {
// TODO: replace the message
const message = getRandomBytesSync(32);
const signature = openfort.signMessage(message);
const sessionId = 'ses';
const sessionId = "ses";
console.log(signature);

const response = await openfort.sendSignatureSessionRequest(sessionId, signature);
console.dir(response);
Expand Down
4 changes: 3 additions & 1 deletion example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@
"typescript": "^5.0.4"
},
"dependencies": {
"@ethersproject/bytes": "^5.7.0",
"@openfort/openfort-js": "file:../src/index.ts",
"ethereum-cryptography": "^2.0.0"
"ethereum-cryptography": "^2.0.0",
"ethers": "^6.4.0"
}
}
27 changes: 14 additions & 13 deletions example/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,26 +1,27 @@
{
"compilerOptions": {
"rootDir": "..",
"baseUrl": ".",
"outDir": "dist",
"typeRoots": ["node_modules/@types"],
"lib": ["es2021", "dom"],
"module": "commonjs",
"target": "es2021",
"lib": ["es2021", "dom"],
"typeRoots": ["node_modules/@types"],
"newLine": "LF",
"declaration": true,
"downlevelIteration": true,
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"newLine": "LF",
"noEmit": true,
"strict": true,
"esModuleInterop": true,
"experimentalDecorators": true,
"noFallthroughCasesInSwitch": true,
"noImplicitAny": false,
"skipLibCheck": true,
"noImplicitReturns": true,
"noImplicitThis": true,
"noUnusedLocals": false,
"noUnusedParameters": false,
"sourceMap": true,
"strictBindCallApply": true,
"paths": {
"@openfort/openfort-js": ["../src/index.ts"]
"@openfort/openfort-js": ["../src/"]
},
"esModuleInterop": true
},
"ts-node": {
"transpileOnly": true
}
}
Loading

0 comments on commit fff6e2c

Please sign in to comment.