@passlock/node 2.0.1 → 2.0.3
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/dist/effect.d.ts +5 -5
- package/dist/effect.d.ts.map +1 -1
- package/dist/effect.js +2 -2
- package/dist/effect.js.map +1 -1
- package/dist/errors.d.ts +71 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +30 -0
- package/dist/errors.js.map +1 -0
- package/dist/index.d.ts +93 -34
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +87 -30
- package/dist/index.js.map +1 -1
- package/dist/network.d.ts +134 -0
- package/dist/network.d.ts.map +1 -0
- package/dist/network.js +172 -0
- package/dist/network.js.map +1 -0
- package/dist/passkey/passkey.d.ts +132 -0
- package/dist/passkey/passkey.d.ts.map +1 -0
- package/dist/passkey/passkey.js +158 -0
- package/dist/passkey/passkey.js.map +1 -0
- package/dist/principal/principal.d.ts +22 -0
- package/dist/principal/principal.d.ts.map +1 -0
- package/dist/{principal.js → principal/principal.js} +28 -27
- package/dist/principal/principal.js.map +1 -0
- package/dist/safe.d.ts +154 -0
- package/dist/safe.d.ts.map +1 -0
- package/dist/safe.js +147 -0
- package/dist/safe.js.map +1 -0
- package/dist/schemas/errors.d.ts +0 -75
- package/dist/schemas/errors.d.ts.map +1 -1
- package/dist/schemas/errors.js +51 -22
- package/dist/schemas/errors.js.map +1 -1
- package/dist/schemas/passkey.d.ts +41 -19
- package/dist/schemas/passkey.d.ts.map +1 -1
- package/dist/schemas/passkey.js +21 -16
- package/dist/schemas/passkey.js.map +1 -1
- package/dist/schemas/principal.d.ts +46 -6
- package/dist/schemas/principal.d.ts.map +1 -1
- package/dist/schemas/principal.js +6 -6
- package/dist/schemas/principal.js.map +1 -1
- package/dist/schemas/satisfy.d.ts +2 -0
- package/dist/schemas/satisfy.d.ts.map +1 -0
- package/dist/schemas/satisfy.js +2 -0
- package/dist/schemas/satisfy.js.map +1 -0
- package/dist/shared.d.ts +3 -5
- package/dist/shared.d.ts.map +1 -1
- package/dist/shared.js +0 -3
- package/dist/shared.js.map +1 -1
- package/package.json +21 -22
- package/dist/passkey.d.ts +0 -24
- package/dist/passkey.d.ts.map +0 -1
- package/dist/passkey.js +0 -87
- package/dist/passkey.js.map +0 -1
- package/dist/principal.d.ts +0 -18
- package/dist/principal.d.ts.map +0 -1
- package/dist/principal.js.map +0 -1
- package/dist/testUtils.d.ts +0 -11
- package/dist/testUtils.d.ts.map +0 -1
- package/dist/testUtils.js +0 -25
- package/dist/testUtils.js.map +0 -1
- package/dist/unsafe.d.ts +0 -55
- package/dist/unsafe.d.ts.map +0 -1
- package/dist/unsafe.js +0 -52
- package/dist/unsafe.js.map +0 -1
package/dist/schemas/errors.js
CHANGED
|
@@ -1,43 +1,72 @@
|
|
|
1
1
|
import { Schema } from "effect";
|
|
2
|
-
|
|
2
|
+
/* Unauthorized */
|
|
3
|
+
/** @internal */
|
|
4
|
+
export class UnauthorizedError extends Schema.TaggedError()("@error/Unauthorized", {}) {
|
|
3
5
|
}
|
|
4
|
-
|
|
5
|
-
export
|
|
6
|
+
/** @internal */
|
|
7
|
+
export const isUnauthorizedError = (payload) => Schema.is(UnauthorizedError)(payload);
|
|
8
|
+
/* Forbidden */
|
|
9
|
+
/** @internal */
|
|
10
|
+
export class ForbiddenError extends Schema.TaggedError()("@error/Forbidden", {}) {
|
|
6
11
|
}
|
|
7
|
-
|
|
8
|
-
export
|
|
12
|
+
/** @internal */
|
|
13
|
+
export const isForbiddenError = (payload) => Schema.is(ForbiddenError)(payload);
|
|
14
|
+
/* InvalidCode */
|
|
15
|
+
/** @internal */
|
|
16
|
+
export class InvalidCodeError extends Schema.TaggedError()("@error/InvalidCode", {
|
|
9
17
|
message: Schema.String,
|
|
10
18
|
}) {
|
|
11
19
|
}
|
|
12
|
-
|
|
13
|
-
export
|
|
20
|
+
/** @internal */
|
|
21
|
+
export const isInvalidCodeError = (payload) => Schema.is(InvalidCodeError)(payload);
|
|
22
|
+
/* InvalidTenancy */
|
|
23
|
+
/** @internal */
|
|
24
|
+
export class InvalidTenancyError extends Schema.TaggedError()("@error/InvalidTenancy", {
|
|
14
25
|
message: Schema.String,
|
|
15
26
|
}) {
|
|
16
27
|
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
export class PasskeyNotFound extends Schema.TaggedError("@error/PasskeyNotFound")("@error/PasskeyNotFound", {
|
|
28
|
+
/** @internal */
|
|
29
|
+
export const isInvalidTenancyError = (payload) => Schema.is(InvalidTenancyError)(payload);
|
|
30
|
+
/* PasskeyNotFound */
|
|
31
|
+
/** @internal */
|
|
32
|
+
export class PasskeyNotFoundError extends Schema.TaggedError()("@error/PasskeyNotFound", {
|
|
23
33
|
credentialId: Schema.String,
|
|
24
34
|
message: Schema.String,
|
|
25
35
|
rpId: Schema.String,
|
|
26
36
|
}) {
|
|
27
37
|
}
|
|
28
|
-
|
|
29
|
-
export
|
|
38
|
+
/** @internal */
|
|
39
|
+
export const isPasskeyNotFoundError = (payload) => Schema.is(PasskeyNotFoundError)(payload);
|
|
40
|
+
/* NotFound */
|
|
41
|
+
/** @internal */
|
|
42
|
+
export class NotFoundError extends Schema.TaggedError()("@error/NotFound", {
|
|
30
43
|
message: Schema.String,
|
|
31
44
|
}) {
|
|
32
45
|
}
|
|
33
|
-
|
|
34
|
-
export
|
|
46
|
+
/** @internal */
|
|
47
|
+
export const isNotFoundError = (payload) => Schema.is(NotFoundError)(payload);
|
|
48
|
+
/* InvalidEmail */
|
|
49
|
+
/** @internal */
|
|
50
|
+
export class InvalidEmailError extends Schema.TaggedError()("@error/InvalidEmail", {
|
|
51
|
+
message: Schema.String,
|
|
52
|
+
}) {
|
|
35
53
|
}
|
|
36
|
-
|
|
37
|
-
export
|
|
54
|
+
/** @internal */
|
|
55
|
+
export const isInvalidEmailError = (payload) => Schema.is(InvalidEmailError)(payload);
|
|
56
|
+
/* DuplicateEmail */
|
|
57
|
+
/** @internal */
|
|
58
|
+
export class DuplicateEmailError extends Schema.TaggedError()("@error/DuplicateEmail", {
|
|
59
|
+
message: Schema.String,
|
|
60
|
+
}) {
|
|
38
61
|
}
|
|
39
|
-
|
|
40
|
-
export
|
|
62
|
+
/** @internal */
|
|
63
|
+
export const isDuplicateEmailError = (payload) => Schema.is(DuplicateEmailError)(payload);
|
|
64
|
+
/* BadRequest */
|
|
65
|
+
/** @internal */
|
|
66
|
+
export class BadRequestError extends Schema.TaggedError()("@error/BadRequest", {
|
|
67
|
+
message: Schema.String,
|
|
68
|
+
}) {
|
|
41
69
|
}
|
|
42
|
-
|
|
70
|
+
/** @internal */
|
|
71
|
+
export const isBadRequestError = (payload) => Schema.is(BadRequestError)(payload);
|
|
43
72
|
//# sourceMappingURL=errors.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/schemas/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAE/B,MAAM,OAAO,
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/schemas/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAE/B,kBAAkB;AAElB,gBAAgB;AAChB,MAAM,OAAO,iBAAkB,SAAQ,MAAM,CAAC,WAAW,EAAqB,CAC5E,qBAAqB,EACrB,EAAE,CACH;CAAG;AAEJ,gBAAgB;AAChB,MAAM,CAAC,MAAM,mBAAmB,GAAG,CACjC,OAAgB,EACc,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC,iBAAiB,CAAC,CAAC,OAAO,CAAC,CAAA;AAExE,eAAe;AAEf,gBAAgB;AAChB,MAAM,OAAO,cAAe,SAAQ,MAAM,CAAC,WAAW,EAAkB,CACtE,kBAAkB,EAClB,EAAE,CACH;CAAG;AAEJ,gBAAgB;AAChB,MAAM,CAAC,MAAM,gBAAgB,G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AC,MAAM;CACvB,CACF;CAAG;AAEJ,gBAAgB;AAChB,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,OAAgB,EAA4B,EAAE,CAC5E,MAAM,CAAC,EAAE,CAAC,aAAa,CAAC,CAAC,OAAO,CAAC,CAAA;AAEnC,kBAAkB;AAElB,gBAAgB;AAChB,MAAM,OAAO,iBAAkB,SAAQ,MAAM,CAAC,WAAW,EAAqB,CAC5E,qBAAqB,EACrB;IACE,OAAO,EAAE,MAAM,CAAC,MAAM;CACvB,CACF;CAAG;AAEJ,gBAAgB;AAChB,MAAM,CAAC,MAAM,mBAAmB,GAAG,CACjC,OAAgB,EACc,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC,iBAAiB,CAAC,CAAC,OAAO,CAAC,CAAA;AAExE,oBAAoB;AAEpB,gBAAgB;AAChB,MAAM,OAAO,mBAAoB,SAAQ,MAAM,CAAC,WAAW,EAAuB,CAChF,uBAAuB,EACvB;IACE,OAAO,EAAE,MAAM,CAAC,MAAM;CACvB,CACF;CAAG;AAEJ,gBAAgB;AAChB,MAAM,CAAC,MAAM,qBAAqB,GAAG,CACnC,OAAgB,EACgB,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC,mBAAmB,CAAC,CAAC,OAAO,CAAC,CAAA;AAE5E,gBAAgB;AAEhB,gBAAgB;AAChB,MAAM,OAAO,eAAgB,SAAQ,MAAM,CAAC,WAAW,EAAmB,CACxE,mBAAmB,EACnB;IACE,OAAO,EAAE,MAAM,CAAC,MAAM;CACvB,CACF;CAAG;AAEJ,gBAAgB;AAChB,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAC/B,OAAgB,EACY,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC,eAAe,CAAC,CAAC,OAAO,CAAC,CAAA","sourcesContent":["import { Schema } from \"effect\"\n\n/* Unauthorized */\n\n/** @internal */\nexport class UnauthorizedError extends Schema.TaggedError<UnauthorizedError>()(\n \"@error/Unauthorized\",\n {}\n) {}\n\n/** @internal */\nexport const isUnauthorizedError = (\n payload: unknown\n): payload is UnauthorizedError => Schema.is(UnauthorizedError)(payload)\n\n/* Forbidden */\n\n/** @internal */\nexport class ForbiddenError extends Schema.TaggedError<ForbiddenError>()(\n \"@error/Forbidden\",\n {}\n) {}\n\n/** @internal */\nexport const isForbiddenError = (payload: unknown): payload is ForbiddenError =>\n Schema.is(ForbiddenError)(payload)\n\n/* InvalidCode */\n\n/** @internal */\nexport class InvalidCodeError extends Schema.TaggedError<InvalidCodeError>()(\n \"@error/InvalidCode\",\n {\n message: Schema.String,\n }\n) {}\n\n/** @internal */\nexport const isInvalidCodeError = (\n payload: unknown\n): payload is InvalidCodeError => Schema.is(InvalidCodeError)(payload)\n\n/* InvalidTenancy */\n\n/** @internal */\nexport class InvalidTenancyError extends Schema.TaggedError<InvalidTenancyError>()(\n \"@error/InvalidTenancy\",\n {\n message: Schema.String,\n }\n) {}\n\n/** @internal */\nexport const isInvalidTenancyError = (\n payload: unknown\n): payload is InvalidTenancyError => Schema.is(InvalidTenancyError)(payload)\n\n/* PasskeyNotFound */\n\n/** @internal */\nexport class PasskeyNotFoundError extends Schema.TaggedError<PasskeyNotFoundError>()(\n \"@error/PasskeyNotFound\",\n {\n credentialId: Schema.String,\n message: Schema.String,\n rpId: Schema.String,\n }\n) {}\n\n/** @internal */\nexport const isPasskeyNotFoundError = (\n payload: unknown\n): payload is PasskeyNotFoundError => Schema.is(PasskeyNotFoundError)(payload)\n\n/* NotFound */\n\n/** @internal */\nexport class NotFoundError extends Schema.TaggedError<NotFoundError>()(\n \"@error/NotFound\",\n {\n message: Schema.String,\n }\n) {}\n\n/** @internal */\nexport const isNotFoundError = (payload: unknown): payload is NotFoundError =>\n Schema.is(NotFoundError)(payload)\n\n/* InvalidEmail */\n\n/** @internal */\nexport class InvalidEmailError extends Schema.TaggedError<InvalidEmailError>()(\n \"@error/InvalidEmail\",\n {\n message: Schema.String,\n }\n) {}\n\n/** @internal */\nexport const isInvalidEmailError = (\n payload: unknown\n): payload is InvalidEmailError => Schema.is(InvalidEmailError)(payload)\n\n/* DuplicateEmail */\n\n/** @internal */\nexport class DuplicateEmailError extends Schema.TaggedError<DuplicateEmailError>()(\n \"@error/DuplicateEmail\",\n {\n message: Schema.String,\n }\n) {}\n\n/** @internal */\nexport const isDuplicateEmailError = (\n payload: unknown\n): payload is DuplicateEmailError => Schema.is(DuplicateEmailError)(payload)\n\n/* BadRequest */\n\n/** @internal */\nexport class BadRequestError extends Schema.TaggedError<BadRequestError>()(\n \"@error/BadRequest\",\n {\n message: Schema.String,\n }\n) {}\n\n/** @internal */\nexport const isBadRequestError = (\n payload: unknown\n): payload is BadRequestError => Schema.is(BadRequestError)(payload)\n"]}
|
|
@@ -1,63 +1,85 @@
|
|
|
1
1
|
import { Schema } from "effect";
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const UserVerification: Schema.Literal<["required", "preferred", "discouraged"]>;
|
|
3
3
|
export declare const CredentialDeviceType: readonly ["singleDevice", "multiDevice"];
|
|
4
4
|
export type CredentialDeviceType = (typeof CredentialDeviceType)[number];
|
|
5
5
|
export declare const Transports: readonly ["ble", "hybrid", "internal", "nfc", "usb", "cable", "smart-card"];
|
|
6
6
|
export type Transports = (typeof Transports)[number];
|
|
7
7
|
export declare const Passkey: Schema.TaggedStruct<"Passkey", {
|
|
8
|
-
|
|
8
|
+
id: typeof Schema.String;
|
|
9
|
+
userId: Schema.optional<typeof Schema.String>;
|
|
10
|
+
enabled: typeof Schema.Boolean;
|
|
9
11
|
credential: Schema.Struct<{
|
|
12
|
+
id: typeof Schema.String;
|
|
13
|
+
userId: typeof Schema.String;
|
|
14
|
+
username: typeof Schema.String;
|
|
10
15
|
aaguid: typeof Schema.String;
|
|
11
16
|
backedUp: typeof Schema.Boolean;
|
|
12
17
|
counter: typeof Schema.Number;
|
|
13
18
|
deviceType: Schema.Literal<["singleDevice", "multiDevice"]>;
|
|
14
|
-
id: typeof Schema.String;
|
|
15
19
|
transports: Schema.Array$<Schema.Literal<["ble", "hybrid", "internal", "nfc", "usb", "cable", "smart-card"]>>;
|
|
16
|
-
|
|
20
|
+
publicKey: Schema.Schema<Uint8Array<ArrayBufferLike>, string, never>;
|
|
21
|
+
rpId: typeof Schema.String;
|
|
17
22
|
}>;
|
|
18
|
-
enabled: typeof Schema.Boolean;
|
|
19
|
-
id: typeof Schema.String;
|
|
20
|
-
lastUsed: Schema.optional<typeof Schema.Number>;
|
|
21
23
|
platform: Schema.optional<Schema.Struct<{
|
|
22
24
|
icon: Schema.optional<typeof Schema.String>;
|
|
23
25
|
name: Schema.optional<typeof Schema.String>;
|
|
24
26
|
}>>;
|
|
27
|
+
lastUsed: Schema.optional<typeof Schema.Number>;
|
|
28
|
+
createdAt: typeof Schema.Number;
|
|
25
29
|
updatedAt: typeof Schema.Number;
|
|
26
|
-
userId: Schema.optional<typeof Schema.String>;
|
|
27
30
|
}>;
|
|
28
31
|
export type Passkey = typeof Passkey.Type;
|
|
29
|
-
export
|
|
32
|
+
export type PasskeyEncoded = typeof Passkey.Encoded;
|
|
30
33
|
export declare const PasskeySummary: Schema.TaggedStruct<"PasskeySummary", {
|
|
31
34
|
id: typeof Schema.String;
|
|
32
35
|
userId: typeof Schema.String;
|
|
33
36
|
credential: Schema.Struct<{
|
|
34
|
-
|
|
37
|
+
id: typeof Schema.String;
|
|
38
|
+
userId: typeof Schema.String;
|
|
35
39
|
}>;
|
|
36
40
|
enabled: typeof Schema.Boolean;
|
|
37
41
|
createdAt: typeof Schema.Number;
|
|
38
42
|
lastUsed: Schema.optional<typeof Schema.Number>;
|
|
39
43
|
}>;
|
|
40
44
|
export type PasskeySummary = typeof PasskeySummary.Type;
|
|
41
|
-
export declare const isPasskeySummary: (payload: unknown) => payload is PasskeySummary;
|
|
42
45
|
export declare const FindAllPasskeys: Schema.TaggedStruct<"FindAllPasskeys", {
|
|
43
46
|
cursor: Schema.NullOr<typeof Schema.String>;
|
|
44
47
|
records: Schema.Array$<Schema.TaggedStruct<"PasskeySummary", {
|
|
45
48
|
id: typeof Schema.String;
|
|
46
49
|
userId: typeof Schema.String;
|
|
47
50
|
credential: Schema.Struct<{
|
|
48
|
-
|
|
51
|
+
id: typeof Schema.String;
|
|
52
|
+
userId: typeof Schema.String;
|
|
49
53
|
}>;
|
|
50
54
|
enabled: typeof Schema.Boolean;
|
|
51
55
|
createdAt: typeof Schema.Number;
|
|
52
56
|
lastUsed: Schema.optional<typeof Schema.Number>;
|
|
53
57
|
}>>;
|
|
54
58
|
}>;
|
|
55
|
-
export
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
59
|
+
export declare const UpdatedPasskeys: Schema.TaggedStruct<"UpdatedPasskeys", {
|
|
60
|
+
updated: Schema.Array$<Schema.TaggedStruct<"Passkey", {
|
|
61
|
+
id: typeof Schema.String;
|
|
62
|
+
userId: Schema.optional<typeof Schema.String>;
|
|
63
|
+
enabled: typeof Schema.Boolean;
|
|
64
|
+
credential: Schema.Struct<{
|
|
65
|
+
id: typeof Schema.String;
|
|
66
|
+
userId: typeof Schema.String;
|
|
67
|
+
username: typeof Schema.String;
|
|
68
|
+
aaguid: typeof Schema.String;
|
|
69
|
+
backedUp: typeof Schema.Boolean;
|
|
70
|
+
counter: typeof Schema.Number;
|
|
71
|
+
deviceType: Schema.Literal<["singleDevice", "multiDevice"]>;
|
|
72
|
+
transports: Schema.Array$<Schema.Literal<["ble", "hybrid", "internal", "nfc", "usb", "cable", "smart-card"]>>;
|
|
73
|
+
publicKey: Schema.Schema<Uint8Array<ArrayBufferLike>, string, never>;
|
|
74
|
+
rpId: typeof Schema.String;
|
|
75
|
+
}>;
|
|
76
|
+
platform: Schema.optional<Schema.Struct<{
|
|
77
|
+
icon: Schema.optional<typeof Schema.String>;
|
|
78
|
+
name: Schema.optional<typeof Schema.String>;
|
|
79
|
+
}>>;
|
|
80
|
+
lastUsed: Schema.optional<typeof Schema.Number>;
|
|
81
|
+
createdAt: typeof Schema.Number;
|
|
82
|
+
updatedAt: typeof Schema.Number;
|
|
83
|
+
}>>;
|
|
60
84
|
}>;
|
|
61
|
-
export type DeletedPasskey = typeof DeletedPasskey.Type;
|
|
62
|
-
export declare const isDeletedPasskey: (payload: unknown) => payload is DeletedPasskey;
|
|
63
85
|
//# sourceMappingURL=passkey.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"passkey.d.ts","sourceRoot":"","sources":["../../src/schemas/passkey.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;
|
|
1
|
+
{"version":3,"file":"passkey.d.ts","sourceRoot":"","sources":["../../src/schemas/passkey.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAW/B,eAAO,MAAM,gBAAgB,0DAI5B,CAAA;AAID,eAAO,MAAM,oBAAoB,0CAA2C,CAAA;AAC5E,MAAM,MAAM,oBAAoB,GAAG,CAAC,OAAO,oBAAoB,CAAC,CAAC,MAAM,CAAC,CAAA;AAExE,eAAO,MAAM,UAAU,6EAQb,CAAA;AACV,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,UAAU,CAAC,CAAC,MAAM,CAAC,CAAA;AAIpD,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;EAyBlB,CAAA;AAEF,MAAM,MAAM,OAAO,GAAG,OAAO,OAAO,CAAC,IAAI,CAAA;AAEzC,MAAM,MAAM,cAAc,GAAG,OAAO,OAAO,CAAC,OAAO,CAAA;AAEnD,eAAO,MAAM,cAAc;;;;;;;;;;EAUzB,CAAA;AAEF,MAAM,MAAM,cAAc,GAAG,OAAO,cAAc,CAAC,IAAI,CAAA;AAEvD,eAAO,MAAM,eAAe;;;;;;;;;;;;;EAG1B,CAAA;AAEF,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;EAE1B,CAAA"}
|
package/dist/schemas/passkey.js
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import { Schema } from "effect";
|
|
2
|
+
/*
|
|
3
|
+
* Important. We don't use `type X = typeof X.Type` because it won't generate
|
|
4
|
+
* the Typedoc docs, so instead we mirror the types and use a dummy
|
|
5
|
+
* `type _x = satisfy<typeof X.Type, X>`
|
|
6
|
+
* kind of a type level satisfies
|
|
7
|
+
*/
|
|
2
8
|
/* Registration Options */
|
|
3
|
-
export const
|
|
9
|
+
export const UserVerification = Schema.Literal("required", "preferred", "discouraged");
|
|
4
10
|
/* Passkey */
|
|
5
11
|
export const CredentialDeviceType = ["singleDevice", "multiDevice"];
|
|
6
12
|
export const Transports = [
|
|
@@ -14,46 +20,45 @@ export const Transports = [
|
|
|
14
20
|
];
|
|
15
21
|
/* Passkey */
|
|
16
22
|
export const Passkey = Schema.TaggedStruct("Passkey", {
|
|
17
|
-
|
|
23
|
+
id: Schema.String,
|
|
24
|
+
userId: Schema.optional(Schema.String),
|
|
25
|
+
enabled: Schema.Boolean,
|
|
18
26
|
credential: Schema.Struct({
|
|
27
|
+
id: Schema.String, // webAuthnId (Base64Url)
|
|
28
|
+
userId: Schema.String, // webAuthnUserId (Base64Url)
|
|
29
|
+
username: Schema.String,
|
|
19
30
|
aaguid: Schema.String,
|
|
20
31
|
backedUp: Schema.Boolean,
|
|
21
32
|
counter: Schema.Number,
|
|
22
33
|
deviceType: Schema.Literal(...CredentialDeviceType),
|
|
23
|
-
id: Schema.String, // webAuthnId (Base64Url)
|
|
24
34
|
transports: Schema.Array(Schema.Literal(...Transports)),
|
|
25
|
-
|
|
35
|
+
publicKey: Schema.Uint8ArrayFromBase64Url,
|
|
36
|
+
rpId: Schema.String,
|
|
26
37
|
}),
|
|
27
|
-
enabled: Schema.Boolean,
|
|
28
|
-
id: Schema.String,
|
|
29
|
-
lastUsed: Schema.optional(Schema.Number),
|
|
30
38
|
platform: Schema.optional(Schema.Struct({
|
|
31
39
|
icon: Schema.optional(Schema.String),
|
|
32
40
|
name: Schema.optional(Schema.String),
|
|
33
41
|
})),
|
|
42
|
+
lastUsed: Schema.optional(Schema.Number),
|
|
43
|
+
createdAt: Schema.Number,
|
|
34
44
|
updatedAt: Schema.Number,
|
|
35
|
-
userId: Schema.optional(Schema.String),
|
|
36
45
|
});
|
|
37
|
-
export const isPasskey = (payload) => Schema.is(Passkey)(payload);
|
|
38
46
|
export const PasskeySummary = Schema.TaggedStruct("PasskeySummary", {
|
|
39
47
|
id: Schema.String,
|
|
40
48
|
userId: Schema.String,
|
|
41
49
|
credential: Schema.Struct({
|
|
42
|
-
|
|
50
|
+
id: Schema.String,
|
|
51
|
+
userId: Schema.String,
|
|
43
52
|
}),
|
|
44
53
|
enabled: Schema.Boolean,
|
|
45
54
|
createdAt: Schema.Number,
|
|
46
55
|
lastUsed: Schema.optional(Schema.Number),
|
|
47
56
|
});
|
|
48
|
-
export const isPasskeySummary = (payload) => Schema.is(PasskeySummary)(payload);
|
|
49
57
|
export const FindAllPasskeys = Schema.TaggedStruct("FindAllPasskeys", {
|
|
50
58
|
cursor: Schema.NullOr(Schema.String),
|
|
51
59
|
records: Schema.Array(PasskeySummary),
|
|
52
60
|
});
|
|
53
|
-
export const
|
|
54
|
-
|
|
55
|
-
credentialId: Schema.String,
|
|
56
|
-
rpId: Schema.String,
|
|
61
|
+
export const UpdatedPasskeys = Schema.TaggedStruct("UpdatedPasskeys", {
|
|
62
|
+
updated: Schema.Array(Passkey),
|
|
57
63
|
});
|
|
58
|
-
export const isDeletedPasskey = (payload) => Schema.is(DeletedPasskey)(payload);
|
|
59
64
|
//# sourceMappingURL=passkey.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"passkey.js","sourceRoot":"","sources":["../../src/schemas/passkey.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAE/B,0BAA0B;AAE1B,MAAM,CAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"passkey.js","sourceRoot":"","sources":["../../src/schemas/passkey.ts"],"names":[],"mappings":"AA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AE,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC;QACpC,IAAI,EAAE,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC;KACrC,CAAC,CACH;IACD,QAAQ,EAAE,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC;IACxC,SAAS,EAAE,MAAM,CAAC,MAAM;IACxB,SAAS,EAAE,MAAM,CAAC,MAAM;CACzB,CAAC,CAAA;AAMF,MAAM,CAAC,MAAM,cAAc,GAAG,MAAM,CAAC,YAAY,CAAC,gBAAgB,EAAE;IAClE,EAAE,EAAE,MAAM,CAAC,MAAM;IACjB,MAAM,EAAE,MAAM,CAAC,MAAM;IACrB,UAAU,EAAE,MAAM,CAAC,MAAM,CAAC;QACxB,EAAE,EAAE,MAAM,CAAC,MAAM;QACjB,MAAM,EAAE,MAAM,CAAC,MAAM;KACtB,CAAC;IACF,OAAO,EAAE,MAAM,CAAC,OAAO;IACvB,SAAS,EAAE,MAAM,CAAC,MAAM;IACxB,QAAQ,EAAE,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC;CACzC,CAAC,CAAA;AAIF,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,CAAC,YAAY,CAAC,iBAAiB,EAAE;IACpE,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC;IACpC,OAAO,EAAE,MAAM,CAAC,KAAK,CAAC,cAAc,CAAC;CACtC,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,CAAC,YAAY,CAAC,iBAAiB,EAAE;IACpE,OAAO,EAAE,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC;CAC/B,CAAC,CAAA","sourcesContent":["import { Schema } from \"effect\"\n\n/*\n * Important. We don't use `type X = typeof X.Type` because it won't generate\n * the Typedoc docs, so instead we mirror the types and use a dummy\n * `type _x = satisfy<typeof X.Type, X>`\n * kind of a type level satisfies\n */\n\n/* Registration Options */\n\nexport const UserVerification = Schema.Literal(\n \"required\",\n \"preferred\",\n \"discouraged\"\n)\n\n/* Passkey */\n\nexport const CredentialDeviceType = [\"singleDevice\", \"multiDevice\"] as const\nexport type CredentialDeviceType = (typeof CredentialDeviceType)[number]\n\nexport const Transports = [\n \"ble\",\n \"hybrid\",\n \"internal\",\n \"nfc\",\n \"usb\",\n \"cable\",\n \"smart-card\",\n] as const\nexport type Transports = (typeof Transports)[number]\n\n/* Passkey */\n\nexport const Passkey = Schema.TaggedStruct(\"Passkey\", {\n id: Schema.String,\n userId: Schema.optional(Schema.String),\n enabled: Schema.Boolean,\n credential: Schema.Struct({\n id: Schema.String, // webAuthnId (Base64Url)\n userId: Schema.String, // webAuthnUserId (Base64Url)\n username: Schema.String,\n aaguid: Schema.String,\n backedUp: Schema.Boolean,\n counter: Schema.Number,\n deviceType: Schema.Literal(...CredentialDeviceType),\n transports: Schema.Array(Schema.Literal(...Transports)),\n publicKey: Schema.Uint8ArrayFromBase64Url,\n rpId: Schema.String,\n }),\n platform: Schema.optional(\n Schema.Struct({\n icon: Schema.optional(Schema.String),\n name: Schema.optional(Schema.String),\n })\n ),\n lastUsed: Schema.optional(Schema.Number),\n createdAt: Schema.Number,\n updatedAt: Schema.Number,\n})\n\nexport type Passkey = typeof Passkey.Type\n\nexport type PasskeyEncoded = typeof Passkey.Encoded\n\nexport const PasskeySummary = Schema.TaggedStruct(\"PasskeySummary\", {\n id: Schema.String,\n userId: Schema.String,\n credential: Schema.Struct({\n id: Schema.String,\n userId: Schema.String,\n }),\n enabled: Schema.Boolean,\n createdAt: Schema.Number,\n lastUsed: Schema.optional(Schema.Number),\n})\n\nexport type PasskeySummary = typeof PasskeySummary.Type\n\nexport const FindAllPasskeys = Schema.TaggedStruct(\"FindAllPasskeys\", {\n cursor: Schema.NullOr(Schema.String),\n records: Schema.Array(PasskeySummary),\n})\n\nexport const UpdatedPasskeys = Schema.TaggedStruct(\"UpdatedPasskeys\", {\n updated: Schema.Array(Passkey),\n})\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Schema } from "effect";
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const PrincipalSchema: Schema.TaggedStruct<"Principal", {
|
|
3
3
|
id: typeof Schema.String;
|
|
4
4
|
authenticatorId: typeof Schema.String;
|
|
5
5
|
authenticatorType: Schema.Literal<["passkey"]>;
|
|
@@ -11,9 +11,21 @@ export declare const Principal: Schema.TaggedStruct<"Principal", {
|
|
|
11
11
|
}>>;
|
|
12
12
|
userId: typeof Schema.String;
|
|
13
13
|
}>;
|
|
14
|
-
export type Principal =
|
|
14
|
+
export type Principal = {
|
|
15
|
+
readonly _tag: "Principal";
|
|
16
|
+
readonly id: string;
|
|
17
|
+
readonly userId: string;
|
|
18
|
+
readonly createdAt: number;
|
|
19
|
+
readonly authenticatorId: string;
|
|
20
|
+
readonly authenticatorType: "passkey";
|
|
21
|
+
readonly passkey?: {
|
|
22
|
+
readonly userVerified: boolean;
|
|
23
|
+
readonly verified: boolean;
|
|
24
|
+
} | undefined;
|
|
25
|
+
readonly expiresAt: number;
|
|
26
|
+
};
|
|
15
27
|
export declare const isPrincipal: (payload: unknown) => payload is Principal;
|
|
16
|
-
export declare const
|
|
28
|
+
export declare const ExtendedPrincipalSchema: Schema.TaggedStruct<"ExtendedPrincipal", {
|
|
17
29
|
id: typeof Schema.String;
|
|
18
30
|
authenticatorId: typeof Schema.String;
|
|
19
31
|
authenticatorType: Schema.Literal<["passkey"]>;
|
|
@@ -30,9 +42,26 @@ export declare const ExtendedPrincipal: Schema.TaggedStruct<"ExtendedPrincipal",
|
|
|
30
42
|
userAgent: Schema.optional<typeof Schema.String>;
|
|
31
43
|
}>;
|
|
32
44
|
}>;
|
|
33
|
-
export type ExtendedPrincipal =
|
|
45
|
+
export type ExtendedPrincipal = {
|
|
46
|
+
readonly _tag: "ExtendedPrincipal";
|
|
47
|
+
readonly id: string;
|
|
48
|
+
readonly authenticatorId: string;
|
|
49
|
+
readonly authenticatorType: "passkey";
|
|
50
|
+
readonly passkey?: {
|
|
51
|
+
readonly userVerified: boolean;
|
|
52
|
+
readonly verified: boolean;
|
|
53
|
+
readonly platformName?: string | undefined;
|
|
54
|
+
} | undefined;
|
|
55
|
+
readonly createdAt: number;
|
|
56
|
+
readonly expiresAt: number;
|
|
57
|
+
readonly userId: string;
|
|
58
|
+
readonly metadata: {
|
|
59
|
+
readonly ipAddress?: string | undefined;
|
|
60
|
+
readonly userAgent?: string | undefined;
|
|
61
|
+
};
|
|
62
|
+
};
|
|
34
63
|
export declare const isExtendedPrincipal: (payload: unknown) => payload is ExtendedPrincipal;
|
|
35
|
-
export declare const
|
|
64
|
+
export declare const IdTokenSchema: Schema.TaggedStruct<"IdToken", {
|
|
36
65
|
"a:id": typeof Schema.String;
|
|
37
66
|
"a:typ": typeof Schema.String;
|
|
38
67
|
aud: typeof Schema.String;
|
|
@@ -43,6 +72,17 @@ export declare const IdToken: Schema.TaggedStruct<"IdToken", {
|
|
|
43
72
|
"pk:uv": typeof Schema.Boolean;
|
|
44
73
|
sub: typeof Schema.String;
|
|
45
74
|
}>;
|
|
46
|
-
export type IdToken =
|
|
75
|
+
export type IdToken = {
|
|
76
|
+
readonly "a:id": string;
|
|
77
|
+
readonly "a:typ": string;
|
|
78
|
+
readonly aud: string;
|
|
79
|
+
readonly exp: number;
|
|
80
|
+
readonly iat: number;
|
|
81
|
+
readonly iss: "passlock.dev";
|
|
82
|
+
readonly jti: string;
|
|
83
|
+
readonly "pk:uv": boolean;
|
|
84
|
+
readonly sub: string;
|
|
85
|
+
readonly _tag: "IdToken";
|
|
86
|
+
};
|
|
47
87
|
export declare const isIdToken: (payload: unknown) => payload is IdToken;
|
|
48
88
|
//# sourceMappingURL=principal.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"principal.d.ts","sourceRoot":"","sources":["../../src/schemas/principal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE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3C,GACD,SAAS,CAAA;IACb,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;IAC1B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;IAC1B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,QAAQ,EAAE;QACjB,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;QACvC,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;KACxC,CAAA;CACF,CAAA;AAED,eAAO,MAAM,mBAAmB,GAC9B,SAAS,OAAO,KACf,OAAO,IAAI,iBAAgE,CAAA;AAO9E,eAAO,MAAM,aAAa;;;;;;;;;;EAUxB,CAAA;AAEF,MAAM,MAAM,OAAO,GAAG;IACpB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,GAAG,EAAE,cAAc,CAAA;IAC5B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAA;IACzB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAA;CACzB,CAAA;AAED,eAAO,MAAM,SAAS,GAAI,SAAS,OAAO,KAAG,OAAO,IAAI,OACrB,CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Schema } from "effect";
|
|
2
2
|
/* Principal */
|
|
3
|
-
export const
|
|
3
|
+
export const PrincipalSchema = Schema.TaggedStruct("Principal", {
|
|
4
4
|
id: Schema.String,
|
|
5
5
|
authenticatorId: Schema.String,
|
|
6
6
|
authenticatorType: Schema.Literal("passkey"),
|
|
@@ -12,8 +12,8 @@ export const Principal = Schema.TaggedStruct("Principal", {
|
|
|
12
12
|
})),
|
|
13
13
|
userId: Schema.String,
|
|
14
14
|
});
|
|
15
|
-
export const isPrincipal = (payload) => Schema.is(
|
|
16
|
-
export const
|
|
15
|
+
export const isPrincipal = (payload) => Schema.is(PrincipalSchema)(payload);
|
|
16
|
+
export const ExtendedPrincipalSchema = Schema.TaggedStruct("ExtendedPrincipal", {
|
|
17
17
|
id: Schema.String,
|
|
18
18
|
authenticatorId: Schema.String,
|
|
19
19
|
authenticatorType: Schema.Literal("passkey"),
|
|
@@ -30,8 +30,8 @@ export const ExtendedPrincipal = Schema.TaggedStruct("ExtendedPrincipal", {
|
|
|
30
30
|
userAgent: Schema.optional(Schema.String),
|
|
31
31
|
}),
|
|
32
32
|
});
|
|
33
|
-
export const isExtendedPrincipal = (payload) => Schema.is(
|
|
34
|
-
export const
|
|
33
|
+
export const isExtendedPrincipal = (payload) => Schema.is(ExtendedPrincipalSchema)(payload);
|
|
34
|
+
export const IdTokenSchema = Schema.TaggedStruct("IdToken", {
|
|
35
35
|
"a:id": Schema.String,
|
|
36
36
|
"a:typ": Schema.String,
|
|
37
37
|
aud: Schema.String,
|
|
@@ -42,5 +42,5 @@ export const IdToken = Schema.TaggedStruct("IdToken", {
|
|
|
42
42
|
"pk:uv": Schema.Boolean,
|
|
43
43
|
sub: Schema.String,
|
|
44
44
|
});
|
|
45
|
-
export const isIdToken = (payload) => Schema.is(
|
|
45
|
+
export const isIdToken = (payload) => Schema.is(IdTokenSchema)(payload);
|
|
46
46
|
//# sourceMappingURL=principal.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"principal.js","sourceRoot":"","sources":["../../src/schemas/principal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;
|
|
1
|
+
{"version":3,"file":"principal.js","sourceRoot":"","sources":["../../src/schemas/principal.ts"],"names":[],"mappings":"AAAA,O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AE,MAAM,CAAC,MAAM,CAAC;QACtB,SAAS,EAAE,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC;QACzC,SAAS,EAAE,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC;KAC1C,CAAC;CACH,CACF,CAAA;AAuBD,MAAM,CAAC,MAAM,mBAAmB,GAAG,CACjC,OAAgB,EACc,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC,uBAAuB,CAAC,CAAC,OAAO,CAAC,CAAA;AAO9E,MAAM,CAAC,MAAM,aAAa,GAAG,MAAM,CAAC,YAAY,CAAC,SAAS,EAAE;IAC1D,MAAM,EAAE,MAAM,CAAC,MAAM;IACrB,OAAO,EAAE,MAAM,CAAC,MAAM;IACtB,GAAG,EAAE,MAAM,CAAC,MAAM;IAClB,GAAG,EAAE,MAAM,CAAC,MAAM;IAClB,GAAG,EAAE,MAAM,CAAC,MAAM;IAClB,GAAG,EAAE,MAAM,CAAC,OAAO,CAAC,cAAc,CAAC;IACnC,GAAG,EAAE,MAAM,CAAC,MAAM;IAClB,OAAO,EAAE,MAAM,CAAC,OAAO;IACvB,GAAG,EAAE,MAAM,CAAC,MAAM;CACnB,CAAC,CAAA;AAeF,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,OAAgB,EAAsB,EAAE,CAChE,MAAM,CAAC,EAAE,CAAC,aAAa,CAAC,CAAC,OAAO,CAAC,CAAA","sourcesContent":["import { Schema } from \"effect\"\nimport type { satisfy } from \"./satisfy.js\"\n\n/* Principal */\n\nexport const PrincipalSchema = Schema.TaggedStruct(\"Principal\", {\n id: Schema.String,\n authenticatorId: Schema.String,\n authenticatorType: Schema.Literal(\"passkey\"),\n createdAt: Schema.Number,\n expiresAt: Schema.Number,\n passkey: Schema.optional(\n Schema.Struct({\n userVerified: Schema.Boolean,\n verified: Schema.Boolean,\n })\n ),\n userId: Schema.String,\n})\n\nexport type Principal = {\n readonly _tag: \"Principal\"\n readonly id: string\n readonly userId: string\n readonly createdAt: number\n readonly authenticatorId: string\n readonly authenticatorType: \"passkey\"\n readonly passkey?:\n | {\n readonly userVerified: boolean\n readonly verified: boolean\n }\n | undefined\n readonly expiresAt: number\n}\n\nexport const isPrincipal = (payload: unknown): payload is Principal =>\n Schema.is(PrincipalSchema)(payload)\n\ntype _Principal = satisfy<typeof PrincipalSchema.Type, Principal>\n\nexport const ExtendedPrincipalSchema = Schema.TaggedStruct(\n \"ExtendedPrincipal\",\n {\n id: Schema.String,\n authenticatorId: Schema.String,\n authenticatorType: Schema.Literal(\"passkey\"),\n createdAt: Schema.Number,\n expiresAt: Schema.Number,\n passkey: Schema.optional(\n Schema.Struct({\n platformName: Schema.optional(Schema.String),\n userVerified: Schema.Boolean,\n verified: Schema.Boolean,\n })\n ),\n userId: Schema.String,\n metadata: Schema.Struct({\n ipAddress: Schema.optional(Schema.String),\n userAgent: Schema.optional(Schema.String),\n }),\n }\n)\n\nexport type ExtendedPrincipal = {\n readonly _tag: \"ExtendedPrincipal\"\n readonly id: string\n readonly authenticatorId: string\n readonly authenticatorType: \"passkey\"\n readonly passkey?:\n | {\n readonly userVerified: boolean\n readonly verified: boolean\n readonly platformName?: string | undefined\n }\n | undefined\n readonly createdAt: number\n readonly expiresAt: number\n readonly userId: string\n readonly metadata: {\n readonly ipAddress?: string | undefined\n readonly userAgent?: string | undefined\n }\n}\n\nexport const isExtendedPrincipal = (\n payload: unknown\n): payload is ExtendedPrincipal => Schema.is(ExtendedPrincipalSchema)(payload)\n\ntype _ExtendedPrincipal = satisfy<\n typeof ExtendedPrincipalSchema.Type,\n ExtendedPrincipal\n>\n\nexport const IdTokenSchema = Schema.TaggedStruct(\"IdToken\", {\n \"a:id\": Schema.String,\n \"a:typ\": Schema.String,\n aud: Schema.String,\n exp: Schema.Number,\n iat: Schema.Number,\n iss: Schema.Literal(\"passlock.dev\"),\n jti: Schema.String,\n \"pk:uv\": Schema.Boolean,\n sub: Schema.String,\n})\n\nexport type IdToken = {\n readonly \"a:id\": string\n readonly \"a:typ\": string\n readonly aud: string\n readonly exp: number\n readonly iat: number\n readonly iss: \"passlock.dev\"\n readonly jti: string\n readonly \"pk:uv\": boolean\n readonly sub: string\n readonly _tag: \"IdToken\"\n}\n\nexport const isIdToken = (payload: unknown): payload is IdToken =>\n Schema.is(IdTokenSchema)(payload)\n\ntype _IdToken = satisfy<typeof IdTokenSchema.Type, IdToken>\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"satisfy.d.ts","sourceRoot":"","sources":["../../src/schemas/satisfy.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,OAAO,CAAC,IAAI,EAAE,CAAC,SAAS,IAAI,IAAI,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"satisfy.js","sourceRoot":"","sources":["../../src/schemas/satisfy.ts"],"names":[],"mappings":"","sourcesContent":["export type satisfy<base, t extends base> = t\n"]}
|
package/dist/shared.d.ts
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
export interface TenancyOptions {
|
|
1
|
+
export type PasslockOptions = {
|
|
3
2
|
tenancyId: string;
|
|
4
3
|
/**
|
|
5
4
|
* @default https://api.passlock.dev
|
|
6
5
|
*/
|
|
7
6
|
endpoint?: string;
|
|
8
|
-
}
|
|
9
|
-
export interface
|
|
7
|
+
};
|
|
8
|
+
export interface AuthenticatedOptions extends PasslockOptions {
|
|
10
9
|
apiKey: string;
|
|
11
10
|
}
|
|
12
11
|
export declare class UnexpectedError extends Error {
|
|
@@ -17,5 +16,4 @@ export declare class UnexpectedError extends Error {
|
|
|
17
16
|
});
|
|
18
17
|
readonly toString: () => string;
|
|
19
18
|
}
|
|
20
|
-
export declare const isNotFound: (payload: unknown) => payload is NotFound;
|
|
21
19
|
//# sourceMappingURL=shared.d.ts.map
|
package/dist/shared.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../src/shared.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../src/shared.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,eAAe,GAAG;IAC5B,SAAS,EAAE,MAAM,CAAA;IAEjB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB,CAAA;AAED,MAAM,WAAW,oBAAqB,SAAQ,eAAe;IAC3D,MAAM,EAAE,MAAM,CAAA;CACf;AAED,qBAAa,eAAgB,SAAQ,KAAK;IACxC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;gBAET,IAAI,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE;IAKnD,SAAkB,QAAQ,QAAO,MAAM,CACC;CACzC"}
|
package/dist/shared.js
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { Schema } from "effect";
|
|
2
|
-
import { NotFound } from "./schemas/errors.js";
|
|
3
1
|
export class UnexpectedError extends Error {
|
|
4
2
|
_tag;
|
|
5
3
|
constructor(data) {
|
|
@@ -8,5 +6,4 @@ export class UnexpectedError extends Error {
|
|
|
8
6
|
}
|
|
9
7
|
toString = () => `${this.message} (_tag: ${this._tag})`;
|
|
10
8
|
}
|
|
11
|
-
export const isNotFound = (payload) => Schema.is(NotFound)(payload);
|
|
12
9
|
//# sourceMappingURL=shared.js.map
|
package/dist/shared.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared.js","sourceRoot":"","sources":["../src/shared.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"shared.js","sourceRoot":"","sources":["../src/shared.ts"],"names":[],"mappings":"AAaA,MAAM,OAAO,eAAgB,SAAQ,KAAK;IAC/B,IAAI,CAAQ;IAErB,YAAY,IAAuC;QACjD,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;QACnB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAA;IACvB,CAAC;IAEiB,QAAQ,GAAG,GAAW,EAAE,CACxC,GAAG,IAAI,CAAC,OAAO,WAAW,IAAI,CAAC,IAAI,GAAG,CAAA;CACzC","sourcesContent":["export type PasslockOptions = {\n tenancyId: string\n\n /**\n * @default https://api.passlock.dev\n */\n endpoint?: string\n}\n\nexport interface AuthenticatedOptions extends PasslockOptions {\n apiKey: string\n}\n\nexport class UnexpectedError extends Error {\n readonly _tag: string\n\n constructor(data: { _tag: string; message: string }) {\n super(data.message)\n this._tag = data._tag\n }\n\n override readonly toString = (): string =>\n `${this.message} (_tag: ${this._tag})`\n}\n"]}
|