@pax2pay/model-banking 0.1.219 → 0.1.220
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/Identity.ts +6 -1
- package/dist/Identity.d.ts +2 -0
- package/dist/Identity.js +18 -0
- package/dist/Identity.js.map +1 -1
- package/package.json +1 -1
package/Identity.ts
CHANGED
|
@@ -12,7 +12,12 @@ export class Identity {
|
|
|
12
12
|
{ [`*-*`]: constraint },
|
|
13
13
|
].some(e => userwidgets.User.Permissions.check(this.key.permissions, e))
|
|
14
14
|
}
|
|
15
|
-
|
|
15
|
+
#realms: Realm[] | undefined
|
|
16
|
+
get realms(): Realm[] | undefined {
|
|
17
|
+
return (this.#realms ??= Object.keys(this.key.permissions).flatMap(code =>
|
|
18
|
+
code.split("-")[0] == "*" ? Realm.realms : code.split("-")[0]
|
|
19
|
+
) as Realm[])
|
|
20
|
+
}
|
|
16
21
|
static async authenticate(
|
|
17
22
|
header: { authorization?: string | undefined; realm?: Realm; organization?: string },
|
|
18
23
|
constraint: Key.Permissions,
|
package/dist/Identity.d.ts
CHANGED
|
@@ -2,11 +2,13 @@ import { userwidgets } from "@userwidgets/model";
|
|
|
2
2
|
import { Key } from "./Key";
|
|
3
3
|
import { Realm } from "./Realm";
|
|
4
4
|
export declare class Identity {
|
|
5
|
+
#private;
|
|
5
6
|
readonly key: Key;
|
|
6
7
|
readonly realm?: "eu" | "uk" | "test" | "testUK" | "upcheck" | undefined;
|
|
7
8
|
readonly organization?: string | undefined;
|
|
8
9
|
constructor(key: Key, realm?: "eu" | "uk" | "test" | "testUK" | "upcheck" | undefined, organization?: string | undefined);
|
|
9
10
|
check(constraint: Key.Permissions, realm?: Realm, organization?: string): boolean;
|
|
11
|
+
get realms(): Realm[] | undefined;
|
|
10
12
|
static authenticate(header: {
|
|
11
13
|
authorization?: string | undefined;
|
|
12
14
|
realm?: Realm;
|
package/dist/Identity.js
CHANGED
|
@@ -1,9 +1,23 @@
|
|
|
1
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
2
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
3
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
4
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5
|
+
};
|
|
6
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
7
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
8
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
9
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
10
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
11
|
+
};
|
|
12
|
+
var _Identity_realms;
|
|
1
13
|
import { userwidgets } from "@userwidgets/model";
|
|
14
|
+
import { Realm } from "./Realm";
|
|
2
15
|
export class Identity {
|
|
3
16
|
constructor(key, realm, organization) {
|
|
4
17
|
this.key = key;
|
|
5
18
|
this.realm = realm;
|
|
6
19
|
this.organization = organization;
|
|
20
|
+
_Identity_realms.set(this, void 0);
|
|
7
21
|
}
|
|
8
22
|
check(constraint, realm, organization) {
|
|
9
23
|
return [
|
|
@@ -13,6 +27,9 @@ export class Identity {
|
|
|
13
27
|
{ [`*-*`]: constraint },
|
|
14
28
|
].some(e => userwidgets.User.Permissions.check(this.key.permissions, e));
|
|
15
29
|
}
|
|
30
|
+
get realms() {
|
|
31
|
+
return (__classPrivateFieldSet(this, _Identity_realms, __classPrivateFieldGet(this, _Identity_realms, "f") ?? Object.keys(this.key.permissions).flatMap(code => code.split("-")[0] == "*" ? Realm.realms : code.split("-")[0]), "f"));
|
|
32
|
+
}
|
|
16
33
|
static async authenticate(header, constraint, verifier = productionVerifier) {
|
|
17
34
|
const authorization = header.authorization?.startsWith("Bearer ")
|
|
18
35
|
? header.authorization.replace("Bearer ", "")
|
|
@@ -23,6 +40,7 @@ export class Identity {
|
|
|
23
40
|
return result?.check(constraint) ? result : undefined;
|
|
24
41
|
}
|
|
25
42
|
}
|
|
43
|
+
_Identity_realms = new WeakMap();
|
|
26
44
|
const publicKey = "MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA2W8CD2kpfS4QIRV2/rgm4NVvsvJsYNMHtnIl9ADvO3A81hAmRKvOAPVoXICe6+EuZ47jGjGL7f48GEoQuITfBPv/MosCDj1YhJ56ILDynCSd8FlxDrhv8pl5IquST7tcL6Hc6m+vuvoTLrFQ5QqNxv0a5eDd/YTrWv7SUuRfBEhYd/wMysGynN3QauHqy5ceBCt1nv1MJLGlSzczMRK7wjy1zi2g9NCHZBOoo1HXOpi727Xh+YXHc9EP2TN0oOXyxykv45nkGIDI0Qek3/pfkavClBffc1sEqA+rUx7YqRN9KGYxwLMLug+NOOh3ptqjfobXbR5fx/sUWhvcjUMTE1JreTrWYbGmVnjd/SeYSClfmGhdTBUfqnZbaABv0ruTXva18qRhP4y143vHMk/k8HzbuROTKAzrtEeLIjgwUgDcnE+JwDqcb8tKSGV6i++TiTldlSBCRTT4dK2hpHJje80b2abqtrbCkxbJlT98UsAAoiq2eW1X6lYmCfiGCJPkfswibQ2tPAKKNe/2xuHPsjx4FuXGmV0dbzmCwSIQoApXqOvKzoNFi6AaKIjxfNmiEigLwKpNrw08H0lVZbq/9MMxI3TzMTZjY9QmBKVLSGy3Z6IJqZpyK22lv7whJcllG0Qw8tv8+7wmC8SR3+4jpuxuFGZ+69CW+otx+CPMJjcCAwEAAQ==";
|
|
27
45
|
const productionVerifier = userwidgets.User.Key.Verifier.create(publicKey);
|
|
28
46
|
//# sourceMappingURL=Identity.js.map
|
package/dist/Identity.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Identity.js","sourceRoot":"../","sources":["Identity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;
|
|
1
|
+
{"version":3,"file":"Identity.js","sourceRoot":"../","sources":["Identity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAEhD,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAE/B,MAAM,OAAO,QAAQ;IACpB,YAAqB,GAAQ,EAAW,KAAa,EAAW,YAAqB;QAAhE,QAAG,GAAH,GAAG,CAAK;QAAW,UAAK,GAAL,KAAK,CAAQ;QAAW,iBAAY,GAAZ,YAAY,CAAS;QASrF,mCAA4B;IAT4D,CAAC;IACzF,KAAK,CAAC,UAA2B,EAAE,KAAa,EAAE,YAAqB;QACtE,OAAO;YACN,EAAE,CAAC,GAAG,KAAK,IAAI,IAAI,CAAC,KAAK,IAAI,YAAY,IAAI,IAAI,CAAC,YAAY,EAAE,CAAC,EAAE,UAAU,EAAE;YAC/E,EAAE,CAAC,GAAG,YAAY,IAAI,IAAI,CAAC,YAAY,EAAE,CAAC,EAAE,UAAU,EAAE;YACxD,EAAE,CAAC,GAAG,KAAK,IAAI,IAAI,CAAC,KAAK,IAAI,CAAC,EAAE,UAAU,EAAE;YAC5C,EAAE,CAAC,KAAK,CAAC,EAAE,UAAU,EAAE;SACvB,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,WAAW,CAAC,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,CAAA;IACzE,CAAC;IAED,IAAI,MAAM;QACT,OAAO,CAAC,sGAAiB,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CACzE,IAAI,CAAC,KAAK,CAAC,GAAG,CA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