@passlock/node 2.0.1 → 2.0.2
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 +25 -0
- package/dist/errors.js.map +1 -0
- package/dist/index.d.ts +63 -29
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +57 -24
- package/dist/index.js.map +1 -1
- package/dist/passkey/passkey.d.ts +116 -0
- package/dist/passkey/passkey.d.ts.map +1 -0
- package/dist/{passkey.js → passkey/passkey.js} +44 -20
- 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} +9 -9
- package/dist/principal/principal.js.map +1 -0
- package/dist/safe.d.ts +136 -0
- package/dist/safe.d.ts.map +1 -0
- package/dist/safe.js +130 -0
- package/dist/safe.js.map +1 -0
- package/dist/schemas/errors.d.ts +13 -65
- package/dist/schemas/errors.d.ts.map +1 -1
- package/dist/schemas/errors.js +47 -6
- package/dist/schemas/errors.js.map +1 -1
- package/dist/schemas/passkey.d.ts +19 -21
- package/dist/schemas/passkey.d.ts.map +1 -1
- package/dist/schemas/passkey.js +23 -17
- 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 -18
- package/dist/passkey.d.ts +0 -24
- package/dist/passkey.d.ts.map +0 -1
- 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.d.ts
CHANGED
|
@@ -1,77 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
}>;
|
|
5
|
-
export declare class Unauthorized extends Unauthorized_base {
|
|
6
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* @category Authentication
|
|
3
|
+
*/
|
|
7
4
|
export declare const isUnauthorized: (payload: unknown) => payload is Unauthorized;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
export declare class Forbidden extends Forbidden_base {
|
|
12
|
-
}
|
|
5
|
+
/**
|
|
6
|
+
* @category Authentication
|
|
7
|
+
*/
|
|
13
8
|
export declare const isForbidden: (payload: unknown) => payload is Forbidden;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
message: typeof Schema.String;
|
|
18
|
-
}>;
|
|
19
|
-
export declare class InvalidCode extends InvalidCode_base {
|
|
20
|
-
}
|
|
9
|
+
/**
|
|
10
|
+
* @category Principal
|
|
11
|
+
*/
|
|
21
12
|
export declare const isInvalidCode: (payload: unknown) => payload is InvalidCode;
|
|
22
|
-
declare const InvalidTenancy_base: Schema.TaggedErrorClass<InvalidTenancy, "@error/InvalidTenancy", {
|
|
23
|
-
readonly _tag: Schema.tag<"@error/InvalidTenancy">;
|
|
24
|
-
} & {
|
|
25
|
-
message: typeof Schema.String;
|
|
26
|
-
}>;
|
|
27
|
-
export declare class InvalidTenancy extends InvalidTenancy_base {
|
|
28
|
-
}
|
|
29
13
|
export declare const isInvalidTenancy: (payload: unknown) => payload is InvalidTenancy;
|
|
30
|
-
declare const PasskeyNotFound_base: Schema.TaggedErrorClass<PasskeyNotFound, "@error/PasskeyNotFound", {
|
|
31
|
-
readonly _tag: Schema.tag<"@error/PasskeyNotFound">;
|
|
32
|
-
} & {
|
|
33
|
-
credentialId: typeof Schema.String;
|
|
34
|
-
message: typeof Schema.String;
|
|
35
|
-
rpId: typeof Schema.String;
|
|
36
|
-
}>;
|
|
37
14
|
/**
|
|
38
|
-
*
|
|
39
|
-
*
|
|
15
|
+
* @param payload
|
|
16
|
+
* @returns `true` if the payload is a {@link PasskeyNotFound} error.
|
|
17
|
+
*
|
|
18
|
+
* @category Passkeys
|
|
40
19
|
*/
|
|
41
|
-
export declare class PasskeyNotFound extends PasskeyNotFound_base {
|
|
42
|
-
}
|
|
43
20
|
export declare const isPasskeyNotFound: (payload: unknown) => payload is PasskeyNotFound;
|
|
44
|
-
declare const NotFound_base: Schema.TaggedErrorClass<NotFound, "@error/NotFound", {
|
|
45
|
-
readonly _tag: Schema.tag<"@error/NotFound">;
|
|
46
|
-
} & {
|
|
47
|
-
message: typeof Schema.String;
|
|
48
|
-
}>;
|
|
49
|
-
export declare class NotFound extends NotFound_base {
|
|
50
|
-
}
|
|
51
21
|
export declare const isNotFound: (payload: unknown) => payload is NotFound;
|
|
52
|
-
declare const InvalidEmail_base: Schema.TaggedErrorClass<InvalidEmail, "@error/InvalidEmail", {
|
|
53
|
-
readonly _tag: Schema.tag<"@error/InvalidEmail">;
|
|
54
|
-
} & {
|
|
55
|
-
message: typeof Schema.String;
|
|
56
|
-
}>;
|
|
57
|
-
export declare class InvalidEmail extends InvalidEmail_base {
|
|
58
|
-
}
|
|
59
22
|
export declare const isInvalidEmail: (payload: unknown) => payload is InvalidEmail;
|
|
60
|
-
declare const DuplicateEmail_base: Schema.TaggedErrorClass<DuplicateEmail, "@error/DuplicateEmail", {
|
|
61
|
-
readonly _tag: Schema.tag<"@error/DuplicateEmail">;
|
|
62
|
-
} & {
|
|
63
|
-
message: typeof Schema.String;
|
|
64
|
-
}>;
|
|
65
|
-
export declare class DuplicateEmail extends DuplicateEmail_base {
|
|
66
|
-
}
|
|
67
23
|
export declare const isDuplicateEmail: (payload: unknown) => payload is DuplicateEmail;
|
|
68
|
-
declare const BadRequest_base: Schema.TaggedErrorClass<BadRequest, "@error/BadRequest", {
|
|
69
|
-
readonly _tag: Schema.tag<"@error/BadRequest">;
|
|
70
|
-
} & {
|
|
71
|
-
message: typeof Schema.String;
|
|
72
|
-
}>;
|
|
73
|
-
export declare class BadRequest extends BadRequest_base {
|
|
74
|
-
}
|
|
75
24
|
export declare const isBadRequest: (payload: unknown) => payload is BadRequest;
|
|
76
|
-
export {};
|
|
77
25
|
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/schemas/errors.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/schemas/errors.ts"],"names":[],"mappings":"AAUA;;GAEG;AACH,eAAO,MAAM,cAAc,GAAI,SAAS,OAAO,KAAG,OAAO,IAAI,YAC3B,CAAA;AAUlC;;GAEG;AACH,eAAO,MAAM,WAAW,GAAI,SAAS,OAAO,KAAG,OAAO,IAAI,SAC3B,CAAA;AAY/B;;GAEG;AACH,eAAO,MAAM,aAAa,GAAI,SAAS,OAAO,KAAG,OAAO,IAAI,WAC3B,CAAA;AAYjC,eAAO,MAAM,gBAAgB,GAAI,SAAS,OAAO,KAAG,OAAO,IAAI,cAC3B,CAAA;AAoBpC;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,GAC5B,SAAS,OAAO,KACf,OAAO,IAAI,eAAsD,CAAA;AAYpE,eAAO,MAAM,UAAU,GAAI,SAAS,OAAO,KAAG,OAAO,IAAI,QAC3B,CAAA;AAY9B,eAAO,MAAM,cAAc,GAAI,SAAS,OAAO,KAAG,OAAO,IAAI,YAC3B,CAAA;AAYlC,eAAO,MAAM,gBAAgB,GAAI,SAAS,OAAO,KAAG,OAAO,IAAI,cAC3B,CAAA;AAYpC,eAAO,MAAM,YAAY,GAAI,SAAS,OAAO,KAAG,OAAO,IAAI,UAC3B,CAAA"}
|
package/dist/schemas/errors.js
CHANGED
|
@@ -1,43 +1,84 @@
|
|
|
1
1
|
import { Schema } from "effect";
|
|
2
|
+
/* Unauthorized */
|
|
3
|
+
/** @internal */
|
|
2
4
|
export class Unauthorized extends Schema.TaggedError()("@error/Unauthorized", {}) {
|
|
3
5
|
}
|
|
6
|
+
/**
|
|
7
|
+
* @category Authentication
|
|
8
|
+
*/
|
|
4
9
|
export const isUnauthorized = (payload) => Schema.is(Unauthorized)(payload);
|
|
10
|
+
/* Forbidden */
|
|
11
|
+
/** @internal */
|
|
5
12
|
export class Forbidden extends Schema.TaggedError()("@error/Forbidden", {}) {
|
|
6
13
|
}
|
|
14
|
+
/**
|
|
15
|
+
* @category Authentication
|
|
16
|
+
*/
|
|
7
17
|
export const isForbidden = (payload) => Schema.is(Forbidden)(payload);
|
|
8
|
-
|
|
18
|
+
/* InvalidCode */
|
|
19
|
+
/** @internal */
|
|
20
|
+
export class InvalidCode extends Schema.TaggedError()("@error/InvalidCode", {
|
|
9
21
|
message: Schema.String,
|
|
10
22
|
}) {
|
|
11
23
|
}
|
|
24
|
+
/**
|
|
25
|
+
* @category Principal
|
|
26
|
+
*/
|
|
12
27
|
export const isInvalidCode = (payload) => Schema.is(InvalidCode)(payload);
|
|
28
|
+
/* InvalidTenancy */
|
|
29
|
+
/** @internal */
|
|
13
30
|
export class InvalidTenancy extends Schema.TaggedError()("@error/InvalidTenancy", {
|
|
14
31
|
message: Schema.String,
|
|
15
32
|
}) {
|
|
16
33
|
}
|
|
17
34
|
export const isInvalidTenancy = (payload) => Schema.is(InvalidTenancy)(payload);
|
|
35
|
+
/* PasskeyNotFound */
|
|
18
36
|
/**
|
|
19
37
|
* We need the credentialId and rpId to feed into the
|
|
20
38
|
* client's signalCredentialRemoval function
|
|
39
|
+
*
|
|
40
|
+
* @category Passkeys
|
|
21
41
|
*/
|
|
22
|
-
|
|
42
|
+
/** @internal */
|
|
43
|
+
export class PasskeyNotFound extends Schema.TaggedError()("@error/PasskeyNotFound", {
|
|
23
44
|
credentialId: Schema.String,
|
|
24
45
|
message: Schema.String,
|
|
25
46
|
rpId: Schema.String,
|
|
26
47
|
}) {
|
|
27
48
|
}
|
|
49
|
+
/**
|
|
50
|
+
* @param payload
|
|
51
|
+
* @returns `true` if the payload is a {@link PasskeyNotFound} error.
|
|
52
|
+
*
|
|
53
|
+
* @category Passkeys
|
|
54
|
+
*/
|
|
28
55
|
export const isPasskeyNotFound = (payload) => Schema.is(PasskeyNotFound)(payload);
|
|
29
|
-
|
|
56
|
+
/* NotFound */
|
|
57
|
+
/** @internal */
|
|
58
|
+
export class NotFound extends Schema.TaggedError()("@error/NotFound", {
|
|
30
59
|
message: Schema.String,
|
|
31
60
|
}) {
|
|
32
61
|
}
|
|
33
62
|
export const isNotFound = (payload) => Schema.is(NotFound)(payload);
|
|
34
|
-
|
|
63
|
+
/* InvalidEmail */
|
|
64
|
+
/** @internal */
|
|
65
|
+
export class InvalidEmail extends Schema.TaggedError()("@error/InvalidEmail", {
|
|
66
|
+
message: Schema.String,
|
|
67
|
+
}) {
|
|
35
68
|
}
|
|
36
69
|
export const isInvalidEmail = (payload) => Schema.is(InvalidEmail)(payload);
|
|
37
|
-
|
|
70
|
+
/* DuplicateEmail */
|
|
71
|
+
/** @internal */
|
|
72
|
+
export class DuplicateEmail extends Schema.TaggedError()("@error/DuplicateEmail", {
|
|
73
|
+
message: Schema.String,
|
|
74
|
+
}) {
|
|
38
75
|
}
|
|
39
76
|
export const isDuplicateEmail = (payload) => Schema.is(DuplicateEmail)(payload);
|
|
40
|
-
|
|
77
|
+
/* BadRequest */
|
|
78
|
+
/** @internal */
|
|
79
|
+
export class BadRequest extends Schema.TaggedError()("@error/BadRequest", {
|
|
80
|
+
message: Schema.String,
|
|
81
|
+
}) {
|
|
41
82
|
}
|
|
42
83
|
export const isBadRequest = (payload) => Schema.is(BadRequest)(payload);
|
|
43
84
|
//# 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,YAAa,SAAQ,MAAM,CAAC,WAAW,EAAgB,
|
|
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,YAAa,SAAQ,MAAM,CAAC,WAAW,EAAgB,CAClE,qBAAqB,EACrB,EAAE,CACH;CAAG;AAEJ;;GAEG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,OAAgB,EAA2B,EAAE,CAC1E,MAAM,CAAC,EAAE,CAAC,YAAY,CAAC,CAAC,OAAO,CAAC,CAAA;AAElC,eAAe;AAEf,gBAAgB;AAChB,MAAM,OAAO,SAAU,SAAQ,MAAM,CAAC,WAAW,EAAa,CAC5D,kBAAkB,EAClB,EAAE,CACH;CAAG;AAEJ;;GAEG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,OAAgB,EAAwB,EAAE,CACpE,MAAM,CAAC,EAAE,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC,CAAA;AAE/B,iBAAiB;AAEjB,gBAAgB;AAChB,MAAM,OAAO,WAAY,SAAQ,MAAM,CAAC,WAAW,EAAe,CAChE,oBAAoB,EACpB;IACE,OAAO,EAAE,MAAM,CAAC,MAAM;CACvB,CACF;CAAG;AAEJ;;GA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MAAM,CAAC,MAAM;CACvB,CACF;CAAG;AAEJ,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,OAAgB,EAA2B,EAAE,CAC1E,MAAM,CAAC,EAAE,CAAC,YAAY,CAAC,CAAC,OAAO,CAAC,CAAA;AAElC,oBAAoB;AAEpB,gBAAgB;AAChB,MAAM,OAAO,cAAe,SAAQ,MAAM,CAAC,WAAW,EAAkB,CACtE,uBAAuB,EACvB;IACE,OAAO,EAAE,MAAM,CAAC,MAAM;CACvB,CACF;CAAG;AAEJ,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,OAAgB,EAA6B,EAAE,CAC9E,MAAM,CAAC,EAAE,CAAC,cAAc,CAAC,CAAC,OAAO,CAAC,CAAA;AAEpC,gBAAgB;AAEhB,gBAAgB;AAChB,MAAM,OAAO,UAAW,SAAQ,MAAM,CAAC,WAAW,EAAc,CAC9D,mBAAmB,EACnB;IACE,OAAO,EAAE,MAAM,CAAC,MAAM;CACvB,CACF;CAAG;AAEJ,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,OAAgB,EAAyB,EAAE,CACtE,MAAM,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC,OAAO,CAAC,CAAA","sourcesContent":["import { Schema } from \"effect\"\n\n/* Unauthorized */\n\n/** @internal */\nexport class Unauthorized extends Schema.TaggedError<Unauthorized>()(\n \"@error/Unauthorized\",\n {}\n) {}\n\n/**\n * @category Authentication\n */\nexport const isUnauthorized = (payload: unknown): payload is Unauthorized =>\n Schema.is(Unauthorized)(payload)\n\n/* Forbidden */\n\n/** @internal */\nexport class Forbidden extends Schema.TaggedError<Forbidden>()(\n \"@error/Forbidden\",\n {}\n) {}\n\n/**\n * @category Authentication\n */\nexport const isForbidden = (payload: unknown): payload is Forbidden =>\n Schema.is(Forbidden)(payload)\n\n/* InvalidCode */\n\n/** @internal */\nexport class InvalidCode extends Schema.TaggedError<InvalidCode>()(\n \"@error/InvalidCode\",\n {\n message: Schema.String,\n }\n) {}\n\n/**\n * @category Principal\n */\nexport const isInvalidCode = (payload: unknown): payload is InvalidCode =>\n Schema.is(InvalidCode)(payload)\n\n/* InvalidTenancy */\n\n/** @internal */\nexport class InvalidTenancy extends Schema.TaggedError<InvalidTenancy>()(\n \"@error/InvalidTenancy\",\n {\n message: Schema.String,\n }\n) {}\n\nexport const isInvalidTenancy = (payload: unknown): payload is InvalidTenancy =>\n Schema.is(InvalidTenancy)(payload)\n\n/* PasskeyNotFound */\n\n/**\n * We need the credentialId and rpId to feed into the\n * client's signalCredentialRemoval function\n *\n * @category Passkeys\n */\n/** @internal */\nexport class PasskeyNotFound extends Schema.TaggedError<PasskeyNotFound>()(\n \"@error/PasskeyNotFound\",\n {\n credentialId: Schema.String,\n message: Schema.String,\n rpId: Schema.String,\n }\n) {}\n\n/**\n * @param payload\n * @returns `true` if the payload is a {@link PasskeyNotFound} error.\n *\n * @category Passkeys\n */\nexport const isPasskeyNotFound = (\n payload: unknown\n): payload is PasskeyNotFound => Schema.is(PasskeyNotFound)(payload)\n\n/* NotFound */\n\n/** @internal */\nexport class NotFound extends Schema.TaggedError<NotFound>()(\n \"@error/NotFound\",\n {\n message: Schema.String,\n }\n) {}\n\nexport const isNotFound = (payload: unknown): payload is NotFound =>\n Schema.is(NotFound)(payload)\n\n/* InvalidEmail */\n\n/** @internal */\nexport class InvalidEmail extends Schema.TaggedError<InvalidEmail>()(\n \"@error/InvalidEmail\",\n {\n message: Schema.String,\n }\n) {}\n\nexport const isInvalidEmail = (payload: unknown): payload is InvalidEmail =>\n Schema.is(InvalidEmail)(payload)\n\n/* DuplicateEmail */\n\n/** @internal */\nexport class DuplicateEmail extends Schema.TaggedError<DuplicateEmail>()(\n \"@error/DuplicateEmail\",\n {\n message: Schema.String,\n }\n) {}\n\nexport const isDuplicateEmail = (payload: unknown): payload is DuplicateEmail =>\n Schema.is(DuplicateEmail)(payload)\n\n/* BadRequest */\n\n/** @internal */\nexport class BadRequest extends Schema.TaggedError<BadRequest>()(\n \"@error/BadRequest\",\n {\n message: Schema.String,\n }\n) {}\n\nexport const isBadRequest = (payload: unknown): payload is BadRequest =>\n Schema.is(BadRequest)(payload)\n"]}
|
|
@@ -4,60 +4,58 @@ export declare const CredentialDeviceType: readonly ["singleDevice", "multiDevic
|
|
|
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
|
-
export declare const
|
|
8
|
-
|
|
7
|
+
export declare const PasskeySchema: Schema.TaggedStruct<"Passkey", {
|
|
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>;
|
|
17
21
|
}>;
|
|
18
|
-
enabled: typeof Schema.Boolean;
|
|
19
|
-
id: typeof Schema.String;
|
|
20
|
-
lastUsed: Schema.optional<typeof Schema.Number>;
|
|
21
22
|
platform: Schema.optional<Schema.Struct<{
|
|
22
23
|
icon: Schema.optional<typeof Schema.String>;
|
|
23
24
|
name: Schema.optional<typeof Schema.String>;
|
|
24
25
|
}>>;
|
|
26
|
+
lastUsed: Schema.optional<typeof Schema.Number>;
|
|
27
|
+
createdAt: typeof Schema.Number;
|
|
25
28
|
updatedAt: typeof Schema.Number;
|
|
26
|
-
userId: Schema.optional<typeof Schema.String>;
|
|
27
29
|
}>;
|
|
28
|
-
export type
|
|
29
|
-
export declare const
|
|
30
|
-
export declare const PasskeySummary: Schema.TaggedStruct<"PasskeySummary", {
|
|
30
|
+
export type PasskeyEncoded = typeof PasskeySchema.Encoded;
|
|
31
|
+
export declare const PasskeySummarySchema: Schema.TaggedStruct<"PasskeySummary", {
|
|
31
32
|
id: typeof Schema.String;
|
|
32
33
|
userId: typeof Schema.String;
|
|
33
34
|
credential: Schema.Struct<{
|
|
34
|
-
|
|
35
|
+
id: typeof Schema.String;
|
|
36
|
+
userId: typeof Schema.String;
|
|
35
37
|
}>;
|
|
36
38
|
enabled: typeof Schema.Boolean;
|
|
37
39
|
createdAt: typeof Schema.Number;
|
|
38
40
|
lastUsed: Schema.optional<typeof Schema.Number>;
|
|
39
41
|
}>;
|
|
40
|
-
export
|
|
41
|
-
export declare const isPasskeySummary: (payload: unknown) => payload is PasskeySummary;
|
|
42
|
-
export declare const FindAllPasskeys: Schema.TaggedStruct<"FindAllPasskeys", {
|
|
42
|
+
export declare const FindAllPasskeysSchema: Schema.TaggedStruct<"FindAllPasskeys", {
|
|
43
43
|
cursor: Schema.NullOr<typeof Schema.String>;
|
|
44
44
|
records: Schema.Array$<Schema.TaggedStruct<"PasskeySummary", {
|
|
45
45
|
id: typeof Schema.String;
|
|
46
46
|
userId: typeof Schema.String;
|
|
47
47
|
credential: Schema.Struct<{
|
|
48
|
-
|
|
48
|
+
id: typeof Schema.String;
|
|
49
|
+
userId: typeof Schema.String;
|
|
49
50
|
}>;
|
|
50
51
|
enabled: typeof Schema.Boolean;
|
|
51
52
|
createdAt: typeof Schema.Number;
|
|
52
53
|
lastUsed: Schema.optional<typeof Schema.Number>;
|
|
53
54
|
}>>;
|
|
54
55
|
}>;
|
|
55
|
-
export
|
|
56
|
-
|
|
57
|
-
passkeyId: typeof Schema.String;
|
|
56
|
+
export declare const DeletedPasskeySchema: Schema.TaggedStruct<"DeletedPasskey", {
|
|
57
|
+
id: typeof Schema.String;
|
|
58
58
|
credentialId: typeof Schema.String;
|
|
59
59
|
rpId: typeof Schema.String;
|
|
60
60
|
}>;
|
|
61
|
-
export type DeletedPasskey = typeof DeletedPasskey.Type;
|
|
62
|
-
export declare const isDeletedPasskey: (payload: unknown) => payload is DeletedPasskey;
|
|
63
61
|
//# 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,sBAAsB,0DAIlC,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,aAAa;;;;;;;;;;;;;;;;;;;;;;EAwBxB,CAAA;AAEF,MAAM,MAAM,cAAc,GAAG,OAAO,aAAa,CAAC,OAAO,CAAA;AAEzD,eAAO,MAAM,oBAAoB;;;;;;;;;;EAU/B,CAAA;AAEF,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;EAGhC,CAAA;AAEF,eAAO,MAAM,oBAAoB;;;;EAI/B,CAAA"}
|
package/dist/schemas/passkey.js
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
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
9
|
export const UserVerificationSchema = Schema.Literal("required", "preferred", "discouraged");
|
|
4
10
|
/* Passkey */
|
|
@@ -13,47 +19,47 @@ export const Transports = [
|
|
|
13
19
|
"smart-card",
|
|
14
20
|
];
|
|
15
21
|
/* Passkey */
|
|
16
|
-
export const
|
|
17
|
-
|
|
22
|
+
export const PasskeySchema = Schema.TaggedStruct("Passkey", {
|
|
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,
|
|
26
36
|
}),
|
|
27
|
-
enabled: Schema.Boolean,
|
|
28
|
-
id: Schema.String,
|
|
29
|
-
lastUsed: Schema.optional(Schema.Number),
|
|
30
37
|
platform: Schema.optional(Schema.Struct({
|
|
31
38
|
icon: Schema.optional(Schema.String),
|
|
32
39
|
name: Schema.optional(Schema.String),
|
|
33
40
|
})),
|
|
41
|
+
lastUsed: Schema.optional(Schema.Number),
|
|
42
|
+
createdAt: Schema.Number,
|
|
34
43
|
updatedAt: Schema.Number,
|
|
35
|
-
userId: Schema.optional(Schema.String),
|
|
36
44
|
});
|
|
37
|
-
export const
|
|
38
|
-
export const PasskeySummary = Schema.TaggedStruct("PasskeySummary", {
|
|
45
|
+
export const PasskeySummarySchema = Schema.TaggedStruct("PasskeySummary", {
|
|
39
46
|
id: Schema.String,
|
|
40
47
|
userId: Schema.String,
|
|
41
48
|
credential: Schema.Struct({
|
|
42
|
-
|
|
49
|
+
id: Schema.String,
|
|
50
|
+
userId: Schema.String,
|
|
43
51
|
}),
|
|
44
52
|
enabled: Schema.Boolean,
|
|
45
53
|
createdAt: Schema.Number,
|
|
46
54
|
lastUsed: Schema.optional(Schema.Number),
|
|
47
55
|
});
|
|
48
|
-
export const
|
|
49
|
-
export const FindAllPasskeys = Schema.TaggedStruct("FindAllPasskeys", {
|
|
56
|
+
export const FindAllPasskeysSchema = Schema.TaggedStruct("FindAllPasskeys", {
|
|
50
57
|
cursor: Schema.NullOr(Schema.String),
|
|
51
|
-
records: Schema.Array(
|
|
58
|
+
records: Schema.Array(PasskeySummarySchema),
|
|
52
59
|
});
|
|
53
|
-
export const
|
|
54
|
-
|
|
60
|
+
export const DeletedPasskeySchema = Schema.TaggedStruct("DeletedPasskey", {
|
|
61
|
+
id: Schema.String,
|
|
55
62
|
credentialId: Schema.String,
|
|
56
63
|
rpId: Schema.String,
|
|
57
64
|
});
|
|
58
|
-
export const isDeletedPasskey = (payload) => Schema.is(DeletedPasskey)(payload);
|
|
59
65
|
//# 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,sBAAsB,GAAG,MAAM,CAAC,OAAO,
|
|
1
|
+
{"version":3,"file":"passkey.js","sourceRoot":"","sources":["../../src/schemas/passkey.ts"],"names":[],"mappings":"AAAA,OAAO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AM,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;AAIF,MAAM,CAAC,MAAM,oBAAoB,GAAG,MAAM,CAAC,YAAY,CAAC,gBAAgB,EAAE;IACxE,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;AAEF,MAAM,CAAC,MAAM,qBAAqB,GAAG,MAAM,CAAC,YAAY,CAAC,iBAAiB,EAAE;IAC1E,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC;IACpC,OAAO,EAAE,MAAM,CAAC,KAAK,CAAC,oBAAoB,CAAC;CAC5C,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,oBAAoB,GAAG,MAAM,CAAC,YAAY,CAAC,gBAAgB,EAAE;IACxE,EAAE,EAAE,MAAM,CAAC,MAAM;IACjB,YAAY,EAAE,MAAM,CAAC,MAAM;IAC3B,IAAI,EAAE,MAAM,CAAC,MAAM;CACpB,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 UserVerificationSchema = 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 PasskeySchema = 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 }),\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 PasskeyEncoded = typeof PasskeySchema.Encoded\n\nexport const PasskeySummarySchema = 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 const FindAllPasskeysSchema = Schema.TaggedStruct(\"FindAllPasskeys\", {\n cursor: Schema.NullOr(Schema.String),\n records: Schema.Array(PasskeySummarySchema),\n})\n\nexport const DeletedPasskeySchema = Schema.TaggedStruct(\"DeletedPasskey\", {\n id: Schema.String,\n credentialId: Schema.String,\n rpId: Schema.String,\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,MAAM,Q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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,OAAO,EAA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,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
|