@prosopo/client-example-server 0.1.17 → 0.1.18
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/package.json +51 -47
- package/.env.development +0 -9
- package/dist/app.d.ts +0 -3
- package/dist/app.d.ts.map +0 -1
- package/dist/app.js +0 -56
- package/dist/app.js.map +0 -1
- package/dist/bundle/nodejs-polars.linux-x64-gnu.node +0 -0
- package/dist/bundle/prosopo_client_example_server.app.bundle.js +0 -289803
- package/dist/controllers/auth.d.ts +0 -7
- package/dist/controllers/auth.d.ts.map +0 -1
- package/dist/controllers/auth.js +0 -125
- package/dist/controllers/auth.js.map +0 -1
- package/dist/models/user.d.ts +0 -15
- package/dist/models/user.d.ts.map +0 -1
- package/dist/models/user.js +0 -32
- package/dist/models/user.js.map +0 -1
- package/dist/prosopo.config.d.ts +0 -30
- package/dist/prosopo.config.d.ts.map +0 -1
- package/dist/prosopo.config.js +0 -57
- package/dist/prosopo.config.js.map +0 -1
- package/dist/routes/routes.d.ts +0 -6
- package/dist/routes/routes.d.ts.map +0 -1
- package/dist/routes/routes.js +0 -18
- package/dist/routes/routes.js.map +0 -1
- package/dist/utils/connection.d.ts +0 -4
- package/dist/utils/connection.d.ts.map +0 -1
- package/dist/utils/connection.js +0 -26
- package/dist/utils/connection.js.map +0 -1
- package/dist/utils/database.d.ts +0 -3
- package/dist/utils/database.d.ts.map +0 -1
- package/dist/utils/database.js +0 -21
- package/dist/utils/database.js.map +0 -1
- package/env.development +0 -9
- package/src/app.ts +0 -84
- package/src/controllers/auth.ts +0 -134
- package/src/models/user.ts +0 -41
- package/src/prosopo.config.ts +0 -60
- package/src/routes/routes.ts +0 -39
- package/src/utils/connection.ts +0 -26
- package/src/utils/database.ts +0 -20
- package/tsconfig.json +0 -50
- package/tsconfig.tsbuildinfo +0 -1
- package/tsconfig.webpack.json +0 -14
package/src/models/user.ts
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
// Copyright 2021-2023 Prosopo (UK) Ltd.
|
|
2
|
-
//
|
|
3
|
-
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
// you may not use this file except in compliance with the License.
|
|
5
|
-
// You may obtain a copy of the License at
|
|
6
|
-
//
|
|
7
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
-
//
|
|
9
|
-
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
-
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
-
// See the License for the specific language governing permissions and
|
|
13
|
-
// limitations under the License.
|
|
14
|
-
import mongoose, { Schema } from 'mongoose'
|
|
15
|
-
|
|
16
|
-
export interface UserInterface {
|
|
17
|
-
id: number
|
|
18
|
-
email: string
|
|
19
|
-
name: string
|
|
20
|
-
password: string
|
|
21
|
-
salt: string
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
const UserSchema = new Schema<UserInterface>({
|
|
25
|
-
email: {
|
|
26
|
-
type: mongoose.SchemaTypes.String,
|
|
27
|
-
required: true,
|
|
28
|
-
},
|
|
29
|
-
name: {
|
|
30
|
-
type: mongoose.SchemaTypes.String,
|
|
31
|
-
},
|
|
32
|
-
password: {
|
|
33
|
-
type: mongoose.SchemaTypes.String,
|
|
34
|
-
required: true,
|
|
35
|
-
},
|
|
36
|
-
id: {
|
|
37
|
-
type: mongoose.SchemaTypes.Number,
|
|
38
|
-
},
|
|
39
|
-
})
|
|
40
|
-
|
|
41
|
-
export default UserSchema
|
package/src/prosopo.config.ts
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
// Copyright 2021-2022 Prosopo (UK) Ltd.
|
|
2
|
-
//
|
|
3
|
-
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
// you may not use this file except in compliance with the License.
|
|
5
|
-
// You may obtain a copy of the License at
|
|
6
|
-
//
|
|
7
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
-
//
|
|
9
|
-
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
-
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
-
// See the License for the specific language governing permissions and
|
|
13
|
-
// limitations under the License.
|
|
14
|
-
// import {ProsopoConfig} from './types';
|
|
15
|
-
|
|
16
|
-
import { EnvironmentTypesSchema, ProsopoServerConfig } from '@prosopo/types'
|
|
17
|
-
import { LogLevelSchema } from '@prosopo/common'
|
|
18
|
-
|
|
19
|
-
export default () =>
|
|
20
|
-
({
|
|
21
|
-
logLevel: process.env.LOG_LEVEL || LogLevelSchema.enum.Debug,
|
|
22
|
-
defaultEnvironment: process.env.DEFAULT_ENVIRONMENT || EnvironmentTypesSchema.enum.development, // enviromental variables
|
|
23
|
-
web2: process.env.REACT_APP_WEB2 || true,
|
|
24
|
-
serverUrl:
|
|
25
|
-
process.env.REACT_APP_SERVER_URL && process.env.REACT_APP_SERVER_PORT
|
|
26
|
-
? `${process.env.REACT_APP_SERVER_URL}:${process.env.REACT_APP_SERVER_PORT}`
|
|
27
|
-
: 'http://localhost:9228',
|
|
28
|
-
solutionThreshold: process.env.REACT_APP_SOLUTION_THRESHOLD || 0.5,
|
|
29
|
-
dappName: process.env.REACT_APP_DAPP_NAME || 'client-example-server',
|
|
30
|
-
account: {
|
|
31
|
-
password: '',
|
|
32
|
-
address: process.env.REACT_APP_SERVER_ACCOUNT_ADDRESS || '',
|
|
33
|
-
},
|
|
34
|
-
networks: {
|
|
35
|
-
development: {
|
|
36
|
-
endpoint: process.env.REACT_APP_SUBSTRATE_NODE_URL || 'ws://localhost:9944',
|
|
37
|
-
contract: {
|
|
38
|
-
address: process.env.REACT_APP_PROSOPO_CONTRACT_ADDRESS,
|
|
39
|
-
name: 'prosopo',
|
|
40
|
-
},
|
|
41
|
-
dappAccount: {
|
|
42
|
-
address: process.env.REACT_APP_DAPP_SITE_KEY,
|
|
43
|
-
name: 'dapp',
|
|
44
|
-
},
|
|
45
|
-
accounts: ['//Alice', '//Bob', '//Charlie', '//Dave', '//Eve', '//Ferdie'],
|
|
46
|
-
},
|
|
47
|
-
shiden: {
|
|
48
|
-
endpoint: 'wss://shiden.public.blastapi.io',
|
|
49
|
-
contract: {
|
|
50
|
-
address: process.env.REACT_APP_PROSOPO_CONTRACT_ADDRESS,
|
|
51
|
-
name: 'prosopo',
|
|
52
|
-
},
|
|
53
|
-
dappAccount: {
|
|
54
|
-
address: process.env.REACT_APP_DAPP_SITE_KEY,
|
|
55
|
-
name: 'dapp',
|
|
56
|
-
},
|
|
57
|
-
accounts: [],
|
|
58
|
-
},
|
|
59
|
-
},
|
|
60
|
-
} as ProsopoServerConfig)
|
package/src/routes/routes.ts
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
// Copyright 2021-2023 Prosopo (UK) Ltd.
|
|
2
|
-
//
|
|
3
|
-
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
// you may not use this file except in compliance with the License.
|
|
5
|
-
// You may obtain a copy of the License at
|
|
6
|
-
//
|
|
7
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
-
//
|
|
9
|
-
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
-
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
-
// See the License for the specific language governing permissions and
|
|
13
|
-
// limitations under the License.
|
|
14
|
-
import { Connection } from 'mongoose'
|
|
15
|
-
import { ProsopoServer } from '@prosopo/server'
|
|
16
|
-
import { isAuth, login, signup } from '../controllers/auth'
|
|
17
|
-
import express from 'express'
|
|
18
|
-
|
|
19
|
-
const router = express.Router()
|
|
20
|
-
|
|
21
|
-
function getRoutes(mongoose: Connection, prosopoServer: ProsopoServer): express.Router {
|
|
22
|
-
router.post('/login', login.bind(null, mongoose, prosopoServer))
|
|
23
|
-
|
|
24
|
-
router.post('/signup', signup.bind(null, mongoose, prosopoServer))
|
|
25
|
-
|
|
26
|
-
router.get('/private', isAuth)
|
|
27
|
-
|
|
28
|
-
router.get('/public', (req, res) => {
|
|
29
|
-
res.status(200).json({ message: 'here is your public resource' })
|
|
30
|
-
})
|
|
31
|
-
|
|
32
|
-
// will match any other path
|
|
33
|
-
router.use('/', (req, res) => {
|
|
34
|
-
res.status(404).json({ error: 'page not found' })
|
|
35
|
-
})
|
|
36
|
-
return router
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export default getRoutes
|
package/src/utils/connection.ts
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
// Copyright 2021-2023 Prosopo (UK) Ltd.
|
|
2
|
-
//
|
|
3
|
-
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
// you may not use this file except in compliance with the License.
|
|
5
|
-
// You may obtain a copy of the License at
|
|
6
|
-
//
|
|
7
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
-
//
|
|
9
|
-
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
-
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
-
// See the License for the specific language governing permissions and
|
|
13
|
-
// limitations under the License.
|
|
14
|
-
import { AutoIncrementID, AutoIncrementIDOptions } from '@typegoose/auto-increment'
|
|
15
|
-
import UserSchema from '../models/user'
|
|
16
|
-
import mongoose, { Connection } from 'mongoose'
|
|
17
|
-
|
|
18
|
-
function connectionFactory(uri: string): Connection {
|
|
19
|
-
const conn = mongoose.createConnection(uri)
|
|
20
|
-
if (!conn.models.user) {
|
|
21
|
-
UserSchema.plugin(AutoIncrementID, { field: 'id' } as AutoIncrementIDOptions)
|
|
22
|
-
conn.model('User', UserSchema)
|
|
23
|
-
}
|
|
24
|
-
return conn
|
|
25
|
-
}
|
|
26
|
-
export default connectionFactory
|
package/src/utils/database.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
// Copyright 2021-2023 Prosopo (UK) Ltd.
|
|
2
|
-
//
|
|
3
|
-
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
// you may not use this file except in compliance with the License.
|
|
5
|
-
// You may obtain a copy of the License at
|
|
6
|
-
//
|
|
7
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
-
//
|
|
9
|
-
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
-
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
-
// See the License for the specific language governing permissions and
|
|
13
|
-
// limitations under the License.
|
|
14
|
-
import { MongoMemoryServer } from 'mongodb-memory-server'
|
|
15
|
-
export async function memoryServerSetup(): Promise<string> {
|
|
16
|
-
const mongod = MongoMemoryServer.create()
|
|
17
|
-
const memoryServer = await mongod
|
|
18
|
-
return memoryServer.getUri()
|
|
19
|
-
}
|
|
20
|
-
export default memoryServerSetup
|
package/tsconfig.json
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "../../tsconfig.build.json",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"target": "esnext",
|
|
5
|
-
"rootDir": "./src",
|
|
6
|
-
"outDir": "./dist",
|
|
7
|
-
"lib": [
|
|
8
|
-
"dom",
|
|
9
|
-
"dom.iterable",
|
|
10
|
-
"esnext"
|
|
11
|
-
],
|
|
12
|
-
"allowJs": true,
|
|
13
|
-
"skipLibCheck": true,
|
|
14
|
-
"esModuleInterop": true,
|
|
15
|
-
"allowSyntheticDefaultImports": true,
|
|
16
|
-
// "strict": true,
|
|
17
|
-
"forceConsistentCasingInFileNames": true,
|
|
18
|
-
"noFallthroughCasesInSwitch": true,
|
|
19
|
-
"moduleResolution": "node",
|
|
20
|
-
"resolveJsonModule": true,
|
|
21
|
-
// "isolatedModules": true,
|
|
22
|
-
// "noEmit": true,
|
|
23
|
-
"jsx": "react-jsx"
|
|
24
|
-
},
|
|
25
|
-
"include": [
|
|
26
|
-
"./src/**/*.ts",
|
|
27
|
-
"./src/**/*.js"
|
|
28
|
-
],
|
|
29
|
-
"exclude": ["node_modules", "dist"],
|
|
30
|
-
"references": [
|
|
31
|
-
{
|
|
32
|
-
"path": "../../packages/api"
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
"path": "../../packages/cli"
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
"path": "../../packages/contract"
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
"path": "../../packages/procaptcha"
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
"path": "../../packages/server"
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
"path": "../../packages/types"
|
|
48
|
-
}
|
|
49
|
-
]
|
|
50
|
-
}
|