@openfort/openfort-js 0.0.1

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/.prettierrc ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "printWidth": 120,
3
+ "singleQuote": true,
4
+ "tabWidth": 4,
5
+ "trailingComma": "all"
6
+ }
package/README.md ADDED
@@ -0,0 +1,33 @@
1
+ # openfort-typescript-client
2
+
3
+ ## Registration of the player session
4
+ 1. Create a key pair for the player:
5
+ ```typescript
6
+ const playerKey = new KeyPair();
7
+ ```
8
+
9
+ 2. Authorize player with the game backend service and pass public key to the `openfortClient.players.createSession` api method
10
+
11
+ 3. Save private key. You can use local storage, file storage or any other type of storaged
12
+ ```typescript
13
+ await keyPair.saveToLocalStorage();
14
+ ```
15
+ ```typescript
16
+ await keyPair.saveToFile();
17
+ ```
18
+ ```typescript
19
+ await KeyPair.saveToStorage(customeStorageImplementation);
20
+ ```
21
+
22
+ 4. Use the private key to communicate with openfort api.
23
+
24
+ 5. To the future use one of the load methods to load key pair. Depends on the solution, that was chosen in the step 4.
25
+ ```typescript
26
+ const playerKey = await KeyPair.loadFromLocalStorage();
27
+ ```
28
+ ```typescript
29
+ const playerKey = await KeyPair.loadFromFile();
30
+ ```
31
+ ```typescript
32
+ const playerKey = await KeyPair.loadFromStorage(customeStorageImplementation);
33
+ ```
@@ -0,0 +1,7 @@
1
+ {
2
+ "transform": {
3
+ "^.+\\.(t|j)sx?$": "ts-jest"
4
+ },
5
+ "testRegex": "(/tests/.*|(\\.|/)(test|spec))\\.ts$",
6
+ "moduleFileExtensions": ["ts", "tsx", "js", "jsx", "json", "node"]
7
+ }
package/package.json ADDED
@@ -0,0 +1,38 @@
1
+ {
2
+ "name": "@openfort/openfort-js",
3
+ "version": "0.0.1",
4
+ "description": "",
5
+ "author": "",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://github.com/openfort-xyz/openfort-js.git"
9
+ },
10
+ "keywords": [],
11
+ "license": "MIT",
12
+ "main": "./dist/index.js",
13
+ "exports": {
14
+ ".": "./dist/index.js"
15
+ },
16
+ "scripts": {
17
+ "build": "tsc",
18
+ "format": "prettier --write \"src/**/*.ts\"",
19
+ "lint": "tslint -p tsconfig.json",
20
+ "test": "jest --config jestconfig.json"
21
+ },
22
+ "publishConfig": {
23
+ "registry": "https://registry.npmjs.org/"
24
+ },
25
+ "devDependencies": {
26
+ "@types/node": "^20.2.1",
27
+ "prettier": "^2.8.8",
28
+ "tslint": "^6.1.3",
29
+ "tslint-config-prettier": "^1.18.0",
30
+ "typescript": "^5.0.4"
31
+ },
32
+ "dependencies": {
33
+ "axios": "^1.4.0",
34
+ "es6-promise": "^4.2.8",
35
+ "ethereum-cryptography": "^2.0.0",
36
+ "path": "^0.12.7"
37
+ }
38
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,30 @@
1
+ {
2
+ "compilerOptions": {
3
+ "outDir": "dist",
4
+ "rootDir": "src",
5
+ "sourceMap": true,
6
+ "noImplicitAny": false,
7
+ "module": "commonjs",
8
+ "composite": true,
9
+ "target": "es2021",
10
+ "lib": ["es2021", "dom"],
11
+ "typeRoots": ["node_modules/@types"],
12
+ "downlevelIteration": true,
13
+ "experimentalDecorators": true,
14
+ "declaration": true,
15
+ "noUnusedLocals": false,
16
+ "strictNullChecks": true,
17
+ "newLine": "LF",
18
+ "noUnusedParameters": false,
19
+ "emitDecoratorMetadata": true,
20
+ "noImplicitThis": true,
21
+ "noImplicitReturns": true,
22
+ "noFallthroughCasesInSwitch": true,
23
+ "strictBindCallApply": true,
24
+ "esModuleInterop": true
25
+ },
26
+ "exclude": [
27
+ "dist",
28
+ "example"
29
+ ]
30
+ }
package/tslint.json ADDED
@@ -0,0 +1,3 @@
1
+ {
2
+ "extends": ["tslint:recommended", "tslint-config-prettier"]
3
+ }