@owlmeans/auth 0.1.0
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/LICENSE +21 -0
- package/README.md +321 -0
- package/build/.gitkeep +0 -0
- package/build/allowance/index.d.ts +2 -0
- package/build/allowance/index.d.ts.map +1 -0
- package/build/allowance/index.js +2 -0
- package/build/allowance/index.js.map +1 -0
- package/build/allowance/model.d.ts +7 -0
- package/build/allowance/model.d.ts.map +1 -0
- package/build/allowance/model.js +57 -0
- package/build/allowance/model.js.map +1 -0
- package/build/auth/index.d.ts +2 -0
- package/build/auth/index.d.ts.map +1 -0
- package/build/auth/index.js +2 -0
- package/build/auth/index.js.map +1 -0
- package/build/auth/model.d.ts +8 -0
- package/build/auth/model.d.ts.map +1 -0
- package/build/auth/model.js +55 -0
- package/build/auth/model.js.map +1 -0
- package/build/consts.d.ts +69 -0
- package/build/consts.d.ts.map +1 -0
- package/build/consts.js +100 -0
- package/build/consts.js.map +1 -0
- package/build/entity/index.d.ts +2 -0
- package/build/entity/index.d.ts.map +1 -0
- package/build/entity/index.js +2 -0
- package/build/entity/index.js.map +1 -0
- package/build/entity/profile.d.ts +4 -0
- package/build/entity/profile.d.ts.map +1 -0
- package/build/entity/profile.js +21 -0
- package/build/entity/profile.js.map +1 -0
- package/build/errors.d.ts +54 -0
- package/build/errors.d.ts.map +1 -0
- package/build/errors.js +105 -0
- package/build/errors.js.map +1 -0
- package/build/helper.d.ts +7 -0
- package/build/helper.d.ts.map +1 -0
- package/build/helper.js +21 -0
- package/build/helper.js.map +1 -0
- package/build/index.d.ts +10 -0
- package/build/index.d.ts.map +1 -0
- package/build/index.js +9 -0
- package/build/index.js.map +1 -0
- package/build/permission/index.d.ts +2 -0
- package/build/permission/index.d.ts.map +1 -0
- package/build/permission/index.js +2 -0
- package/build/permission/index.js.map +1 -0
- package/build/permission/model.d.ts +6 -0
- package/build/permission/model.d.ts.map +1 -0
- package/build/permission/model.js +27 -0
- package/build/permission/model.js.map +1 -0
- package/build/rely/index.d.ts +3 -0
- package/build/rely/index.d.ts.map +1 -0
- package/build/rely/index.js +2 -0
- package/build/rely/index.js.map +1 -0
- package/build/rely/model.d.ts +4 -0
- package/build/rely/model.d.ts.map +1 -0
- package/build/rely/model.js +12 -0
- package/build/rely/model.js.map +1 -0
- package/build/rely/types.d.ts +7 -0
- package/build/rely/types.d.ts.map +1 -0
- package/build/rely/types.js +2 -0
- package/build/rely/types.js.map +1 -0
- package/build/types.d.ts +81 -0
- package/build/types.d.ts.map +1 -0
- package/build/types.js +2 -0
- package/build/types.js.map +1 -0
- package/package.json +38 -0
- package/src/allowance/index.ts +2 -0
- package/src/allowance/model.ts +65 -0
- package/src/auth/index.ts +2 -0
- package/src/auth/model.ts +64 -0
- package/src/consts.ts +121 -0
- package/src/entity/index.ts +2 -0
- package/src/entity/profile.ts +24 -0
- package/src/errors.ts +132 -0
- package/src/helper.ts +32 -0
- package/src/index.ts +10 -0
- package/src/permission/index.ts +2 -0
- package/src/permission/model.ts +31 -0
- package/src/rely/index.ts +3 -0
- package/src/rely/model.ts +14 -0
- package/src/rely/types.ts +7 -0
- package/src/types.ts +178 -0
- package/tsconfig.json +14 -0
- package/tsconfig.tsbuildinfo +1 -0
package/src/types.ts
ADDED
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import type { AuthRole } from './consts.js'
|
|
2
|
+
|
|
3
|
+
export interface AuthCredentials extends AuthPayload {
|
|
4
|
+
challenge: string
|
|
5
|
+
credential: string
|
|
6
|
+
publicKey?: string
|
|
7
|
+
/**
|
|
8
|
+
AuthPayload:
|
|
9
|
+
type: string
|
|
10
|
+
role: AuthRole
|
|
11
|
+
userId: string
|
|
12
|
+
source?: string
|
|
13
|
+
profileId?: string
|
|
14
|
+
expiresAt?: Date
|
|
15
|
+
ProfilePayload:
|
|
16
|
+
groups?: string[]
|
|
17
|
+
Authorization:
|
|
18
|
+
entityId?: string
|
|
19
|
+
scopes: string[]
|
|
20
|
+
permissions?: PermissionSet[]
|
|
21
|
+
attributes?: AttributeSet[]
|
|
22
|
+
permissioned?: boolean
|
|
23
|
+
denormalized?: boolean
|
|
24
|
+
*/
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface AuthPayload extends ProfilePayload {
|
|
28
|
+
type: string
|
|
29
|
+
role: AuthRole
|
|
30
|
+
/**
|
|
31
|
+
* Account id - shouldn't be shared with the services
|
|
32
|
+
* - it's ok to share owner id for supervisor roles double check
|
|
33
|
+
* - ? it should contain derived did in case of cryptographic authentication
|
|
34
|
+
*/
|
|
35
|
+
userId: string
|
|
36
|
+
/**
|
|
37
|
+
* Previous challenge
|
|
38
|
+
*/
|
|
39
|
+
source?: string
|
|
40
|
+
/**
|
|
41
|
+
* Id of the user inside the service. Preferable generated by the service.
|
|
42
|
+
* @cardinality Service to profile (to user) - one to many.
|
|
43
|
+
*/
|
|
44
|
+
profileId?: string
|
|
45
|
+
expiresAt?: Date
|
|
46
|
+
/**
|
|
47
|
+
ProfilePayload:
|
|
48
|
+
groups?: string[]
|
|
49
|
+
Authorization:
|
|
50
|
+
entityId?: string
|
|
51
|
+
scopes: string[]
|
|
52
|
+
permissions?: PermissionSet[]
|
|
53
|
+
attributes?: AttributeSet[]
|
|
54
|
+
permissioned?: boolean
|
|
55
|
+
denormalized?: boolean
|
|
56
|
+
*/
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export interface Group extends Authorization {
|
|
60
|
+
id: string
|
|
61
|
+
name: string
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export interface ProfilePayload extends Authorization {
|
|
65
|
+
groups?: string[]
|
|
66
|
+
/**
|
|
67
|
+
Authorization:
|
|
68
|
+
entityId?: string
|
|
69
|
+
scopes: string[]
|
|
70
|
+
permissions?: PermissionSet[]
|
|
71
|
+
attributes?: AttributeSet[]
|
|
72
|
+
permissioned?: boolean
|
|
73
|
+
denormalized?: boolean
|
|
74
|
+
*/
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export interface Authorization {
|
|
78
|
+
entityId?: string
|
|
79
|
+
scopes: string[]
|
|
80
|
+
permissions?: PermissionSet[]
|
|
81
|
+
attributes?: AttributeSet[]
|
|
82
|
+
/**
|
|
83
|
+
* Whether authorization provides all necessary permissions
|
|
84
|
+
*/
|
|
85
|
+
permissioned?: boolean
|
|
86
|
+
/**
|
|
87
|
+
* Whether all permissions resolved
|
|
88
|
+
*/
|
|
89
|
+
denormalized?: boolean
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export interface Profile extends ProfilePayload {
|
|
93
|
+
id: string
|
|
94
|
+
name: string
|
|
95
|
+
credential?: string
|
|
96
|
+
secret?: string
|
|
97
|
+
/**
|
|
98
|
+
ProfilePayload:
|
|
99
|
+
groups?: string[]
|
|
100
|
+
Authorization:
|
|
101
|
+
entityId?: string
|
|
102
|
+
scopes: string[]
|
|
103
|
+
permissions?: PermissionSet[]
|
|
104
|
+
attributes?: AttributeSet[]
|
|
105
|
+
permissioned?: boolean
|
|
106
|
+
denormalized?: boolean
|
|
107
|
+
*/
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export interface Auth extends AuthPayload {
|
|
111
|
+
token: string
|
|
112
|
+
isUser: boolean
|
|
113
|
+
createdAt: Date
|
|
114
|
+
/**
|
|
115
|
+
AuthPayload:
|
|
116
|
+
type: string
|
|
117
|
+
role: AuthRole
|
|
118
|
+
userId: string
|
|
119
|
+
source?: string
|
|
120
|
+
profileId?: string
|
|
121
|
+
expiresAt?: Date
|
|
122
|
+
ProfilePayload:
|
|
123
|
+
groups?: string[]
|
|
124
|
+
Authorization:
|
|
125
|
+
entityId?: string
|
|
126
|
+
scopes: string[]
|
|
127
|
+
permissions?: PermissionSet[]
|
|
128
|
+
attributes?: AttributeSet[]
|
|
129
|
+
permissioned?: boolean
|
|
130
|
+
denormalized?: boolean
|
|
131
|
+
*/
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
export interface PermissionSet {
|
|
135
|
+
scope: string
|
|
136
|
+
title?: string
|
|
137
|
+
permissions: Capabilties
|
|
138
|
+
resources?: string[]
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
export interface Capabilties {
|
|
142
|
+
[key: string]: boolean | number | null
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
export interface AttributeSet {
|
|
146
|
+
scope: string
|
|
147
|
+
attributes: string[]
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
export interface AllowanceRequest extends Partial<AuthPayload> {
|
|
151
|
+
type: string
|
|
152
|
+
/**
|
|
153
|
+
AuthPayload:
|
|
154
|
+
type?: string
|
|
155
|
+
role?: AuthRole
|
|
156
|
+
userId?: string
|
|
157
|
+
source?: string
|
|
158
|
+
profileId?: string
|
|
159
|
+
expiresAt?: Date
|
|
160
|
+
ProfilePayload:
|
|
161
|
+
groups?: string[]
|
|
162
|
+
Authorization:
|
|
163
|
+
entityId?: string
|
|
164
|
+
scopes?: string[]
|
|
165
|
+
permissions?: PermissionSet[]
|
|
166
|
+
attributes?: AttributeSet[]
|
|
167
|
+
permissioned?: boolean
|
|
168
|
+
denormalized?: boolean
|
|
169
|
+
*/
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
export interface AllowanceResponse {
|
|
173
|
+
challenge: string
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
export interface AuthToken {
|
|
177
|
+
token: string
|
|
178
|
+
}
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": [
|
|
3
|
+
"../tsconfig.default.json",
|
|
4
|
+
],
|
|
5
|
+
"compilerOptions": {
|
|
6
|
+
"rootDir": "./src/", /* Specify the root folder within your source files. */
|
|
7
|
+
"outDir": "./build/", /* Specify an output folder for all emitted files. */
|
|
8
|
+
},
|
|
9
|
+
"exclude": [
|
|
10
|
+
"./dist/**/*",
|
|
11
|
+
"./build/**/*",
|
|
12
|
+
"./*.ts"
|
|
13
|
+
]
|
|
14
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"root":["./src/consts.ts","./src/errors.ts","./src/helper.ts","./src/index.ts","./src/types.ts","./src/allowance/index.ts","./src/allowance/model.ts","./src/auth/index.ts","./src/auth/model.ts","./src/entity/index.ts","./src/entity/profile.ts","./src/permission/index.ts","./src/permission/model.ts","./src/rely/index.ts","./src/rely/model.ts","./src/rely/types.ts"],"version":"5.6.3"}
|