@atproto/lex-password-session 0.0.5 → 0.0.6
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/CHANGELOG.md +8 -0
- package/dist/lexicons/com/atproto/server/createAccount.defs.d.ts +9 -9
- package/dist/lexicons/com/atproto/server/createAccount.defs.d.ts.map +1 -1
- package/dist/lexicons/com/atproto/server/createAccount.defs.js +2 -2
- package/dist/lexicons/com/atproto/server/createAccount.defs.js.map +1 -1
- package/dist/lexicons/com/atproto/server/createSession.defs.d.ts +13 -9
- package/dist/lexicons/com/atproto/server/createSession.defs.d.ts.map +1 -1
- package/dist/lexicons/com/atproto/server/createSession.defs.js +3 -2
- package/dist/lexicons/com/atproto/server/createSession.defs.js.map +1 -1
- package/dist/lexicons/com/atproto/server/deleteSession.defs.d.ts +5 -5
- package/dist/lexicons/com/atproto/server/deleteSession.defs.d.ts.map +1 -1
- package/dist/lexicons/com/atproto/server/deleteSession.defs.js.map +1 -1
- package/dist/lexicons/com/atproto/server/getSession.defs.d.ts +11 -7
- package/dist/lexicons/com/atproto/server/getSession.defs.d.ts.map +1 -1
- package/dist/lexicons/com/atproto/server/getSession.defs.js +3 -2
- package/dist/lexicons/com/atproto/server/getSession.defs.js.map +1 -1
- package/dist/lexicons/com/atproto/server/refreshSession.defs.d.ts +13 -9
- package/dist/lexicons/com/atproto/server/refreshSession.defs.d.ts.map +1 -1
- package/dist/lexicons/com/atproto/server/refreshSession.defs.js +3 -2
- package/dist/lexicons/com/atproto/server/refreshSession.defs.js.map +1 -1
- package/dist/password-session.d.ts +2 -2
- package/dist/password-session.d.ts.map +1 -1
- package/dist/password-session.js.map +1 -1
- package/package.json +5 -5
- package/src/lexicons/com/atproto/server/createAccount.defs.ts +13 -7
- package/src/lexicons/com/atproto/server/createSession.defs.ts +17 -7
- package/src/lexicons/com/atproto/server/deleteSession.defs.ts +11 -5
- package/src/lexicons/com/atproto/server/getSession.defs.ts +12 -5
- package/src/lexicons/com/atproto/server/refreshSession.defs.ts +17 -7
- package/src/password-session.test.ts +3 -3
- package/src/password-session.ts +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @atproto/lex-password-session
|
|
2
2
|
|
|
3
|
+
## 0.0.6
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [[`39dea03`](https://github.com/bluesky-social/atproto/commit/39dea03c417a1da069962560505427a7aa25ad7a), [`ea5df64`](https://github.com/bluesky-social/atproto/commit/ea5df64db9e408d2b320f5f75eb2878aef6bc6df), [`ea5df64`](https://github.com/bluesky-social/atproto/commit/ea5df64db9e408d2b320f5f75eb2878aef6bc6df), [`39dea03`](https://github.com/bluesky-social/atproto/commit/39dea03c417a1da069962560505427a7aa25ad7a), [`39dea03`](https://github.com/bluesky-social/atproto/commit/39dea03c417a1da069962560505427a7aa25ad7a), [`ea5df64`](https://github.com/bluesky-social/atproto/commit/ea5df64db9e408d2b320f5f75eb2878aef6bc6df), [`39dea03`](https://github.com/bluesky-social/atproto/commit/39dea03c417a1da069962560505427a7aa25ad7a), [`ea5df64`](https://github.com/bluesky-social/atproto/commit/ea5df64db9e408d2b320f5f75eb2878aef6bc6df), [`ea5df64`](https://github.com/bluesky-social/atproto/commit/ea5df64db9e408d2b320f5f75eb2878aef6bc6df), [`ea5df64`](https://github.com/bluesky-social/atproto/commit/ea5df64db9e408d2b320f5f75eb2878aef6bc6df), [`ea5df64`](https://github.com/bluesky-social/atproto/commit/ea5df64db9e408d2b320f5f75eb2878aef6bc6df), [`ea5df64`](https://github.com/bluesky-social/atproto/commit/ea5df64db9e408d2b320f5f75eb2878aef6bc6df), [`ea5df64`](https://github.com/bluesky-social/atproto/commit/ea5df64db9e408d2b320f5f75eb2878aef6bc6df), [`ea5df64`](https://github.com/bluesky-social/atproto/commit/ea5df64db9e408d2b320f5f75eb2878aef6bc6df)]:
|
|
8
|
+
- @atproto/lex-schema@0.0.13
|
|
9
|
+
- @atproto/lex-client@0.0.13
|
|
10
|
+
|
|
3
11
|
## 0.0.5
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
|
@@ -15,7 +15,7 @@ declare const main: l.Procedure<"com.atproto.server.createAccount", l.ParamsSche
|
|
|
15
15
|
verificationPhone: l.OptionalSchema<l.StringSchema<{}>>;
|
|
16
16
|
password: l.OptionalSchema<l.StringSchema<{}>>;
|
|
17
17
|
recoveryKey: l.OptionalSchema<l.StringSchema<{}>>;
|
|
18
|
-
plcOp: l.OptionalSchema<l.
|
|
18
|
+
plcOp: l.OptionalSchema<l.LexMapSchema>;
|
|
19
19
|
}>>, l.Payload<"application/json", l.ObjectSchema<{
|
|
20
20
|
accessJwt: l.StringSchema<{}>;
|
|
21
21
|
refreshJwt: l.StringSchema<{}>;
|
|
@@ -25,14 +25,14 @@ declare const main: l.Procedure<"com.atproto.server.createAccount", l.ParamsSche
|
|
|
25
25
|
did: l.StringSchema<{
|
|
26
26
|
readonly format: "did";
|
|
27
27
|
}>;
|
|
28
|
-
didDoc: l.OptionalSchema<l.
|
|
28
|
+
didDoc: l.OptionalSchema<l.LexMapSchema>;
|
|
29
29
|
}>>, readonly ["InvalidHandle", "InvalidPassword", "InvalidInviteCode", "HandleNotAvailable", "UnsupportedDomain", "UnresolvableDid", "IncompatibleDidDoc"]>;
|
|
30
30
|
export { main };
|
|
31
|
-
export type Params = l.InferMethodParams<typeof main>;
|
|
32
|
-
export type Input = l.InferMethodInput<typeof main>;
|
|
33
|
-
export type InputBody = l.InferMethodInputBody<typeof main>;
|
|
34
|
-
export type Output = l.InferMethodOutput<typeof main>;
|
|
35
|
-
export type OutputBody = l.InferMethodOutputBody<typeof main>;
|
|
31
|
+
export type $Params = l.InferMethodParams<typeof main>;
|
|
32
|
+
export type $Input<B = l.BinaryData> = l.InferMethodInput<typeof main, B>;
|
|
33
|
+
export type $InputBody<B = l.BinaryData> = l.InferMethodInputBody<typeof main, B>;
|
|
34
|
+
export type $Output<B = l.BinaryData> = l.InferMethodOutput<typeof main, B>;
|
|
35
|
+
export type $OutputBody<B = l.BinaryData> = l.InferMethodOutputBody<typeof main, B>;
|
|
36
36
|
export declare const $lxm: "com.atproto.server.createAccount", $params: l.ParamsSchema<{}>, $input: l.Payload<"application/json", l.ObjectSchema<{
|
|
37
37
|
email: l.OptionalSchema<l.StringSchema<{}>>;
|
|
38
38
|
handle: l.StringSchema<{
|
|
@@ -46,7 +46,7 @@ export declare const $lxm: "com.atproto.server.createAccount", $params: l.Params
|
|
|
46
46
|
verificationPhone: l.OptionalSchema<l.StringSchema<{}>>;
|
|
47
47
|
password: l.OptionalSchema<l.StringSchema<{}>>;
|
|
48
48
|
recoveryKey: l.OptionalSchema<l.StringSchema<{}>>;
|
|
49
|
-
plcOp: l.OptionalSchema<l.
|
|
49
|
+
plcOp: l.OptionalSchema<l.LexMapSchema>;
|
|
50
50
|
}>>, $output: l.Payload<"application/json", l.ObjectSchema<{
|
|
51
51
|
accessJwt: l.StringSchema<{}>;
|
|
52
52
|
refreshJwt: l.StringSchema<{}>;
|
|
@@ -56,6 +56,6 @@ export declare const $lxm: "com.atproto.server.createAccount", $params: l.Params
|
|
|
56
56
|
did: l.StringSchema<{
|
|
57
57
|
readonly format: "did";
|
|
58
58
|
}>;
|
|
59
|
-
didDoc: l.OptionalSchema<l.
|
|
59
|
+
didDoc: l.OptionalSchema<l.LexMapSchema>;
|
|
60
60
|
}>>;
|
|
61
61
|
//# sourceMappingURL=createAccount.defs.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createAccount.defs.d.ts","sourceRoot":"","sources":["../../../../../src/lexicons/com/atproto/server/createAccount.defs.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,CAAC,EAAE,MAAM,qBAAqB,CAAA;AAEvC,QAAA,MAAM,KAAK,qCAAqC,CAAA;AAEhD,OAAO,EAAE,KAAK,EAAE,CAAA;AAEhB,6CAA6C;AAC7C,QAAA,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;4JAgCP,CAAA;AACH,OAAO,EAAE,IAAI,EAAE,CAAA;AAEf,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"createAccount.defs.d.ts","sourceRoot":"","sources":["../../../../../src/lexicons/com/atproto/server/createAccount.defs.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,CAAC,EAAE,MAAM,qBAAqB,CAAA;AAEvC,QAAA,MAAM,KAAK,qCAAqC,CAAA;AAEhD,OAAO,EAAE,KAAK,EAAE,CAAA;AAEhB,6CAA6C;AAC7C,QAAA,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;4JAgCP,CAAA;AACH,OAAO,EAAE,IAAI,EAAE,CAAA;AAEf,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,iBAAiB,CAAC,OAAO,IAAI,CAAC,CAAA;AACtD,MAAM,MAAM,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,UAAU,IAAI,CAAC,CAAC,gBAAgB,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,CAAA;AACzE,MAAM,MAAM,UAAU,CAAC,CAAC,GAAG,CAAC,CAAC,UAAU,IAAI,CAAC,CAAC,oBAAoB,CAC/D,OAAO,IAAI,EACX,CAAC,CACF,CAAA;AACD,MAAM,MAAM,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,UAAU,IAAI,CAAC,CAAC,iBAAiB,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,CAAA;AAC3E,MAAM,MAAM,WAAW,CAAC,CAAC,GAAG,CAAC,CAAC,UAAU,IAAI,CAAC,CAAC,qBAAqB,CACjE,OAAO,IAAI,EACX,CAAC,CACF,CAAA;AAED,eAAO,MAAM,IAAI,oCAA0B,EACzC,OAAO,oBAAgC,EACvC,MAAM;;;;;;;;;;;;;;GAA2B,EACjC,OAAO;;;;;;;;;;GAA4B,CAAA"}
|
|
@@ -21,14 +21,14 @@ lex_schema_1.l.procedure($nsid,
|
|
|
21
21
|
verificationPhone: /*#__PURE__*/ lex_schema_1.l.optional(/*#__PURE__*/ lex_schema_1.l.string()),
|
|
22
22
|
password: /*#__PURE__*/ lex_schema_1.l.optional(/*#__PURE__*/ lex_schema_1.l.string()),
|
|
23
23
|
recoveryKey: /*#__PURE__*/ lex_schema_1.l.optional(/*#__PURE__*/ lex_schema_1.l.string()),
|
|
24
|
-
plcOp: /*#__PURE__*/ lex_schema_1.l.optional(/*#__PURE__*/ lex_schema_1.l.
|
|
24
|
+
plcOp: /*#__PURE__*/ lex_schema_1.l.optional(/*#__PURE__*/ lex_schema_1.l.lexMap()),
|
|
25
25
|
}),
|
|
26
26
|
/*#__PURE__*/ lex_schema_1.l.jsonPayload({
|
|
27
27
|
accessJwt: /*#__PURE__*/ lex_schema_1.l.string(),
|
|
28
28
|
refreshJwt: /*#__PURE__*/ lex_schema_1.l.string(),
|
|
29
29
|
handle: /*#__PURE__*/ lex_schema_1.l.string({ format: 'handle' }),
|
|
30
30
|
did: /*#__PURE__*/ lex_schema_1.l.string({ format: 'did' }),
|
|
31
|
-
didDoc: /*#__PURE__*/ lex_schema_1.l.optional(/*#__PURE__*/ lex_schema_1.l.
|
|
31
|
+
didDoc: /*#__PURE__*/ lex_schema_1.l.optional(/*#__PURE__*/ lex_schema_1.l.lexMap()),
|
|
32
32
|
}), [
|
|
33
33
|
'InvalidHandle',
|
|
34
34
|
'InvalidPassword',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createAccount.defs.js","sourceRoot":"","sources":["../../../../../src/lexicons/com/atproto/server/createAccount.defs.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,oDAAuC;AAEvC,MAAM,KAAK,GAAG,kCAAkC,CAAA;AAEvC,sBAAK;AAEd,6CAA6C;AAC7C,MAAM,IAAI;AACR,aAAa;AACb,cAAC,CAAC,SAAS,CACT,KAAK;AACL,aAAa,CAAC,cAAC,CAAC,MAAM,EAAE;AACxB,aAAa,CAAC,cAAC,CAAC,WAAW,CA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AAC,MAAM,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;IAC9C,MAAM,EAAE,aAAa,CAAC,cAAC,CAAC,QAAQ,CAAC,aAAa,CAAC,cAAC,CAAC,MAAM,EAAE,CAAC;CAC3D,CAAC,EACF;IACE,eAAe;IACf,iBAAiB;IACjB,mBAAmB;IACnB,oBAAoB;IACpB,mBAAmB;IACnB,iBAAiB;IACjB,oBAAoB;CACrB,CACF,CAAA;AACM,oBAAI;AAcA,QAAA,IAAI,GAAiB,IAAI,CAAC,IAAI,EACzC,QAAA,OAAO,GAAiB,IAAI,CAAC,UAAU,EACvC,QAAA,MAAM,GAAiB,IAAI,CAAC,KAAK,EACjC,QAAA,OAAO,GAAiB,IAAI,CAAC,MAAM,CAAA","sourcesContent":["/*\n * THIS FILE WAS GENERATED BY \"@atproto/lex\". DO NOT EDIT.\n */\n\nimport { l } from '@atproto/lex-schema'\n\nconst $nsid = 'com.atproto.server.createAccount'\n\nexport { $nsid }\n\n/** Create an account. Implemented by PDS. */\nconst main =\n /*#__PURE__*/\n l.procedure(\n $nsid,\n /*#__PURE__*/ l.params(),\n /*#__PURE__*/ l.jsonPayload({\n email: /*#__PURE__*/ l.optional(/*#__PURE__*/ l.string()),\n handle: /*#__PURE__*/ l.string({ format: 'handle' }),\n did: /*#__PURE__*/ l.optional(/*#__PURE__*/ l.string({ format: 'did' })),\n inviteCode: /*#__PURE__*/ l.optional(/*#__PURE__*/ l.string()),\n verificationCode: /*#__PURE__*/ l.optional(/*#__PURE__*/ l.string()),\n verificationPhone: /*#__PURE__*/ l.optional(/*#__PURE__*/ l.string()),\n password: /*#__PURE__*/ l.optional(/*#__PURE__*/ l.string()),\n recoveryKey: /*#__PURE__*/ l.optional(/*#__PURE__*/ l.string()),\n plcOp: /*#__PURE__*/ l.optional(/*#__PURE__*/ l.lexMap()),\n }),\n /*#__PURE__*/ l.jsonPayload({\n accessJwt: /*#__PURE__*/ l.string(),\n refreshJwt: /*#__PURE__*/ l.string(),\n handle: /*#__PURE__*/ l.string({ format: 'handle' }),\n did: /*#__PURE__*/ l.string({ format: 'did' }),\n didDoc: /*#__PURE__*/ l.optional(/*#__PURE__*/ l.lexMap()),\n }),\n [\n 'InvalidHandle',\n 'InvalidPassword',\n 'InvalidInviteCode',\n 'HandleNotAvailable',\n 'UnsupportedDomain',\n 'UnresolvableDid',\n 'IncompatibleDidDoc',\n ],\n )\nexport { main }\n\nexport type $Params = l.InferMethodParams<typeof main>\nexport type $Input<B = l.BinaryData> = l.InferMethodInput<typeof main, B>\nexport type $InputBody<B = l.BinaryData> = l.InferMethodInputBody<\n typeof main,\n B\n>\nexport type $Output<B = l.BinaryData> = l.InferMethodOutput<typeof main, B>\nexport type $OutputBody<B = l.BinaryData> = l.InferMethodOutputBody<\n typeof main,\n B\n>\n\nexport const $lxm = /*#__PURE__*/ main.nsid,\n $params = /*#__PURE__*/ main.parameters,\n $input = /*#__PURE__*/ main.input,\n $output = /*#__PURE__*/ main.output\n"]}
|
|
@@ -16,19 +16,21 @@ declare const main: l.Procedure<"com.atproto.server.createSession", l.ParamsSche
|
|
|
16
16
|
did: l.StringSchema<{
|
|
17
17
|
readonly format: "did";
|
|
18
18
|
}>;
|
|
19
|
-
didDoc: l.OptionalSchema<l.
|
|
19
|
+
didDoc: l.OptionalSchema<l.LexMapSchema>;
|
|
20
20
|
email: l.OptionalSchema<l.StringSchema<{}>>;
|
|
21
21
|
emailConfirmed: l.OptionalSchema<l.BooleanSchema>;
|
|
22
22
|
emailAuthFactor: l.OptionalSchema<l.BooleanSchema>;
|
|
23
23
|
active: l.OptionalSchema<l.BooleanSchema>;
|
|
24
|
-
status: l.OptionalSchema<l.StringSchema<{
|
|
24
|
+
status: l.OptionalSchema<l.StringSchema<{
|
|
25
|
+
knownValues: ["takendown", "suspended", "deactivated"];
|
|
26
|
+
}>>;
|
|
25
27
|
}>>, readonly ["AccountTakedown", "AuthFactorTokenRequired"]>;
|
|
26
28
|
export { main };
|
|
27
|
-
export type Params = l.InferMethodParams<typeof main>;
|
|
28
|
-
export type Input = l.InferMethodInput<typeof main>;
|
|
29
|
-
export type InputBody = l.InferMethodInputBody<typeof main>;
|
|
30
|
-
export type Output = l.InferMethodOutput<typeof main>;
|
|
31
|
-
export type OutputBody = l.InferMethodOutputBody<typeof main>;
|
|
29
|
+
export type $Params = l.InferMethodParams<typeof main>;
|
|
30
|
+
export type $Input<B = l.BinaryData> = l.InferMethodInput<typeof main, B>;
|
|
31
|
+
export type $InputBody<B = l.BinaryData> = l.InferMethodInputBody<typeof main, B>;
|
|
32
|
+
export type $Output<B = l.BinaryData> = l.InferMethodOutput<typeof main, B>;
|
|
33
|
+
export type $OutputBody<B = l.BinaryData> = l.InferMethodOutputBody<typeof main, B>;
|
|
32
34
|
export declare const $lxm: "com.atproto.server.createSession", $params: l.ParamsSchema<{}>, $input: l.Payload<"application/json", l.ObjectSchema<{
|
|
33
35
|
identifier: l.StringSchema<{}>;
|
|
34
36
|
password: l.StringSchema<{}>;
|
|
@@ -43,11 +45,13 @@ export declare const $lxm: "com.atproto.server.createSession", $params: l.Params
|
|
|
43
45
|
did: l.StringSchema<{
|
|
44
46
|
readonly format: "did";
|
|
45
47
|
}>;
|
|
46
|
-
didDoc: l.OptionalSchema<l.
|
|
48
|
+
didDoc: l.OptionalSchema<l.LexMapSchema>;
|
|
47
49
|
email: l.OptionalSchema<l.StringSchema<{}>>;
|
|
48
50
|
emailConfirmed: l.OptionalSchema<l.BooleanSchema>;
|
|
49
51
|
emailAuthFactor: l.OptionalSchema<l.BooleanSchema>;
|
|
50
52
|
active: l.OptionalSchema<l.BooleanSchema>;
|
|
51
|
-
status: l.OptionalSchema<l.StringSchema<{
|
|
53
|
+
status: l.OptionalSchema<l.StringSchema<{
|
|
54
|
+
knownValues: ["takendown", "suspended", "deactivated"];
|
|
55
|
+
}>>;
|
|
52
56
|
}>>;
|
|
53
57
|
//# sourceMappingURL=createSession.defs.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createSession.defs.d.ts","sourceRoot":"","sources":["../../../../../src/lexicons/com/atproto/server/createSession.defs.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,CAAC,EAAE,MAAM,qBAAqB,CAAA;AAEvC,QAAA,MAAM,KAAK,qCAAqC,CAAA;AAEhD,OAAO,EAAE,KAAK,EAAE,CAAA;AAEhB,wCAAwC;AACxC,QAAA,MAAM,IAAI
|
|
1
|
+
{"version":3,"file":"createSession.defs.d.ts","sourceRoot":"","sources":["../../../../../src/lexicons/com/atproto/server/createSession.defs.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,CAAC,EAAE,MAAM,qBAAqB,CAAA;AAEvC,QAAA,MAAM,KAAK,qCAAqC,CAAA;AAEhD,OAAO,EAAE,KAAK,EAAE,CAAA;AAEhB,wCAAwC;AACxC,QAAA,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;6DA4BP,CAAA;AACH,OAAO,EAAE,IAAI,EAAE,CAAA;AAEf,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,iBAAiB,CAAC,OAAO,IAAI,CAAC,CAAA;AACtD,MAAM,MAAM,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,UAAU,IAAI,CAAC,CAAC,gBAAgB,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,CAAA;AACzE,MAAM,MAAM,UAAU,CAAC,CAAC,GAAG,CAAC,CAAC,UAAU,IAAI,CAAC,CAAC,oBAAoB,CAC/D,OAAO,IAAI,EACX,CAAC,CACF,CAAA;AACD,MAAM,MAAM,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,UAAU,IAAI,CAAC,CAAC,iBAAiB,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,CAAA;AAC3E,MAAM,MAAM,WAAW,CAAC,CAAC,GAAG,CAAC,CAAC,UAAU,IAAI,CAAC,CAAC,qBAAqB,CACjE,OAAO,IAAI,EACX,CAAC,CACF,CAAA;AAED,eAAO,MAAM,IAAI,oCAA0B,EACzC,OAAO,oBAAgC,EACvC,MAAM;;;;;GAA2B,EACjC,OAAO;;;;;;;;;;;;;;;;;GAA4B,CAAA"}
|
|
@@ -23,12 +23,13 @@ lex_schema_1.l.procedure($nsid,
|
|
|
23
23
|
refreshJwt: /*#__PURE__*/ lex_schema_1.l.string(),
|
|
24
24
|
handle: /*#__PURE__*/ lex_schema_1.l.string({ format: 'handle' }),
|
|
25
25
|
did: /*#__PURE__*/ lex_schema_1.l.string({ format: 'did' }),
|
|
26
|
-
didDoc: /*#__PURE__*/ lex_schema_1.l.optional(/*#__PURE__*/ lex_schema_1.l.
|
|
26
|
+
didDoc: /*#__PURE__*/ lex_schema_1.l.optional(/*#__PURE__*/ lex_schema_1.l.lexMap()),
|
|
27
27
|
email: /*#__PURE__*/ lex_schema_1.l.optional(/*#__PURE__*/ lex_schema_1.l.string()),
|
|
28
28
|
emailConfirmed: /*#__PURE__*/ lex_schema_1.l.optional(/*#__PURE__*/ lex_schema_1.l.boolean()),
|
|
29
29
|
emailAuthFactor: /*#__PURE__*/ lex_schema_1.l.optional(/*#__PURE__*/ lex_schema_1.l.boolean()),
|
|
30
30
|
active: /*#__PURE__*/ lex_schema_1.l.optional(/*#__PURE__*/ lex_schema_1.l.boolean()),
|
|
31
|
-
status: /*#__PURE__*/ lex_schema_1.l.optional(
|
|
31
|
+
status: /*#__PURE__*/ lex_schema_1.l.optional(
|
|
32
|
+
/*#__PURE__*/ lex_schema_1.l.string()),
|
|
32
33
|
}), ['AccountTakedown', 'AuthFactorTokenRequired']);
|
|
33
34
|
exports.main = main;
|
|
34
35
|
exports.$lxm = main.nsid, exports.$params = main.parameters, exports.$input = main.input, exports.$output = main.output;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createSession.defs.js","sourceRoot":"","sources":["../../../../../src/lexicons/com/atproto/server/createSession.defs.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,oDAAuC;AAEvC,MAAM,KAAK,GAAG,kCAAkC,CAAA;AAEvC,sBAAK;AAEd,wCAAwC;AACxC,MAAM,IAAI;AACR,aAAa;AACb,cAAC,CAAC,SAAS,CACT,KAAK;AACL,aAAa,CAAC,cAAC,CAAC,MAAM,EAAE;AACxB,aAAa,CAAC,cAAC,CAAC,WAAW,CAAC;IAC1B,UAAU,EAAE,aAAa,CAAC,cAAC,CAAC,MAAM,EAAE;IACpC,QAAQ,EAAE,aAAa,CAAC,cAAC,CAAC,MAAM,EAAE;IAClC,eAAe,EAAE,aAAa,CAAC,cAAC,CAAC,QAAQ,CAAC,aAAa,CAAC,cAAC,CAAC,MAAM,EAAE,CAAC;IACnE,cAAc,EAAE,aAAa,CAAC,cAAC,CAAC,QAAQ,CAAC,aAAa,CAAC,cAAC,CAAC,OAAO,EAAE,CAAC;CACpE,CAAC;AACF,aAAa,CAAC,cAAC,CAAC,WAAW,CAAC;IAC1B,SAAS,EAAE,aAAa,CAAC,cAAC,CAAC,MAAM,EAAE;IACnC,UAAU,EAAE,aAAa,CAAC,cAAC,CAAC,MAAM,EAAE;IACpC,MAAM,EAAE,aAAa,CAAC,cAAC,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC;IACpD,GAAG,EAAE,aAAa,CAAC,cAAC,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;IAC9C,MAAM,EAAE,aAAa,CAAC,cAAC,CAAC,QAAQ,CAAC,aAAa,CAAC,cAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"createSession.defs.js","sourceRoot":"","sources":["../../../../../src/lexicons/com/atproto/server/createSession.defs.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,oDAAuC;AAEvC,MAAM,KAAK,GAAG,kCAAkC,CAAA;AAEvC,sBAAK;AAEd,wCAAwC;AACxC,MAAM,IAAI;AACR,aAAa;AACb,cAAC,CAAC,SAAS,CACT,KAAK;AACL,aAAa,CAAC,cAAC,CAAC,MAAM,EAAE;AACxB,aAAa,CAAC,cA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AAC,CAAC,MAAM,EAElB,CACL;CACF,CAAC,EACF,CAAC,iBAAiB,EAAE,yBAAyB,CAAC,CAC/C,CAAA;AACM,oBAAI;AAcA,QAAA,IAAI,GAAiB,IAAI,CAAC,IAAI,EACzC,QAAA,OAAO,GAAiB,IAAI,CAAC,UAAU,EACvC,QAAA,MAAM,GAAiB,IAAI,CAAC,KAAK,EACjC,QAAA,OAAO,GAAiB,IAAI,CAAC,MAAM,CAAA","sourcesContent":["/*\n * THIS FILE WAS GENERATED BY \"@atproto/lex\". DO NOT EDIT.\n */\n\nimport { l } from '@atproto/lex-schema'\n\nconst $nsid = 'com.atproto.server.createSession'\n\nexport { $nsid }\n\n/** Create an authentication session. */\nconst main =\n /*#__PURE__*/\n l.procedure(\n $nsid,\n /*#__PURE__*/ l.params(),\n /*#__PURE__*/ l.jsonPayload({\n identifier: /*#__PURE__*/ l.string(),\n password: /*#__PURE__*/ l.string(),\n authFactorToken: /*#__PURE__*/ l.optional(/*#__PURE__*/ l.string()),\n allowTakendown: /*#__PURE__*/ l.optional(/*#__PURE__*/ l.boolean()),\n }),\n /*#__PURE__*/ l.jsonPayload({\n accessJwt: /*#__PURE__*/ l.string(),\n refreshJwt: /*#__PURE__*/ l.string(),\n handle: /*#__PURE__*/ l.string({ format: 'handle' }),\n did: /*#__PURE__*/ l.string({ format: 'did' }),\n didDoc: /*#__PURE__*/ l.optional(/*#__PURE__*/ l.lexMap()),\n email: /*#__PURE__*/ l.optional(/*#__PURE__*/ l.string()),\n emailConfirmed: /*#__PURE__*/ l.optional(/*#__PURE__*/ l.boolean()),\n emailAuthFactor: /*#__PURE__*/ l.optional(/*#__PURE__*/ l.boolean()),\n active: /*#__PURE__*/ l.optional(/*#__PURE__*/ l.boolean()),\n status: /*#__PURE__*/ l.optional(\n /*#__PURE__*/ l.string<{\n knownValues: ['takendown', 'suspended', 'deactivated']\n }>(),\n ),\n }),\n ['AccountTakedown', 'AuthFactorTokenRequired'],\n )\nexport { main }\n\nexport type $Params = l.InferMethodParams<typeof main>\nexport type $Input<B = l.BinaryData> = l.InferMethodInput<typeof main, B>\nexport type $InputBody<B = l.BinaryData> = l.InferMethodInputBody<\n typeof main,\n B\n>\nexport type $Output<B = l.BinaryData> = l.InferMethodOutput<typeof main, B>\nexport type $OutputBody<B = l.BinaryData> = l.InferMethodOutputBody<\n typeof main,\n B\n>\n\nexport const $lxm = /*#__PURE__*/ main.nsid,\n $params = /*#__PURE__*/ main.parameters,\n $input = /*#__PURE__*/ main.input,\n $output = /*#__PURE__*/ main.output\n"]}
|
|
@@ -4,10 +4,10 @@ export { $nsid };
|
|
|
4
4
|
/** Delete the current session. Requires auth using the 'refreshJwt' (not the 'accessJwt'). */
|
|
5
5
|
declare const main: l.Procedure<"com.atproto.server.deleteSession", l.ParamsSchema<{}>, l.Payload<undefined, undefined>, l.Payload<undefined, undefined>, readonly ["InvalidToken", "ExpiredToken"]>;
|
|
6
6
|
export { main };
|
|
7
|
-
export type Params = l.InferMethodParams<typeof main>;
|
|
8
|
-
export type Input = l.InferMethodInput<typeof main>;
|
|
9
|
-
export type InputBody = l.InferMethodInputBody<typeof main>;
|
|
10
|
-
export type Output = l.InferMethodOutput<typeof main>;
|
|
11
|
-
export type OutputBody = l.InferMethodOutputBody<typeof main>;
|
|
7
|
+
export type $Params = l.InferMethodParams<typeof main>;
|
|
8
|
+
export type $Input<B = l.BinaryData> = l.InferMethodInput<typeof main, B>;
|
|
9
|
+
export type $InputBody<B = l.BinaryData> = l.InferMethodInputBody<typeof main, B>;
|
|
10
|
+
export type $Output<B = l.BinaryData> = l.InferMethodOutput<typeof main, B>;
|
|
11
|
+
export type $OutputBody<B = l.BinaryData> = l.InferMethodOutputBody<typeof main, B>;
|
|
12
12
|
export declare const $lxm: "com.atproto.server.deleteSession", $params: l.ParamsSchema<{}>, $input: l.Payload<undefined, undefined>, $output: l.Payload<undefined, undefined>;
|
|
13
13
|
//# sourceMappingURL=deleteSession.defs.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deleteSession.defs.d.ts","sourceRoot":"","sources":["../../../../../src/lexicons/com/atproto/server/deleteSession.defs.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,CAAC,EAAE,MAAM,qBAAqB,CAAA;AAEvC,QAAA,MAAM,KAAK,qCAAqC,CAAA;AAEhD,OAAO,EAAE,KAAK,EAAE,CAAA;AAEhB,8FAA8F;AAC9F,QAAA,MAAM,IAAI,kLAQP,CAAA;AACH,OAAO,EAAE,IAAI,EAAE,CAAA;AAEf,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"deleteSession.defs.d.ts","sourceRoot":"","sources":["../../../../../src/lexicons/com/atproto/server/deleteSession.defs.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,CAAC,EAAE,MAAM,qBAAqB,CAAA;AAEvC,QAAA,MAAM,KAAK,qCAAqC,CAAA;AAEhD,OAAO,EAAE,KAAK,EAAE,CAAA;AAEhB,8FAA8F;AAC9F,QAAA,MAAM,IAAI,kLAQP,CAAA;AACH,OAAO,EAAE,IAAI,EAAE,CAAA;AAEf,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,iBAAiB,CAAC,OAAO,IAAI,CAAC,CAAA;AACtD,MAAM,MAAM,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,UAAU,IAAI,CAAC,CAAC,gBAAgB,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,CAAA;AACzE,MAAM,MAAM,UAAU,CAAC,CAAC,GAAG,CAAC,CAAC,UAAU,IAAI,CAAC,CAAC,oBAAoB,CAC/D,OAAO,IAAI,EACX,CAAC,CACF,CAAA;AACD,MAAM,MAAM,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,UAAU,IAAI,CAAC,CAAC,iBAAiB,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,CAAA;AAC3E,MAAM,MAAM,WAAW,CAAC,CAAC,GAAG,CAAC,CAAC,UAAU,IAAI,CAAC,CAAC,qBAAqB,CACjE,OAAO,IAAI,EACX,CAAC,CACF,CAAA;AAED,eAAO,MAAM,IAAI,oCAA0B,EACzC,OAAO,oBAAgC,EACvC,MAAM,iCAA2B,EACjC,OAAO,iCAA4B,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deleteSession.defs.js","sourceRoot":"","sources":["../../../../../src/lexicons/com/atproto/server/deleteSession.defs.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,oDAAuC;AAEvC,MAAM,KAAK,GAAG,kCAAkC,CAAA;AAEvC,sBAAK;AAEd,8FAA8F;AAC9F,MAAM,IAAI;AACR,aAAa;AACb,cAAC,CAAC,SAAS,CACT,KAAK;AACL,aAAa,CAAC,cAAC,CAAC,MAAM,EAAE;AACxB,aAAa,CAAC,cAAC,CAAC,OAAO,EAAE;AACzB,aAAa,CAAC,cAAC,CAAC,OAAO,EAAE,EACzB,CAAC,cAAc,EAAE,cAAc,CAAC,CACjC,CAAA;AACM,oBAAI;
|
|
1
|
+
{"version":3,"file":"deleteSession.defs.js","sourceRoot":"","sources":["../../../../../src/lexicons/com/atproto/server/deleteSession.defs.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,oDAAuC;AAEvC,MAAM,KAAK,GAAG,kCAAkC,CAAA;AAEvC,sBAAK;AAEd,8FAA8F;AAC9F,MAAM,IAAI;AACR,aAAa;AACb,cAAC,CAAC,SAAS,CACT,KAAK;AACL,aAAa,CAAC,cAAC,CAAC,MAAM,EAAE;AACxB,aAAa,CAAC,cAAC,CAAC,OAAO,EAAE;AACzB,aAAa,CAAC,cAAC,CAAC,OAAO,EAAE,EACzB,CAAC,cAAc,EAAE,cAAc,CAAC,CACjC,CAAA;AACM,oBAAI;AAcA,QAAA,IAAI,GAAiB,IAAI,CAAC,IAAI,EACzC,QAAA,OAAO,GAAiB,IAAI,CAAC,UAAU,EACvC,QAAA,MAAM,GAAiB,IAAI,CAAC,KAAK,EACjC,QAAA,OAAO,GAAiB,IAAI,CAAC,MAAM,CAAA","sourcesContent":["/*\n * THIS FILE WAS GENERATED BY \"@atproto/lex\". DO NOT EDIT.\n */\n\nimport { l } from '@atproto/lex-schema'\n\nconst $nsid = 'com.atproto.server.deleteSession'\n\nexport { $nsid }\n\n/** Delete the current session. Requires auth using the 'refreshJwt' (not the 'accessJwt'). */\nconst main =\n /*#__PURE__*/\n l.procedure(\n $nsid,\n /*#__PURE__*/ l.params(),\n /*#__PURE__*/ l.payload(),\n /*#__PURE__*/ l.payload(),\n ['InvalidToken', 'ExpiredToken'],\n )\nexport { main }\n\nexport type $Params = l.InferMethodParams<typeof main>\nexport type $Input<B = l.BinaryData> = l.InferMethodInput<typeof main, B>\nexport type $InputBody<B = l.BinaryData> = l.InferMethodInputBody<\n typeof main,\n B\n>\nexport type $Output<B = l.BinaryData> = l.InferMethodOutput<typeof main, B>\nexport type $OutputBody<B = l.BinaryData> = l.InferMethodOutputBody<\n typeof main,\n B\n>\n\nexport const $lxm = /*#__PURE__*/ main.nsid,\n $params = /*#__PURE__*/ main.parameters,\n $input = /*#__PURE__*/ main.input,\n $output = /*#__PURE__*/ main.output\n"]}
|
|
@@ -9,17 +9,19 @@ declare const main: l.Query<"com.atproto.server.getSession", l.ParamsSchema<{}>,
|
|
|
9
9
|
did: l.StringSchema<{
|
|
10
10
|
readonly format: "did";
|
|
11
11
|
}>;
|
|
12
|
-
didDoc: l.OptionalSchema<l.
|
|
12
|
+
didDoc: l.OptionalSchema<l.LexMapSchema>;
|
|
13
13
|
email: l.OptionalSchema<l.StringSchema<{}>>;
|
|
14
14
|
emailConfirmed: l.OptionalSchema<l.BooleanSchema>;
|
|
15
15
|
emailAuthFactor: l.OptionalSchema<l.BooleanSchema>;
|
|
16
16
|
active: l.OptionalSchema<l.BooleanSchema>;
|
|
17
|
-
status: l.OptionalSchema<l.StringSchema<{
|
|
17
|
+
status: l.OptionalSchema<l.StringSchema<{
|
|
18
|
+
knownValues: ["takendown", "suspended", "deactivated"];
|
|
19
|
+
}>>;
|
|
18
20
|
}>>, undefined>;
|
|
19
21
|
export { main };
|
|
20
|
-
export type Params = l.InferMethodParams<typeof main>;
|
|
21
|
-
export type Output = l.InferMethodOutput<typeof main>;
|
|
22
|
-
export type OutputBody = l.InferMethodOutputBody<typeof main>;
|
|
22
|
+
export type $Params = l.InferMethodParams<typeof main>;
|
|
23
|
+
export type $Output<B = l.BinaryData> = l.InferMethodOutput<typeof main, B>;
|
|
24
|
+
export type $OutputBody<B = l.BinaryData> = l.InferMethodOutputBody<typeof main, B>;
|
|
23
25
|
export declare const $lxm: "com.atproto.server.getSession", $params: l.ParamsSchema<{}>, $output: l.Payload<"application/json", l.ObjectSchema<{
|
|
24
26
|
handle: l.StringSchema<{
|
|
25
27
|
readonly format: "handle";
|
|
@@ -27,11 +29,13 @@ export declare const $lxm: "com.atproto.server.getSession", $params: l.ParamsSch
|
|
|
27
29
|
did: l.StringSchema<{
|
|
28
30
|
readonly format: "did";
|
|
29
31
|
}>;
|
|
30
|
-
didDoc: l.OptionalSchema<l.
|
|
32
|
+
didDoc: l.OptionalSchema<l.LexMapSchema>;
|
|
31
33
|
email: l.OptionalSchema<l.StringSchema<{}>>;
|
|
32
34
|
emailConfirmed: l.OptionalSchema<l.BooleanSchema>;
|
|
33
35
|
emailAuthFactor: l.OptionalSchema<l.BooleanSchema>;
|
|
34
36
|
active: l.OptionalSchema<l.BooleanSchema>;
|
|
35
|
-
status: l.OptionalSchema<l.StringSchema<{
|
|
37
|
+
status: l.OptionalSchema<l.StringSchema<{
|
|
38
|
+
knownValues: ["takendown", "suspended", "deactivated"];
|
|
39
|
+
}>>;
|
|
36
40
|
}>>;
|
|
37
41
|
//# sourceMappingURL=getSession.defs.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getSession.defs.d.ts","sourceRoot":"","sources":["../../../../../src/lexicons/com/atproto/server/getSession.defs.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,CAAC,EAAE,MAAM,qBAAqB,CAAA;AAEvC,QAAA,MAAM,KAAK,kCAAkC,CAAA;AAE7C,OAAO,EAAE,KAAK,EAAE,CAAA;AAEhB,qEAAqE;AACrE,QAAA,MAAM,IAAI
|
|
1
|
+
{"version":3,"file":"getSession.defs.d.ts","sourceRoot":"","sources":["../../../../../src/lexicons/com/atproto/server/getSession.defs.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,CAAC,EAAE,MAAM,qBAAqB,CAAA;AAEvC,QAAA,MAAM,KAAK,kCAAkC,CAAA;AAE7C,OAAO,EAAE,KAAK,EAAE,CAAA;AAEhB,qEAAqE;AACrE,QAAA,MAAM,IAAI;;;;;;;;;;;;;;;eAmBP,CAAA;AACH,OAAO,EAAE,IAAI,EAAE,CAAA;AAEf,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,iBAAiB,CAAC,OAAO,IAAI,CAAC,CAAA;AACtD,MAAM,MAAM,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,UAAU,IAAI,CAAC,CAAC,iBAAiB,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,CAAA;AAC3E,MAAM,MAAM,WAAW,CAAC,CAAC,GAAG,CAAC,CAAC,UAAU,IAAI,CAAC,CAAC,qBAAqB,CACjE,OAAO,IAAI,EACX,CAAC,CACF,CAAA;AAED,eAAO,MAAM,IAAI,iCAA0B,EACzC,OAAO,oBAAkB,EACzB,OAAO;;;;;;;;;;;;;;;GAAc,CAAA"}
|
|
@@ -15,12 +15,13 @@ lex_schema_1.l.query($nsid,
|
|
|
15
15
|
/*#__PURE__*/ lex_schema_1.l.jsonPayload({
|
|
16
16
|
handle: /*#__PURE__*/ lex_schema_1.l.string({ format: 'handle' }),
|
|
17
17
|
did: /*#__PURE__*/ lex_schema_1.l.string({ format: 'did' }),
|
|
18
|
-
didDoc: /*#__PURE__*/ lex_schema_1.l.optional(/*#__PURE__*/ lex_schema_1.l.
|
|
18
|
+
didDoc: /*#__PURE__*/ lex_schema_1.l.optional(/*#__PURE__*/ lex_schema_1.l.lexMap()),
|
|
19
19
|
email: /*#__PURE__*/ lex_schema_1.l.optional(/*#__PURE__*/ lex_schema_1.l.string()),
|
|
20
20
|
emailConfirmed: /*#__PURE__*/ lex_schema_1.l.optional(/*#__PURE__*/ lex_schema_1.l.boolean()),
|
|
21
21
|
emailAuthFactor: /*#__PURE__*/ lex_schema_1.l.optional(/*#__PURE__*/ lex_schema_1.l.boolean()),
|
|
22
22
|
active: /*#__PURE__*/ lex_schema_1.l.optional(/*#__PURE__*/ lex_schema_1.l.boolean()),
|
|
23
|
-
status: /*#__PURE__*/ lex_schema_1.l.optional(
|
|
23
|
+
status: /*#__PURE__*/ lex_schema_1.l.optional(
|
|
24
|
+
/*#__PURE__*/ lex_schema_1.l.string()),
|
|
24
25
|
}));
|
|
25
26
|
exports.main = main;
|
|
26
27
|
exports.$lxm = main.nsid, exports.$params = main.parameters, exports.$output = main.output;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getSession.defs.js","sourceRoot":"","sources":["../../../../../src/lexicons/com/atproto/server/getSession.defs.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,oDAAuC;AAEvC,MAAM,KAAK,GAAG,+BAA+B,CAAA;AAEpC,sBAAK;AAEd,qEAAqE;AACrE,MAAM,IAAI;AACR,aAAa;AACb,cAAC,CAAC,KAAK,CACL,KAAK;AACL,aAAa,CAAC,cAAC,CAAC,MAAM,EAAE;AACxB,aAAa,CAAC,cAAC,CAAC,WAAW,CAAC;IAC1B,MAAM,EAAE,aAAa,CAAC,cAAC,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC;IACpD,GAAG,EAAE,aAAa,CAAC,cAAC,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;IAC9C,MAAM,EAAE,aAAa,CAAC,cAAC,CAAC,QAAQ,CAAC,aAAa,CAAC,cAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"getSession.defs.js","sourceRoot":"","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AAA","sourcesContent":["/*\n * THIS FILE WAS GENERATED BY \"@atproto/lex\". DO NOT EDIT.\n */\n\nimport { l } from '@atproto/lex-schema'\n\nconst $nsid = 'com.atproto.server.getSession'\n\nexport { $nsid }\n\n/** Get information about the current auth session. Requires auth. */\nconst main =\n /*#__PURE__*/\n l.query(\n $nsid,\n /*#__PURE__*/ l.params(),\n /*#__PURE__*/ l.jsonPayload({\n handle: /*#__PURE__*/ l.string({ format: 'handle' }),\n did: /*#__PURE__*/ l.string({ format: 'did' }),\n didDoc: /*#__PURE__*/ l.optional(/*#__PURE__*/ l.lexMap()),\n email: /*#__PURE__*/ l.optional(/*#__PURE__*/ l.string()),\n emailConfirmed: /*#__PURE__*/ l.optional(/*#__PURE__*/ l.boolean()),\n emailAuthFactor: /*#__PURE__*/ l.optional(/*#__PURE__*/ l.boolean()),\n active: /*#__PURE__*/ l.optional(/*#__PURE__*/ l.boolean()),\n status: /*#__PURE__*/ l.optional(\n /*#__PURE__*/ l.string<{\n knownValues: ['takendown', 'suspended', 'deactivated']\n }>(),\n ),\n }),\n )\nexport { main }\n\nexport type $Params = l.InferMethodParams<typeof main>\nexport type $Output<B = l.BinaryData> = l.InferMethodOutput<typeof main, B>\nexport type $OutputBody<B = l.BinaryData> = l.InferMethodOutputBody<\n typeof main,\n B\n>\n\nexport const $lxm = /*#__PURE__*/ main.nsid,\n $params = main.parameters,\n $output = main.output\n"]}
|
|
@@ -11,19 +11,21 @@ declare const main: l.Procedure<"com.atproto.server.refreshSession", l.ParamsSch
|
|
|
11
11
|
did: l.StringSchema<{
|
|
12
12
|
readonly format: "did";
|
|
13
13
|
}>;
|
|
14
|
-
didDoc: l.OptionalSchema<l.
|
|
14
|
+
didDoc: l.OptionalSchema<l.LexMapSchema>;
|
|
15
15
|
email: l.OptionalSchema<l.StringSchema<{}>>;
|
|
16
16
|
emailConfirmed: l.OptionalSchema<l.BooleanSchema>;
|
|
17
17
|
emailAuthFactor: l.OptionalSchema<l.BooleanSchema>;
|
|
18
18
|
active: l.OptionalSchema<l.BooleanSchema>;
|
|
19
|
-
status: l.OptionalSchema<l.StringSchema<{
|
|
19
|
+
status: l.OptionalSchema<l.StringSchema<{
|
|
20
|
+
knownValues: ["takendown", "suspended", "deactivated"];
|
|
21
|
+
}>>;
|
|
20
22
|
}>>, readonly ["AccountTakedown", "InvalidToken", "ExpiredToken"]>;
|
|
21
23
|
export { main };
|
|
22
|
-
export type Params = l.InferMethodParams<typeof main>;
|
|
23
|
-
export type Input = l.InferMethodInput<typeof main>;
|
|
24
|
-
export type InputBody = l.InferMethodInputBody<typeof main>;
|
|
25
|
-
export type Output = l.InferMethodOutput<typeof main>;
|
|
26
|
-
export type OutputBody = l.InferMethodOutputBody<typeof main>;
|
|
24
|
+
export type $Params = l.InferMethodParams<typeof main>;
|
|
25
|
+
export type $Input<B = l.BinaryData> = l.InferMethodInput<typeof main, B>;
|
|
26
|
+
export type $InputBody<B = l.BinaryData> = l.InferMethodInputBody<typeof main, B>;
|
|
27
|
+
export type $Output<B = l.BinaryData> = l.InferMethodOutput<typeof main, B>;
|
|
28
|
+
export type $OutputBody<B = l.BinaryData> = l.InferMethodOutputBody<typeof main, B>;
|
|
27
29
|
export declare const $lxm: "com.atproto.server.refreshSession", $params: l.ParamsSchema<{}>, $input: l.Payload<undefined, undefined>, $output: l.Payload<"application/json", l.ObjectSchema<{
|
|
28
30
|
accessJwt: l.StringSchema<{}>;
|
|
29
31
|
refreshJwt: l.StringSchema<{}>;
|
|
@@ -33,11 +35,13 @@ export declare const $lxm: "com.atproto.server.refreshSession", $params: l.Param
|
|
|
33
35
|
did: l.StringSchema<{
|
|
34
36
|
readonly format: "did";
|
|
35
37
|
}>;
|
|
36
|
-
didDoc: l.OptionalSchema<l.
|
|
38
|
+
didDoc: l.OptionalSchema<l.LexMapSchema>;
|
|
37
39
|
email: l.OptionalSchema<l.StringSchema<{}>>;
|
|
38
40
|
emailConfirmed: l.OptionalSchema<l.BooleanSchema>;
|
|
39
41
|
emailAuthFactor: l.OptionalSchema<l.BooleanSchema>;
|
|
40
42
|
active: l.OptionalSchema<l.BooleanSchema>;
|
|
41
|
-
status: l.OptionalSchema<l.StringSchema<{
|
|
43
|
+
status: l.OptionalSchema<l.StringSchema<{
|
|
44
|
+
knownValues: ["takendown", "suspended", "deactivated"];
|
|
45
|
+
}>>;
|
|
42
46
|
}>>;
|
|
43
47
|
//# sourceMappingURL=refreshSession.defs.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"refreshSession.defs.d.ts","sourceRoot":"","sources":["../../../../../src/lexicons/com/atproto/server/refreshSession.defs.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,CAAC,EAAE,MAAM,qBAAqB,CAAA;AAEvC,QAAA,MAAM,KAAK,sCAAsC,CAAA;AAEjD,OAAO,EAAE,KAAK,EAAE,CAAA;AAEhB,qGAAqG;AACrG,QAAA,MAAM,IAAI
|
|
1
|
+
{"version":3,"file":"refreshSession.defs.d.ts","sourceRoot":"","sources":["../../../../../src/lexicons/com/atproto/server/refreshSession.defs.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,CAAC,EAAE,MAAM,qBAAqB,CAAA;AAEvC,QAAA,MAAM,KAAK,sCAAsC,CAAA;AAEjD,OAAO,EAAE,KAAK,EAAE,CAAA;AAEhB,qGAAqG;AACrG,QAAA,MAAM,IAAI;;;;;;;;;;;;;;;;;kEAuBP,CAAA;AACH,OAAO,EAAE,IAAI,EAAE,CAAA;AAEf,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,iBAAiB,CAAC,OAAO,IAAI,CAAC,CAAA;AACtD,MAAM,MAAM,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,UAAU,IAAI,CAAC,CAAC,gBAAgB,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,CAAA;AACzE,MAAM,MAAM,UAAU,CAAC,CAAC,GAAG,CAAC,CAAC,UAAU,IAAI,CAAC,CAAC,oBAAoB,CAC/D,OAAO,IAAI,EACX,CAAC,CACF,CAAA;AACD,MAAM,MAAM,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,UAAU,IAAI,CAAC,CAAC,iBAAiB,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,CAAA;AAC3E,MAAM,MAAM,WAAW,CAAC,CAAC,GAAG,CAAC,CAAC,UAAU,IAAI,CAAC,CAAC,qBAAqB,CACjE,OAAO,IAAI,EACX,CAAC,CACF,CAAA;AAED,eAAO,MAAM,IAAI,qCAA0B,EACzC,OAAO,oBAAgC,EACvC,MAAM,iCAA2B,EACjC,OAAO;;;;;;;;;;;;;;;;;GAA4B,CAAA"}
|
|
@@ -18,12 +18,13 @@ lex_schema_1.l.procedure($nsid,
|
|
|
18
18
|
refreshJwt: /*#__PURE__*/ lex_schema_1.l.string(),
|
|
19
19
|
handle: /*#__PURE__*/ lex_schema_1.l.string({ format: 'handle' }),
|
|
20
20
|
did: /*#__PURE__*/ lex_schema_1.l.string({ format: 'did' }),
|
|
21
|
-
didDoc: /*#__PURE__*/ lex_schema_1.l.optional(/*#__PURE__*/ lex_schema_1.l.
|
|
21
|
+
didDoc: /*#__PURE__*/ lex_schema_1.l.optional(/*#__PURE__*/ lex_schema_1.l.lexMap()),
|
|
22
22
|
email: /*#__PURE__*/ lex_schema_1.l.optional(/*#__PURE__*/ lex_schema_1.l.string()),
|
|
23
23
|
emailConfirmed: /*#__PURE__*/ lex_schema_1.l.optional(/*#__PURE__*/ lex_schema_1.l.boolean()),
|
|
24
24
|
emailAuthFactor: /*#__PURE__*/ lex_schema_1.l.optional(/*#__PURE__*/ lex_schema_1.l.boolean()),
|
|
25
25
|
active: /*#__PURE__*/ lex_schema_1.l.optional(/*#__PURE__*/ lex_schema_1.l.boolean()),
|
|
26
|
-
status: /*#__PURE__*/ lex_schema_1.l.optional(
|
|
26
|
+
status: /*#__PURE__*/ lex_schema_1.l.optional(
|
|
27
|
+
/*#__PURE__*/ lex_schema_1.l.string()),
|
|
27
28
|
}), ['AccountTakedown', 'InvalidToken', 'ExpiredToken']);
|
|
28
29
|
exports.main = main;
|
|
29
30
|
exports.$lxm = main.nsid, exports.$params = main.parameters, exports.$input = main.input, exports.$output = main.output;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"refreshSession.defs.js","sourceRoot":"","sources":["../../../../../src/lexicons/com/atproto/server/refreshSession.defs.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,oDAAuC;AAEvC,MAAM,KAAK,GAAG,mCAAmC,CAAA;AAExC,sBAAK;AAEd,qGAAqG;AACrG,MAAM,IAAI;AACR,aAAa;AACb,cAAC,CAAC,SAAS,CACT,KAAK;AACL,aAAa,CAAC,cAAC,CAAC,MAAM,EAAE;AACxB,aAAa,CAAC,cAAC,CAAC,OAAO,EAAE;AACzB,aAAa,CAAC,cAAC,CAAC,WAAW,CAAC;IAC1B,SAAS,EAAE,aAAa,CAAC,cAAC,CAAC,MAAM,EAAE;IACnC,UAAU,EAAE,aAAa,CAAC,cAAC,CAAC,MAAM,EAAE;IACpC,MAAM,EAAE,aAAa,CAAC,cAAC,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC;IACpD,GAAG,EAAE,aAAa,CAAC,cAAC,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;IAC9C,MAAM,EAAE,aAAa,CAAC,cAAC,CAAC,QAAQ,CAAC,aAAa,CAAC,cAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"refreshSession.defs.js","sourceRoot":"","sources":["../../../../../src/lexicons/com/atproto/server/refreshSession.defs.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,oDAAuC;AAEvC,MAAM,KAAK,GAAG,mCAAmC,CAAA;AAExC,sBAAK;AAEd,qGAAqG;AACrG,MAAM,IAAI;AACR,aAAa;AACb,cAAC,CAAC,SAAS,CACT,KAAK;AACL,aAAa,CAAC,cAAC,CAAC,MAAM,EAAE;AACxB,aAAa,CAAC,cA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S GENERATED BY \"@atproto/lex\". DO NOT EDIT.\n */\n\nimport { l } from '@atproto/lex-schema'\n\nconst $nsid = 'com.atproto.server.refreshSession'\n\nexport { $nsid }\n\n/** Refresh an authentication session. Requires auth using the 'refreshJwt' (not the 'accessJwt'). */\nconst main =\n /*#__PURE__*/\n l.procedure(\n $nsid,\n /*#__PURE__*/ l.params(),\n /*#__PURE__*/ l.payload(),\n /*#__PURE__*/ l.jsonPayload({\n accessJwt: /*#__PURE__*/ l.string(),\n refreshJwt: /*#__PURE__*/ l.string(),\n handle: /*#__PURE__*/ l.string({ format: 'handle' }),\n did: /*#__PURE__*/ l.string({ format: 'did' }),\n didDoc: /*#__PURE__*/ l.optional(/*#__PURE__*/ l.lexMap()),\n email: /*#__PURE__*/ l.optional(/*#__PURE__*/ l.string()),\n emailConfirmed: /*#__PURE__*/ l.optional(/*#__PURE__*/ l.boolean()),\n emailAuthFactor: /*#__PURE__*/ l.optional(/*#__PURE__*/ l.boolean()),\n active: /*#__PURE__*/ l.optional(/*#__PURE__*/ l.boolean()),\n status: /*#__PURE__*/ l.optional(\n /*#__PURE__*/ l.string<{\n knownValues: ['takendown', 'suspended', 'deactivated']\n }>(),\n ),\n }),\n ['AccountTakedown', 'InvalidToken', 'ExpiredToken'],\n )\nexport { main }\n\nexport type $Params = l.InferMethodParams<typeof main>\nexport type $Input<B = l.BinaryData> = l.InferMethodInput<typeof main, B>\nexport type $InputBody<B = l.BinaryData> = l.InferMethodInputBody<\n typeof main,\n B\n>\nexport type $Output<B = l.BinaryData> = l.InferMethodOutput<typeof main, B>\nexport type $OutputBody<B = l.BinaryData> = l.InferMethodOutputBody<\n typeof main,\n B\n>\n\nexport const $lxm = /*#__PURE__*/ main.nsid,\n $params = /*#__PURE__*/ main.parameters,\n $input = /*#__PURE__*/ main.input,\n $output = /*#__PURE__*/ main.output\n"]}
|
|
@@ -23,7 +23,7 @@ export type DeleteFailure = XrpcFailure<typeof com.atproto.server.deleteSession.
|
|
|
23
23
|
* service URL used for authentication. Store this data securely to resume sessions
|
|
24
24
|
* later without re-authenticating.
|
|
25
25
|
*/
|
|
26
|
-
export type SessionData = com.atproto.server.createSession
|
|
26
|
+
export type SessionData = com.atproto.server.createSession.$OutputBody & {
|
|
27
27
|
service: string;
|
|
28
28
|
};
|
|
29
29
|
export type PasswordSessionOptions = {
|
|
@@ -217,7 +217,7 @@ export declare class PasswordSession implements Agent {
|
|
|
217
217
|
* )
|
|
218
218
|
* ```
|
|
219
219
|
*/
|
|
220
|
-
static createAccount(body: com.atproto.server.createAccount
|
|
220
|
+
static createAccount(body: com.atproto.server.createAccount.$InputBody, { service, headers, ...options }: PasswordSessionOptions & {
|
|
221
221
|
headers?: HeadersInit;
|
|
222
222
|
service: string | URL;
|
|
223
223
|
}): Promise<PasswordSession>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"password-session.d.ts","sourceRoot":"","sources":["../src/password-session.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EACL,WAAW,EAIZ,MAAM,qBAAqB,CAAA;AAE5B,OAAO,EAAE,GAAG,EAAE,MAAM,qBAAqB,CAAA;AAGzC;;;;;;GAMG;AACH,MAAM,MAAM,cAAc,GAAG,WAAW,CACtC,OAAO,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,cAAc,CAAC,IAAI,CAC9C,CAAA;AAED;;;;;;GAMG;AACH,MAAM,MAAM,aAAa,GAAG,WAAW,CACrC,OAAO,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,aAAa,CAAC,IAAI,CAC7C,CAAA;AAED;;;;;;GAMG;AACH,MAAM,MAAM,WAAW,GAAG,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,aAAa,CAAC,
|
|
1
|
+
{"version":3,"file":"password-session.d.ts","sourceRoot":"","sources":["../src/password-session.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EACL,WAAW,EAIZ,MAAM,qBAAqB,CAAA;AAE5B,OAAO,EAAE,GAAG,EA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CAAA;IACtB,CAAC;CACF;AAvcD,0CAucC;AAED,SAAS,QAAQ,CAAC,WAAwB,EAAE,IAAY;IACtD,MAAM,MAAM,GAAG,IAAA,uBAAa,EAAC,WAAW,CAAC,MAAM,CAAC,CAAA;IAChD,OAAO,IAAI,GAAG,CAAC,IAAI,EAAE,MAAM,IAAI,WAAW,CAAC,OAAO,CAAC,CAAA;AACrD,CAAC","sourcesContent":["import {\n Agent,\n XrpcFailure,\n buildAgent,\n xrpc,\n xrpcSafe,\n} from '@atproto/lex-client'\nimport { LexAuthFactorError } from './error.js'\nimport { com } from './lexicons/index.js'\nimport { extractPdsUrl, extractXrpcErrorCode } from './util.js'\n\n/**\n * Represents a failure response when refreshing a session.\n *\n * This type captures the possible error responses from\n * `com.atproto.server.refreshSession`, including both expected errors\n * (e.g., invalid/expired refresh token) and unexpected errors (e.g., network issues).\n */\nexport type RefreshFailure = XrpcFailure<\n typeof com.atproto.server.refreshSession.main\n>\n\n/**\n * Represents a failure response when deleting a session.\n *\n * This type captures the possible error responses from\n * `com.atproto.server.deleteSession`, including both expected errors\n * and unexpected errors (e.g., network issues, server unavailability).\n */\nexport type DeleteFailure = XrpcFailure<\n typeof com.atproto.server.deleteSession.main\n>\n\n/**\n * Persisted session data containing authentication credentials and service information.\n *\n * This type extends the response from `com.atproto.server.createSession` with the\n * service URL used for authentication. Store this data securely to resume sessions\n * later without re-authenticating.\n */\nexport type SessionData = com.atproto.server.createSession.OutputBody & {\n service: string\n}\n\nexport type PasswordSessionOptions = {\n /**\n * Custom fetch implementation to use for network requests\n */\n fetch?: typeof globalThis.fetch\n\n /**\n * Called whenever the session is successfully created/refreshed, and new\n * credentials have been obtained. Use this hook to persist the updated\n * session information.\n *\n * If this callback returns a promise, this function will never be called\n * again (on the same process) until the promise resolves.\n *\n * @note this function **must** not throw\n */\n onUpdated?: (this: PasswordSession, data: SessionData) => void | Promise<void>\n\n /**\n * Called whenever the session update fails due to an expected error, such as\n * a network issue or server unavailability. This function can be used to log\n * the error or notify the user, but should not assume that the session is\n * invalid.\n *\n * @note this function **must** not throw\n */\n onUpdateFailure?: (\n this: PasswordSession,\n data: SessionData,\n err: RefreshFailure,\n ) => void | Promise<void>\n\n /**\n * Called whenever the session is deleted, either due to an explicit logout or\n * because the refresh operation indicated that the session is no longer\n * valid. Use this hook to clean up any persisted session information and\n * update the application state accordingly.\n *\n * @note this function **must** not throw\n */\n onDeleted?: (this: PasswordSession, data: SessionData) => void | Promise<void>\n\n /**\n * Called whenever a session deletion fails due to an unexpected error, such\n * as a network issue or server unavailability. This function can be used to\n * log the error or notify the user. When this function is called, the session\n * might still be valid on the server. It is up to the implementation to\n * decide whether to retry the deletion or keep the session active. Ignoring\n * these errors is not recommended as it can lead to orphaned sessions on the\n * server, or security issues if the user believes they have logged out when a\n * bad actor is still using the session. The implementation should consider\n * keeping track of failed deletions and retrying them later, until they\n * succeed.\n *\n * @note this function **must** not throw\n */\n onDeleteFailure?: (\n this: PasswordSession,\n data: SessionData,\n err: DeleteFailure,\n ) => void | Promise<void>\n}\n\n/**\n * Password-based authentication session for AT Protocol services.\n *\n * This class provides session management for CLI tools, scripts, and bots that\n * need to authenticate with AT Protocol services using password credentials.\n * It implements the {@link Agent} interface, allowing it to be used directly\n * with AT Protocol clients.\n *\n * **Security Warning:** It is strongly recommended to use app passwords instead\n * of main account credentials. App passwords provide limited access and can be\n * revoked independently without compromising your main account. For browser-based\n * applications, use OAuth-based authentication instead.\n *\n * @example Basic usage with app password\n * ```ts\n * const session = await PasswordSession.login({\n * service: 'https://bsky.social',\n * identifier: 'alice.bsky.social',\n * password: 'xxxx-xxxx-xxxx-xxxx', // App password\n * onUpdated: (data) => saveToStorage(data),\n * onDeleted: (data) => clearStorage(data.did),\n * })\n *\n * const client = new Client(session)\n * // Use client to make authenticated requests\n * ```\n *\n * @example Resuming a persisted session\n * ```ts\n * const savedData = JSON.parse(fs.readFileSync('session.json', 'utf8'))\n * const session = await PasswordSession.resume(savedData, {\n * onUpdated: (data) => saveToStorage(data),\n * onDeleted: (data) => clearStorage(data.did),\n * })\n * ```\n *\n * @implements {Agent}\n */\nexport class PasswordSession implements Agent {\n /**\n * Internal {@link Agent} used for session management towards the\n * authentication service only.\n */\n #serviceAgent: Agent\n\n #sessionData: null | SessionData\n #sessionPromise: Promise<SessionData>\n\n constructor(\n sessionData: SessionData,\n protected readonly options: PasswordSessionOptions = {},\n ) {\n this.#serviceAgent = buildAgent({\n service: sessionData.service,\n fetch: options.fetch,\n })\n\n this.#sessionData = sessionData\n this.#sessionPromise = Promise.resolve(this.#sessionData)\n }\n\n /**\n * The DID (Decentralized Identifier) of the authenticated account.\n *\n * @throws {Error} If the session has been destroyed (logged out).\n */\n get did() {\n return this.session.did\n }\n\n /**\n * The handle (username) of the authenticated account.\n *\n * @throws {Error} If the session has been destroyed (logged out).\n */\n get handle() {\n return this.session.handle\n }\n\n /**\n * The current session data containing authentication credentials.\n *\n * @throws {Error} If the session has been destroyed (logged out).\n */\n get session() {\n if (this.#sessionData) return this.#sessionData\n throw new Error('Logged out')\n }\n\n /**\n * Whether this session has been destroyed (logged out).\n *\n * Once destroyed, this session instance can no longer be used for\n * authenticated requests. Create a new session via {@link PasswordSession.login}\n * or {@link PasswordSession.resume}.\n */\n get destroyed(): boolean {\n return this.#sessionData === null\n }\n\n /**\n * Handles authenticated fetch requests to the user's PDS.\n *\n * This method implements the {@link Agent} interface and is called by\n * AT Protocol clients to make authenticated requests. It automatically:\n * - Adds the access token to request headers\n * - Detects expired tokens and triggers refresh\n * - Retries requests after successful token refresh\n *\n * @param path - The request path (will be resolved against the PDS URL)\n * @param init - Standard fetch RequestInit options (headers, body, etc.)\n * @returns The fetch Response from the PDS\n * @throws {TypeError} If an 'authorization' header is already set in init\n */\n async fetchHandler(path: string, init: RequestInit): Promise<Response> {\n const headers = new Headers(init.headers)\n if (headers.has('authorization')) {\n throw new TypeError(\"Unexpected 'authorization' header set\")\n }\n\n const sessionPromise = this.#sessionPromise\n const sessionData = await sessionPromise\n\n const fetch = this.options.fetch ?? globalThis.fetch\n\n headers.set('authorization', `Bearer ${sessionData.accessJwt}`)\n const initialRes = await fetch(fetchUrl(sessionData, path), {\n ...init,\n headers,\n })\n\n const refreshNeeded =\n initialRes.status === 401 ||\n (initialRes.status === 400 &&\n (await extractXrpcErrorCode(initialRes)) === 'ExpiredToken')\n\n if (!refreshNeeded) {\n return initialRes\n }\n\n // Refresh session (unless it was already refreshed in the meantime)\n const newSessionPromise =\n this.#sessionPromise === sessionPromise\n ? this.refresh()\n : this.#sessionPromise\n\n // Error should have been propagated through hooks\n const newSessionData = await newSessionPromise.catch((_err) => null)\n if (!newSessionData) {\n return initialRes\n }\n\n // refresh silently failed, no point in retrying.\n if (newSessionData.accessJwt === sessionData.accessJwt) {\n return initialRes\n }\n\n if (init?.signal?.aborted) {\n return initialRes\n }\n\n // The stream was already consumed. We cannot retry the request. A solution\n // would be to tee() the input stream but that would bufferize the entire\n // stream in memory which can lead to memory starvation. Instead, we will\n // return the original response and let the calling code handle retries.\n if (ReadableStream && init?.body instanceof ReadableStream) {\n return initialRes\n }\n\n // Make sure the initial request is cancelled to avoid leaking resources\n // (NodeJS 👀): https://undici.nodejs.org/#/?id=garbage-collection\n if (!initialRes.bodyUsed) {\n await initialRes.body?.cancel()\n }\n\n // Finally, retry the request with the new access token\n headers.set('authorization', `Bearer ${newSessionData.accessJwt}`)\n return fetch(fetchUrl(newSessionData, path), { ...init, headers })\n }\n\n /**\n * Refreshes the session by obtaining new access and refresh tokens.\n *\n * This method is automatically called by {@link fetchHandler} when the access\n * token expires. You can also call it manually to proactively refresh tokens.\n *\n * On success, the {@link PasswordSessionOptions.onUpdated} callback is invoked\n * with the new session data. On expected failures (invalid session), the\n * {@link PasswordSessionOptions.onDeleted} callback is invoked. On unexpected\n * failures (network issues), the {@link PasswordSessionOptions.onUpdateFailure}\n * callback is invoked and the existing session data is preserved.\n *\n * @returns The refreshed session data\n * @throws {RefreshFailure} If the session is no longer valid (triggers onDeleted)\n */\n async refresh(): Promise<SessionData> {\n this.#sessionPromise = this.#sessionPromise.then(async (sessionData) => {\n const response = await xrpcSafe(\n this.#serviceAgent,\n com.atproto.server.refreshSession.main,\n { headers: { Authorization: `Bearer ${sessionData.refreshJwt}` } },\n )\n\n if (!response.success && response.matchesSchema()) {\n // Expected errors that indicate the session is no longer valid\n await this.options.onDeleted?.call(this, sessionData)\n\n // Update the session promise to a rejected state\n this.#sessionData = null\n throw response\n }\n\n if (!response.success) {\n response.error\n if (response.matchesSchema()) {\n response.error\n }\n // We failed to refresh the token, assume the session might still be\n // valid by returning the existing session.\n await this.options.onUpdateFailure?.call(this, sessionData, response)\n\n return sessionData\n }\n\n const data = response.body\n\n // Historically, refreshSession did not return all the fields from\n // getSession. In particular, emailConfirmed and didDoc were missing.\n // Similarly, some servers might not return the didDoc in refreshSession.\n // We fetch them via getSession if missing, allowing to ensure that we are\n // always talking with the right PDS.\n if (data.emailConfirmed == null || data.didDoc == null) {\n const extraData = await xrpcSafe(\n this.#serviceAgent,\n com.atproto.server.getSession.main,\n { headers: { Authorization: `Bearer ${data.accessJwt}` } },\n )\n if (extraData.success && extraData.body.did === data.did) {\n Object.assign(data, extraData.body)\n }\n }\n\n const newSession: SessionData = {\n ...data,\n service: sessionData.service,\n }\n\n await this.options.onUpdated?.call(this, newSession)\n\n return (this.#sessionData = newSession)\n })\n\n return this.#sessionPromise\n }\n\n /**\n * Logs out by deleting the session on the server.\n *\n * This method invalidates both the access and refresh tokens on the server,\n * preventing any further use of this session. After successful logout, the\n * session is marked as destroyed and the {@link PasswordSessionOptions.onDeleted}\n * callback is invoked.\n *\n * If the logout request fails due to network issues or server unavailability,\n * the {@link PasswordSessionOptions.onDeleteFailure} callback is invoked and\n * the session remains active locally. In this case, you should retry the\n * logout later to ensure the session is properly invalidated on the server.\n *\n * @throws {DeleteFailure} If the logout request fails due to unexpected errors\n */\n async logout(): Promise<void> {\n let reason: DeleteFailure | null = null\n\n this.#sessionPromise = this.#sessionPromise.then(async (sessionData) => {\n const result = await xrpcSafe(\n this.#serviceAgent,\n com.atproto.server.deleteSession.main,\n { headers: { Authorization: `Bearer ${sessionData.refreshJwt}` } },\n )\n\n if (result.success || result.matchesSchema()) {\n await this.options.onDeleted?.call(this, sessionData)\n\n // Update the session promise to a rejected state\n this.#sessionData = null\n throw new Error('Logged out')\n } else {\n // Capture the reason for the failure to re-throw in the outer promise\n reason = result\n\n // An unknown/unexpected error occurred (network, server down, etc)\n await this.options.onDeleteFailure?.call(this, sessionData, result)\n\n // Keep the session in an active state\n return sessionData\n }\n })\n\n return this.#sessionPromise.then(\n (_session) => {\n // If the promise above resolved, then logout failed. Re-throw the\n // reason captured earlier.\n throw reason!\n },\n (_err) => {\n // Successful logout\n },\n )\n }\n\n /**\n * Creates a new account and returns an authenticated session.\n *\n * This static method registers a new account on the specified service and\n * automatically creates an authenticated session for it.\n *\n * @param body - Account creation parameters (handle, email, password, etc.)\n * @param options - Session options including the service URL\n * @returns A new PasswordSession for the created account\n * @throws If account creation fails (e.g., handle taken, invalid invite code)\n *\n * @example\n * ```ts\n * const session = await PasswordSession.createAccount(\n * {\n * handle: 'alice.bsky.social',\n * email: 'alice@example.com',\n * password: 'secure-password',\n * },\n * {\n * service: 'https://bsky.social',\n * onUpdated: (data) => saveToStorage(data),\n * }\n * )\n * ```\n */\n static async createAccount(\n body: com.atproto.server.createAccount.InputBody,\n {\n service,\n headers,\n ...options\n }: PasswordSessionOptions & {\n headers?: HeadersInit\n service: string | URL\n },\n ): Promise<PasswordSession> {\n const response = await xrpc(\n buildAgent({ service, headers, fetch: options.fetch }),\n com.atproto.server.createAccount.main,\n { body },\n )\n\n const data: SessionData = {\n ...response.body,\n service: String(service),\n }\n\n const agent = new PasswordSession(data, options)\n await options.onUpdated?.call(agent, data)\n return agent\n }\n\n /**\n * Creates a new authenticated session using password credentials.\n *\n * This static method authenticates with the specified service and returns\n * a new PasswordSession instance that can be used for authenticated requests.\n *\n * **Security Warning:** It is strongly recommended to use app passwords instead\n * of main account credentials. App passwords can be created in your account\n * settings and provide limited access that can be revoked independently. For\n * browser-based applications, use OAuth-based authentication instead.\n *\n * @param options - Login options including service URL, identifier, and password\n * @param options.service - The AT Protocol service URL (e.g., 'https://bsky.social')\n * @param options.identifier - The user's handle or DID\n * @param options.password - The user's password or app password\n * @param options.allowTakendown - If true, allow login to takendown accounts\n * @param options.authFactorToken - 2FA token if required by the server\n * @returns A new authenticated PasswordSession\n * @throws {LexAuthFactorError} If the server requires a 2FA token\n * @throws If authentication fails (invalid credentials, etc.)\n *\n * @example Basic login with app password\n * ```ts\n * const session = await PasswordSession.login({\n * service: 'https://bsky.social',\n * identifier: 'alice.bsky.social',\n * password: 'xxxx-xxxx-xxxx-xxxx', // App password\n * onUpdated: (data) => saveToStorage(data),\n * })\n * ```\n *\n * @example Handling 2FA requirement\n * ```ts\n * try {\n * const session = await PasswordSession.login({\n * service: 'https://bsky.social',\n * identifier: 'alice.bsky.social',\n * password: 'xxxx-xxxx-xxxx-xxxx',\n * })\n * } catch (err) {\n * if (err instanceof LexAuthFactorError) {\n * const token = await promptUser('Enter 2FA code:')\n * const session = await PasswordSession.login({\n * service: 'https://bsky.social',\n * identifier: 'alice.bsky.social',\n * password: 'xxxx-xxxx-xxxx-xxxx',\n * authFactorToken: token,\n * })\n * }\n * }\n * ```\n */\n static async login({\n service,\n identifier,\n password,\n allowTakendown,\n authFactorToken,\n ...options\n }: PasswordSessionOptions & {\n service: string | URL\n identifier: string\n password: string\n allowTakendown?: boolean\n authFactorToken?: string\n }): Promise<PasswordSession> {\n const xrpcAgent = buildAgent({\n service,\n fetch: options.fetch,\n })\n\n const response = await xrpcSafe(\n xrpcAgent,\n com.atproto.server.createSession.main,\n { body: { identifier, password, allowTakendown, authFactorToken } },\n )\n\n if (!response.success) {\n if (response.error === 'AuthFactorTokenRequired') {\n throw new LexAuthFactorError(response)\n }\n throw response.reason\n }\n\n const data: SessionData = {\n ...response.body,\n service: String(service),\n }\n\n const agent = new PasswordSession(data, options)\n await options.onUpdated?.call(agent, data)\n return agent\n }\n\n /**\n * Resume an existing session, ensuring it is still valid by refreshing it.\n * Any error thrown here indicates that the session is definitely no longer\n * valid. Network errors will be propagated through the\n * {@link PasswordSessionOptions.onUpdateFailure} hook, and not re-thrown\n * here. This means that a resolved promise does not necessarily indicate a\n * valid session, only that it's refresh did not definitively fail.\n *\n * This is the same as calling {@link PasswordSession.refresh} after\n * constructing the {@link PasswordSession} manually.\n *\n * @throws If, and only if, the session is definitely no longer valid.\n */\n static async resume(\n data: SessionData,\n options: PasswordSessionOptions,\n ): Promise<PasswordSession> {\n const agent = new PasswordSession(data, options)\n await agent.refresh()\n return agent\n }\n\n /**\n * Delete a session without having to {@link resume resume()} it first, or\n * provide hooks.\n *\n * @throws In case of unexpected error (network issue, server down, etc)\n * meaning that the session may still be valid.\n */\n static async delete(\n data: SessionData,\n options?: PasswordSessionOptions,\n ): Promise<void> {\n const agent = new PasswordSession(data, options)\n await agent.logout()\n }\n}\n\nfunction fetchUrl(sessionData: SessionData, path: string): URL {\n const pdsUrl = extractPdsUrl(sessionData.didDoc)\n return new URL(path, pdsUrl ?? sessionData.service)\n}\n"]}
|
|
1
|
+
{"version":3,"file":"password-session.js","sourceRoot":"","sources":["../src/password-session.ts"],"names":[],"mappings":";;;AAAA,oDAM4B;AAC5B,yCAA+C;AAC/C,kDAAyC;AACzC,uCAA+D;AAkG/D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,MAAa,eAAe;IAYL;IAXrB;;;OAGG;IACH,aAAa,CAAO;IAEpB,YAAY,CAAoB;IAChC,eAAe,CAAsB;IAErC,YACE,WAAwB,EACL,UAAkC,EAAE;QAApC,YAAO,GAAP,OAAO,CAA6B;QAEvD,IAAI,CAAC,aAAa,GAAG,IAAA,uBAAU,EAAC;YAC9B,OAAO,EAAE,WAAW,CAAC,OAAO;YAC5B,KAAK,EAAE,OAAO,CAAC,KAAK;SACrB,CAAC,CAAA;QAEF,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;IAED;;;;;;;;;;;;OAYG;IACH,MAAM,CAAC,KAAK,CAAC,MAAM,CACjB,IAAiB,EACjB,OAA+B;QAE/B,MAAM,KAAK,GAAG,IAAI,eAAe,CAAC,IAAI,EAAE,OAAO,CAAC,CAAA;QAChD,MAAM,KAAK,CAAC,OAAO,EAAE,CAAA;QACrB,OAAO,KAAK,CAAA;IACd,CAAC;IAED;;;;;;OAMG;IACH,MAAM,CAAC,KAAK,CAAC,MAAM,CACjB,IAAiB,EACjB,OAAgC;QAEhC,MAAM,KAAK,GAAG,IAAI,eAAe,CAAC,IAAI,EAAE,OAAO,CAAC,CAAA;QAChD,MAAM,KAAK,CAAC,MAAM,EAAE,CAAA;IACtB,CAAC;CACF;AAvcD,0CAucC;AAED,SAAS,QAAQ,CAAC,WAAwB,EAAE,IAAY;IACtD,MAAM,MAAM,GAAG,IAAA,uBAAa,EAAC,WAAW,CAAC,MAAM,CAAC,CAAA;IAChD,OAAO,IAAI,GAAG,CAAC,IAAI,EAAE,MAAM,IAAI,WAAW,CAAC,OAAO,CAAC,CAAA;AACrD,CAAC","sourcesContent":["import {\n Agent,\n XrpcFailure,\n buildAgent,\n xrpc,\n xrpcSafe,\n} from '@atproto/lex-client'\nimport { LexAuthFactorError } from './error.js'\nimport { com } from './lexicons/index.js'\nimport { extractPdsUrl, extractXrpcErrorCode } from './util.js'\n\n/**\n * Represents a failure response when refreshing a session.\n *\n * This type captures the possible error responses from\n * `com.atproto.server.refreshSession`, including both expected errors\n * (e.g., invalid/expired refresh token) and unexpected errors (e.g., network issues).\n */\nexport type RefreshFailure = XrpcFailure<\n typeof com.atproto.server.refreshSession.main\n>\n\n/**\n * Represents a failure response when deleting a session.\n *\n * This type captures the possible error responses from\n * `com.atproto.server.deleteSession`, including both expected errors\n * and unexpected errors (e.g., network issues, server unavailability).\n */\nexport type DeleteFailure = XrpcFailure<\n typeof com.atproto.server.deleteSession.main\n>\n\n/**\n * Persisted session data containing authentication credentials and service information.\n *\n * This type extends the response from `com.atproto.server.createSession` with the\n * service URL used for authentication. Store this data securely to resume sessions\n * later without re-authenticating.\n */\nexport type SessionData = com.atproto.server.createSession.$OutputBody & {\n service: string\n}\n\nexport type PasswordSessionOptions = {\n /**\n * Custom fetch implementation to use for network requests\n */\n fetch?: typeof globalThis.fetch\n\n /**\n * Called whenever the session is successfully created/refreshed, and new\n * credentials have been obtained. Use this hook to persist the updated\n * session information.\n *\n * If this callback returns a promise, this function will never be called\n * again (on the same process) until the promise resolves.\n *\n * @note this function **must** not throw\n */\n onUpdated?: (this: PasswordSession, data: SessionData) => void | Promise<void>\n\n /**\n * Called whenever the session update fails due to an expected error, such as\n * a network issue or server unavailability. This function can be used to log\n * the error or notify the user, but should not assume that the session is\n * invalid.\n *\n * @note this function **must** not throw\n */\n onUpdateFailure?: (\n this: PasswordSession,\n data: SessionData,\n err: RefreshFailure,\n ) => void | Promise<void>\n\n /**\n * Called whenever the session is deleted, either due to an explicit logout or\n * because the refresh operation indicated that the session is no longer\n * valid. Use this hook to clean up any persisted session information and\n * update the application state accordingly.\n *\n * @note this function **must** not throw\n */\n onDeleted?: (this: PasswordSession, data: SessionData) => void | Promise<void>\n\n /**\n * Called whenever a session deletion fails due to an unexpected error, such\n * as a network issue or server unavailability. This function can be used to\n * log the error or notify the user. When this function is called, the session\n * might still be valid on the server. It is up to the implementation to\n * decide whether to retry the deletion or keep the session active. Ignoring\n * these errors is not recommended as it can lead to orphaned sessions on the\n * server, or security issues if the user believes they have logged out when a\n * bad actor is still using the session. The implementation should consider\n * keeping track of failed deletions and retrying them later, until they\n * succeed.\n *\n * @note this function **must** not throw\n */\n onDeleteFailure?: (\n this: PasswordSession,\n data: SessionData,\n err: DeleteFailure,\n ) => void | Promise<void>\n}\n\n/**\n * Password-based authentication session for AT Protocol services.\n *\n * This class provides session management for CLI tools, scripts, and bots that\n * need to authenticate with AT Protocol services using password credentials.\n * It implements the {@link Agent} interface, allowing it to be used directly\n * with AT Protocol clients.\n *\n * **Security Warning:** It is strongly recommended to use app passwords instead\n * of main account credentials. App passwords provide limited access and can be\n * revoked independently without compromising your main account. For browser-based\n * applications, use OAuth-based authentication instead.\n *\n * @example Basic usage with app password\n * ```ts\n * const session = await PasswordSession.login({\n * service: 'https://bsky.social',\n * identifier: 'alice.bsky.social',\n * password: 'xxxx-xxxx-xxxx-xxxx', // App password\n * onUpdated: (data) => saveToStorage(data),\n * onDeleted: (data) => clearStorage(data.did),\n * })\n *\n * const client = new Client(session)\n * // Use client to make authenticated requests\n * ```\n *\n * @example Resuming a persisted session\n * ```ts\n * const savedData = JSON.parse(fs.readFileSync('session.json', 'utf8'))\n * const session = await PasswordSession.resume(savedData, {\n * onUpdated: (data) => saveToStorage(data),\n * onDeleted: (data) => clearStorage(data.did),\n * })\n * ```\n *\n * @implements {Agent}\n */\nexport class PasswordSession implements Agent {\n /**\n * Internal {@link Agent} used for session management towards the\n * authentication service only.\n */\n #serviceAgent: Agent\n\n #sessionData: null | SessionData\n #sessionPromise: Promise<SessionData>\n\n constructor(\n sessionData: SessionData,\n protected readonly options: PasswordSessionOptions = {},\n ) {\n this.#serviceAgent = buildAgent({\n service: sessionData.service,\n fetch: options.fetch,\n })\n\n this.#sessionData = sessionData\n this.#sessionPromise = Promise.resolve(this.#sessionData)\n }\n\n /**\n * The DID (Decentralized Identifier) of the authenticated account.\n *\n * @throws {Error} If the session has been destroyed (logged out).\n */\n get did() {\n return this.session.did\n }\n\n /**\n * The handle (username) of the authenticated account.\n *\n * @throws {Error} If the session has been destroyed (logged out).\n */\n get handle() {\n return this.session.handle\n }\n\n /**\n * The current session data containing authentication credentials.\n *\n * @throws {Error} If the session has been destroyed (logged out).\n */\n get session() {\n if (this.#sessionData) return this.#sessionData\n throw new Error('Logged out')\n }\n\n /**\n * Whether this session has been destroyed (logged out).\n *\n * Once destroyed, this session instance can no longer be used for\n * authenticated requests. Create a new session via {@link PasswordSession.login}\n * or {@link PasswordSession.resume}.\n */\n get destroyed(): boolean {\n return this.#sessionData === null\n }\n\n /**\n * Handles authenticated fetch requests to the user's PDS.\n *\n * This method implements the {@link Agent} interface and is called by\n * AT Protocol clients to make authenticated requests. It automatically:\n * - Adds the access token to request headers\n * - Detects expired tokens and triggers refresh\n * - Retries requests after successful token refresh\n *\n * @param path - The request path (will be resolved against the PDS URL)\n * @param init - Standard fetch RequestInit options (headers, body, etc.)\n * @returns The fetch Response from the PDS\n * @throws {TypeError} If an 'authorization' header is already set in init\n */\n async fetchHandler(path: string, init: RequestInit): Promise<Response> {\n const headers = new Headers(init.headers)\n if (headers.has('authorization')) {\n throw new TypeError(\"Unexpected 'authorization' header set\")\n }\n\n const sessionPromise = this.#sessionPromise\n const sessionData = await sessionPromise\n\n const fetch = this.options.fetch ?? globalThis.fetch\n\n headers.set('authorization', `Bearer ${sessionData.accessJwt}`)\n const initialRes = await fetch(fetchUrl(sessionData, path), {\n ...init,\n headers,\n })\n\n const refreshNeeded =\n initialRes.status === 401 ||\n (initialRes.status === 400 &&\n (await extractXrpcErrorCode(initialRes)) === 'ExpiredToken')\n\n if (!refreshNeeded) {\n return initialRes\n }\n\n // Refresh session (unless it was already refreshed in the meantime)\n const newSessionPromise =\n this.#sessionPromise === sessionPromise\n ? this.refresh()\n : this.#sessionPromise\n\n // Error should have been propagated through hooks\n const newSessionData = await newSessionPromise.catch((_err) => null)\n if (!newSessionData) {\n return initialRes\n }\n\n // refresh silently failed, no point in retrying.\n if (newSessionData.accessJwt === sessionData.accessJwt) {\n return initialRes\n }\n\n if (init?.signal?.aborted) {\n return initialRes\n }\n\n // The stream was already consumed. We cannot retry the request. A solution\n // would be to tee() the input stream but that would bufferize the entire\n // stream in memory which can lead to memory starvation. Instead, we will\n // return the original response and let the calling code handle retries.\n if (ReadableStream && init?.body instanceof ReadableStream) {\n return initialRes\n }\n\n // Make sure the initial request is cancelled to avoid leaking resources\n // (NodeJS 👀): https://undici.nodejs.org/#/?id=garbage-collection\n if (!initialRes.bodyUsed) {\n await initialRes.body?.cancel()\n }\n\n // Finally, retry the request with the new access token\n headers.set('authorization', `Bearer ${newSessionData.accessJwt}`)\n return fetch(fetchUrl(newSessionData, path), { ...init, headers })\n }\n\n /**\n * Refreshes the session by obtaining new access and refresh tokens.\n *\n * This method is automatically called by {@link fetchHandler} when the access\n * token expires. You can also call it manually to proactively refresh tokens.\n *\n * On success, the {@link PasswordSessionOptions.onUpdated} callback is invoked\n * with the new session data. On expected failures (invalid session), the\n * {@link PasswordSessionOptions.onDeleted} callback is invoked. On unexpected\n * failures (network issues), the {@link PasswordSessionOptions.onUpdateFailure}\n * callback is invoked and the existing session data is preserved.\n *\n * @returns The refreshed session data\n * @throws {RefreshFailure} If the session is no longer valid (triggers onDeleted)\n */\n async refresh(): Promise<SessionData> {\n this.#sessionPromise = this.#sessionPromise.then(async (sessionData) => {\n const response = await xrpcSafe(\n this.#serviceAgent,\n com.atproto.server.refreshSession.main,\n { headers: { Authorization: `Bearer ${sessionData.refreshJwt}` } },\n )\n\n if (!response.success && response.matchesSchema()) {\n // Expected errors that indicate the session is no longer valid\n await this.options.onDeleted?.call(this, sessionData)\n\n // Update the session promise to a rejected state\n this.#sessionData = null\n throw response\n }\n\n if (!response.success) {\n response.error\n if (response.matchesSchema()) {\n response.error\n }\n // We failed to refresh the token, assume the session might still be\n // valid by returning the existing session.\n await this.options.onUpdateFailure?.call(this, sessionData, response)\n\n return sessionData\n }\n\n const data = response.body\n\n // Historically, refreshSession did not return all the fields from\n // getSession. In particular, emailConfirmed and didDoc were missing.\n // Similarly, some servers might not return the didDoc in refreshSession.\n // We fetch them via getSession if missing, allowing to ensure that we are\n // always talking with the right PDS.\n if (data.emailConfirmed == null || data.didDoc == null) {\n const extraData = await xrpcSafe(\n this.#serviceAgent,\n com.atproto.server.getSession.main,\n { headers: { Authorization: `Bearer ${data.accessJwt}` } },\n )\n if (extraData.success && extraData.body.did === data.did) {\n Object.assign(data, extraData.body)\n }\n }\n\n const newSession: SessionData = {\n ...data,\n service: sessionData.service,\n }\n\n await this.options.onUpdated?.call(this, newSession)\n\n return (this.#sessionData = newSession)\n })\n\n return this.#sessionPromise\n }\n\n /**\n * Logs out by deleting the session on the server.\n *\n * This method invalidates both the access and refresh tokens on the server,\n * preventing any further use of this session. After successful logout, the\n * session is marked as destroyed and the {@link PasswordSessionOptions.onDeleted}\n * callback is invoked.\n *\n * If the logout request fails due to network issues or server unavailability,\n * the {@link PasswordSessionOptions.onDeleteFailure} callback is invoked and\n * the session remains active locally. In this case, you should retry the\n * logout later to ensure the session is properly invalidated on the server.\n *\n * @throws {DeleteFailure} If the logout request fails due to unexpected errors\n */\n async logout(): Promise<void> {\n let reason: DeleteFailure | null = null\n\n this.#sessionPromise = this.#sessionPromise.then(async (sessionData) => {\n const result = await xrpcSafe(\n this.#serviceAgent,\n com.atproto.server.deleteSession.main,\n { headers: { Authorization: `Bearer ${sessionData.refreshJwt}` } },\n )\n\n if (result.success || result.matchesSchema()) {\n await this.options.onDeleted?.call(this, sessionData)\n\n // Update the session promise to a rejected state\n this.#sessionData = null\n throw new Error('Logged out')\n } else {\n // Capture the reason for the failure to re-throw in the outer promise\n reason = result\n\n // An unknown/unexpected error occurred (network, server down, etc)\n await this.options.onDeleteFailure?.call(this, sessionData, result)\n\n // Keep the session in an active state\n return sessionData\n }\n })\n\n return this.#sessionPromise.then(\n (_session) => {\n // If the promise above resolved, then logout failed. Re-throw the\n // reason captured earlier.\n throw reason!\n },\n (_err) => {\n // Successful logout\n },\n )\n }\n\n /**\n * Creates a new account and returns an authenticated session.\n *\n * This static method registers a new account on the specified service and\n * automatically creates an authenticated session for it.\n *\n * @param body - Account creation parameters (handle, email, password, etc.)\n * @param options - Session options including the service URL\n * @returns A new PasswordSession for the created account\n * @throws If account creation fails (e.g., handle taken, invalid invite code)\n *\n * @example\n * ```ts\n * const session = await PasswordSession.createAccount(\n * {\n * handle: 'alice.bsky.social',\n * email: 'alice@example.com',\n * password: 'secure-password',\n * },\n * {\n * service: 'https://bsky.social',\n * onUpdated: (data) => saveToStorage(data),\n * }\n * )\n * ```\n */\n static async createAccount(\n body: com.atproto.server.createAccount.$InputBody,\n {\n service,\n headers,\n ...options\n }: PasswordSessionOptions & {\n headers?: HeadersInit\n service: string | URL\n },\n ): Promise<PasswordSession> {\n const response = await xrpc(\n buildAgent({ service, headers, fetch: options.fetch }),\n com.atproto.server.createAccount.main,\n { body },\n )\n\n const data: SessionData = {\n ...response.body,\n service: String(service),\n }\n\n const agent = new PasswordSession(data, options)\n await options.onUpdated?.call(agent, data)\n return agent\n }\n\n /**\n * Creates a new authenticated session using password credentials.\n *\n * This static method authenticates with the specified service and returns\n * a new PasswordSession instance that can be used for authenticated requests.\n *\n * **Security Warning:** It is strongly recommended to use app passwords instead\n * of main account credentials. App passwords can be created in your account\n * settings and provide limited access that can be revoked independently. For\n * browser-based applications, use OAuth-based authentication instead.\n *\n * @param options - Login options including service URL, identifier, and password\n * @param options.service - The AT Protocol service URL (e.g., 'https://bsky.social')\n * @param options.identifier - The user's handle or DID\n * @param options.password - The user's password or app password\n * @param options.allowTakendown - If true, allow login to takendown accounts\n * @param options.authFactorToken - 2FA token if required by the server\n * @returns A new authenticated PasswordSession\n * @throws {LexAuthFactorError} If the server requires a 2FA token\n * @throws If authentication fails (invalid credentials, etc.)\n *\n * @example Basic login with app password\n * ```ts\n * const session = await PasswordSession.login({\n * service: 'https://bsky.social',\n * identifier: 'alice.bsky.social',\n * password: 'xxxx-xxxx-xxxx-xxxx', // App password\n * onUpdated: (data) => saveToStorage(data),\n * })\n * ```\n *\n * @example Handling 2FA requirement\n * ```ts\n * try {\n * const session = await PasswordSession.login({\n * service: 'https://bsky.social',\n * identifier: 'alice.bsky.social',\n * password: 'xxxx-xxxx-xxxx-xxxx',\n * })\n * } catch (err) {\n * if (err instanceof LexAuthFactorError) {\n * const token = await promptUser('Enter 2FA code:')\n * const session = await PasswordSession.login({\n * service: 'https://bsky.social',\n * identifier: 'alice.bsky.social',\n * password: 'xxxx-xxxx-xxxx-xxxx',\n * authFactorToken: token,\n * })\n * }\n * }\n * ```\n */\n static async login({\n service,\n identifier,\n password,\n allowTakendown,\n authFactorToken,\n ...options\n }: PasswordSessionOptions & {\n service: string | URL\n identifier: string\n password: string\n allowTakendown?: boolean\n authFactorToken?: string\n }): Promise<PasswordSession> {\n const xrpcAgent = buildAgent({\n service,\n fetch: options.fetch,\n })\n\n const response = await xrpcSafe(\n xrpcAgent,\n com.atproto.server.createSession.main,\n { body: { identifier, password, allowTakendown, authFactorToken } },\n )\n\n if (!response.success) {\n if (response.error === 'AuthFactorTokenRequired') {\n throw new LexAuthFactorError(response)\n }\n throw response.reason\n }\n\n const data: SessionData = {\n ...response.body,\n service: String(service),\n }\n\n const agent = new PasswordSession(data, options)\n await options.onUpdated?.call(agent, data)\n return agent\n }\n\n /**\n * Resume an existing session, ensuring it is still valid by refreshing it.\n * Any error thrown here indicates that the session is definitely no longer\n * valid. Network errors will be propagated through the\n * {@link PasswordSessionOptions.onUpdateFailure} hook, and not re-thrown\n * here. This means that a resolved promise does not necessarily indicate a\n * valid session, only that it's refresh did not definitively fail.\n *\n * This is the same as calling {@link PasswordSession.refresh} after\n * constructing the {@link PasswordSession} manually.\n *\n * @throws If, and only if, the session is definitely no longer valid.\n */\n static async resume(\n data: SessionData,\n options: PasswordSessionOptions,\n ): Promise<PasswordSession> {\n const agent = new PasswordSession(data, options)\n await agent.refresh()\n return agent\n }\n\n /**\n * Delete a session without having to {@link resume resume()} it first, or\n * provide hooks.\n *\n * @throws In case of unexpected error (network issue, server down, etc)\n * meaning that the session may still be valid.\n */\n static async delete(\n data: SessionData,\n options?: PasswordSessionOptions,\n ): Promise<void> {\n const agent = new PasswordSession(data, options)\n await agent.logout()\n }\n}\n\nfunction fetchUrl(sessionData: SessionData, path: string): URL {\n const pdsUrl = extractPdsUrl(sessionData.didDoc)\n return new URL(path, pdsUrl ?? sessionData.service)\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atproto/lex-password-session",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Password based client authentication for AT Lexicons",
|
|
6
6
|
"keywords": [
|
|
@@ -36,13 +36,13 @@
|
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"tslib": "^2.8.1",
|
|
39
|
-
"@atproto/lex-
|
|
40
|
-
"@atproto/lex-
|
|
39
|
+
"@atproto/lex-schema": "^0.0.13",
|
|
40
|
+
"@atproto/lex-client": "^0.0.13"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"vitest": "^4.0.16",
|
|
44
|
-
"@atproto/lex-builder": "^0.0.
|
|
45
|
-
"@atproto/lex-server": "^0.0.
|
|
44
|
+
"@atproto/lex-builder": "^0.0.16",
|
|
45
|
+
"@atproto/lex-server": "^0.0.10"
|
|
46
46
|
},
|
|
47
47
|
"scripts": {
|
|
48
48
|
"prebuild": "node ./scripts/lex-build.mjs",
|
|
@@ -23,14 +23,14 @@ const main =
|
|
|
23
23
|
verificationPhone: /*#__PURE__*/ l.optional(/*#__PURE__*/ l.string()),
|
|
24
24
|
password: /*#__PURE__*/ l.optional(/*#__PURE__*/ l.string()),
|
|
25
25
|
recoveryKey: /*#__PURE__*/ l.optional(/*#__PURE__*/ l.string()),
|
|
26
|
-
plcOp: /*#__PURE__*/ l.optional(/*#__PURE__*/ l.
|
|
26
|
+
plcOp: /*#__PURE__*/ l.optional(/*#__PURE__*/ l.lexMap()),
|
|
27
27
|
}),
|
|
28
28
|
/*#__PURE__*/ l.jsonPayload({
|
|
29
29
|
accessJwt: /*#__PURE__*/ l.string(),
|
|
30
30
|
refreshJwt: /*#__PURE__*/ l.string(),
|
|
31
31
|
handle: /*#__PURE__*/ l.string({ format: 'handle' }),
|
|
32
32
|
did: /*#__PURE__*/ l.string({ format: 'did' }),
|
|
33
|
-
didDoc: /*#__PURE__*/ l.optional(/*#__PURE__*/ l.
|
|
33
|
+
didDoc: /*#__PURE__*/ l.optional(/*#__PURE__*/ l.lexMap()),
|
|
34
34
|
}),
|
|
35
35
|
[
|
|
36
36
|
'InvalidHandle',
|
|
@@ -44,11 +44,17 @@ const main =
|
|
|
44
44
|
)
|
|
45
45
|
export { main }
|
|
46
46
|
|
|
47
|
-
export type Params = l.InferMethodParams<typeof main>
|
|
48
|
-
export type Input = l.InferMethodInput<typeof main>
|
|
49
|
-
export type InputBody = l.InferMethodInputBody<
|
|
50
|
-
|
|
51
|
-
|
|
47
|
+
export type $Params = l.InferMethodParams<typeof main>
|
|
48
|
+
export type $Input<B = l.BinaryData> = l.InferMethodInput<typeof main, B>
|
|
49
|
+
export type $InputBody<B = l.BinaryData> = l.InferMethodInputBody<
|
|
50
|
+
typeof main,
|
|
51
|
+
B
|
|
52
|
+
>
|
|
53
|
+
export type $Output<B = l.BinaryData> = l.InferMethodOutput<typeof main, B>
|
|
54
|
+
export type $OutputBody<B = l.BinaryData> = l.InferMethodOutputBody<
|
|
55
|
+
typeof main,
|
|
56
|
+
B
|
|
57
|
+
>
|
|
52
58
|
|
|
53
59
|
export const $lxm = /*#__PURE__*/ main.nsid,
|
|
54
60
|
$params = /*#__PURE__*/ main.parameters,
|
|
@@ -25,22 +25,32 @@ const main =
|
|
|
25
25
|
refreshJwt: /*#__PURE__*/ l.string(),
|
|
26
26
|
handle: /*#__PURE__*/ l.string({ format: 'handle' }),
|
|
27
27
|
did: /*#__PURE__*/ l.string({ format: 'did' }),
|
|
28
|
-
didDoc: /*#__PURE__*/ l.optional(/*#__PURE__*/ l.
|
|
28
|
+
didDoc: /*#__PURE__*/ l.optional(/*#__PURE__*/ l.lexMap()),
|
|
29
29
|
email: /*#__PURE__*/ l.optional(/*#__PURE__*/ l.string()),
|
|
30
30
|
emailConfirmed: /*#__PURE__*/ l.optional(/*#__PURE__*/ l.boolean()),
|
|
31
31
|
emailAuthFactor: /*#__PURE__*/ l.optional(/*#__PURE__*/ l.boolean()),
|
|
32
32
|
active: /*#__PURE__*/ l.optional(/*#__PURE__*/ l.boolean()),
|
|
33
|
-
status: /*#__PURE__*/ l.optional(
|
|
33
|
+
status: /*#__PURE__*/ l.optional(
|
|
34
|
+
/*#__PURE__*/ l.string<{
|
|
35
|
+
knownValues: ['takendown', 'suspended', 'deactivated']
|
|
36
|
+
}>(),
|
|
37
|
+
),
|
|
34
38
|
}),
|
|
35
39
|
['AccountTakedown', 'AuthFactorTokenRequired'],
|
|
36
40
|
)
|
|
37
41
|
export { main }
|
|
38
42
|
|
|
39
|
-
export type Params = l.InferMethodParams<typeof main>
|
|
40
|
-
export type Input = l.InferMethodInput<typeof main>
|
|
41
|
-
export type InputBody = l.InferMethodInputBody<
|
|
42
|
-
|
|
43
|
-
|
|
43
|
+
export type $Params = l.InferMethodParams<typeof main>
|
|
44
|
+
export type $Input<B = l.BinaryData> = l.InferMethodInput<typeof main, B>
|
|
45
|
+
export type $InputBody<B = l.BinaryData> = l.InferMethodInputBody<
|
|
46
|
+
typeof main,
|
|
47
|
+
B
|
|
48
|
+
>
|
|
49
|
+
export type $Output<B = l.BinaryData> = l.InferMethodOutput<typeof main, B>
|
|
50
|
+
export type $OutputBody<B = l.BinaryData> = l.InferMethodOutputBody<
|
|
51
|
+
typeof main,
|
|
52
|
+
B
|
|
53
|
+
>
|
|
44
54
|
|
|
45
55
|
export const $lxm = /*#__PURE__*/ main.nsid,
|
|
46
56
|
$params = /*#__PURE__*/ main.parameters,
|
|
@@ -20,11 +20,17 @@ const main =
|
|
|
20
20
|
)
|
|
21
21
|
export { main }
|
|
22
22
|
|
|
23
|
-
export type Params = l.InferMethodParams<typeof main>
|
|
24
|
-
export type Input = l.InferMethodInput<typeof main>
|
|
25
|
-
export type InputBody = l.InferMethodInputBody<
|
|
26
|
-
|
|
27
|
-
|
|
23
|
+
export type $Params = l.InferMethodParams<typeof main>
|
|
24
|
+
export type $Input<B = l.BinaryData> = l.InferMethodInput<typeof main, B>
|
|
25
|
+
export type $InputBody<B = l.BinaryData> = l.InferMethodInputBody<
|
|
26
|
+
typeof main,
|
|
27
|
+
B
|
|
28
|
+
>
|
|
29
|
+
export type $Output<B = l.BinaryData> = l.InferMethodOutput<typeof main, B>
|
|
30
|
+
export type $OutputBody<B = l.BinaryData> = l.InferMethodOutputBody<
|
|
31
|
+
typeof main,
|
|
32
|
+
B
|
|
33
|
+
>
|
|
28
34
|
|
|
29
35
|
export const $lxm = /*#__PURE__*/ main.nsid,
|
|
30
36
|
$params = /*#__PURE__*/ main.parameters,
|
|
@@ -17,19 +17,26 @@ const main =
|
|
|
17
17
|
/*#__PURE__*/ l.jsonPayload({
|
|
18
18
|
handle: /*#__PURE__*/ l.string({ format: 'handle' }),
|
|
19
19
|
did: /*#__PURE__*/ l.string({ format: 'did' }),
|
|
20
|
-
didDoc: /*#__PURE__*/ l.optional(/*#__PURE__*/ l.
|
|
20
|
+
didDoc: /*#__PURE__*/ l.optional(/*#__PURE__*/ l.lexMap()),
|
|
21
21
|
email: /*#__PURE__*/ l.optional(/*#__PURE__*/ l.string()),
|
|
22
22
|
emailConfirmed: /*#__PURE__*/ l.optional(/*#__PURE__*/ l.boolean()),
|
|
23
23
|
emailAuthFactor: /*#__PURE__*/ l.optional(/*#__PURE__*/ l.boolean()),
|
|
24
24
|
active: /*#__PURE__*/ l.optional(/*#__PURE__*/ l.boolean()),
|
|
25
|
-
status: /*#__PURE__*/ l.optional(
|
|
25
|
+
status: /*#__PURE__*/ l.optional(
|
|
26
|
+
/*#__PURE__*/ l.string<{
|
|
27
|
+
knownValues: ['takendown', 'suspended', 'deactivated']
|
|
28
|
+
}>(),
|
|
29
|
+
),
|
|
26
30
|
}),
|
|
27
31
|
)
|
|
28
32
|
export { main }
|
|
29
33
|
|
|
30
|
-
export type Params = l.InferMethodParams<typeof main>
|
|
31
|
-
export type Output = l.InferMethodOutput<typeof main>
|
|
32
|
-
export type OutputBody = l.InferMethodOutputBody<
|
|
34
|
+
export type $Params = l.InferMethodParams<typeof main>
|
|
35
|
+
export type $Output<B = l.BinaryData> = l.InferMethodOutput<typeof main, B>
|
|
36
|
+
export type $OutputBody<B = l.BinaryData> = l.InferMethodOutputBody<
|
|
37
|
+
typeof main,
|
|
38
|
+
B
|
|
39
|
+
>
|
|
33
40
|
|
|
34
41
|
export const $lxm = /*#__PURE__*/ main.nsid,
|
|
35
42
|
$params = main.parameters,
|
|
@@ -20,22 +20,32 @@ const main =
|
|
|
20
20
|
refreshJwt: /*#__PURE__*/ l.string(),
|
|
21
21
|
handle: /*#__PURE__*/ l.string({ format: 'handle' }),
|
|
22
22
|
did: /*#__PURE__*/ l.string({ format: 'did' }),
|
|
23
|
-
didDoc: /*#__PURE__*/ l.optional(/*#__PURE__*/ l.
|
|
23
|
+
didDoc: /*#__PURE__*/ l.optional(/*#__PURE__*/ l.lexMap()),
|
|
24
24
|
email: /*#__PURE__*/ l.optional(/*#__PURE__*/ l.string()),
|
|
25
25
|
emailConfirmed: /*#__PURE__*/ l.optional(/*#__PURE__*/ l.boolean()),
|
|
26
26
|
emailAuthFactor: /*#__PURE__*/ l.optional(/*#__PURE__*/ l.boolean()),
|
|
27
27
|
active: /*#__PURE__*/ l.optional(/*#__PURE__*/ l.boolean()),
|
|
28
|
-
status: /*#__PURE__*/ l.optional(
|
|
28
|
+
status: /*#__PURE__*/ l.optional(
|
|
29
|
+
/*#__PURE__*/ l.string<{
|
|
30
|
+
knownValues: ['takendown', 'suspended', 'deactivated']
|
|
31
|
+
}>(),
|
|
32
|
+
),
|
|
29
33
|
}),
|
|
30
34
|
['AccountTakedown', 'InvalidToken', 'ExpiredToken'],
|
|
31
35
|
)
|
|
32
36
|
export { main }
|
|
33
37
|
|
|
34
|
-
export type Params = l.InferMethodParams<typeof main>
|
|
35
|
-
export type Input = l.InferMethodInput<typeof main>
|
|
36
|
-
export type InputBody = l.InferMethodInputBody<
|
|
37
|
-
|
|
38
|
-
|
|
38
|
+
export type $Params = l.InferMethodParams<typeof main>
|
|
39
|
+
export type $Input<B = l.BinaryData> = l.InferMethodInput<typeof main, B>
|
|
40
|
+
export type $InputBody<B = l.BinaryData> = l.InferMethodInputBody<
|
|
41
|
+
typeof main,
|
|
42
|
+
B
|
|
43
|
+
>
|
|
44
|
+
export type $Output<B = l.BinaryData> = l.InferMethodOutput<typeof main, B>
|
|
45
|
+
export type $OutputBody<B = l.BinaryData> = l.InferMethodOutputBody<
|
|
46
|
+
typeof main,
|
|
47
|
+
B
|
|
48
|
+
>
|
|
39
49
|
|
|
40
50
|
export const $lxm = /*#__PURE__*/ main.nsid,
|
|
41
51
|
$params = /*#__PURE__*/ main.parameters,
|
|
@@ -62,7 +62,7 @@ describe(PasswordSession, () => {
|
|
|
62
62
|
.add(com.atproto.server.createSession, async ({ input }) => {
|
|
63
63
|
const session = await authVerifier.create(input.body)
|
|
64
64
|
|
|
65
|
-
const body: com.atproto.server.createSession
|
|
65
|
+
const body: com.atproto.server.createSession.$OutputBody = {
|
|
66
66
|
accessJwt: session.accessJwt,
|
|
67
67
|
refreshJwt: session.refreshJwt,
|
|
68
68
|
|
|
@@ -86,7 +86,7 @@ describe(PasswordSession, () => {
|
|
|
86
86
|
.add(com.atproto.server.getSession, {
|
|
87
87
|
auth: authVerifier.accessStrategy,
|
|
88
88
|
handler: async ({ credentials: { session } }) => {
|
|
89
|
-
const body: com.atproto.server.getSession
|
|
89
|
+
const body: com.atproto.server.getSession.$OutputBody = {
|
|
90
90
|
did: session.did,
|
|
91
91
|
didDoc: {
|
|
92
92
|
'@context': 'https://w3.org/ns/did/v1',
|
|
@@ -117,7 +117,7 @@ describe(PasswordSession, () => {
|
|
|
117
117
|
|
|
118
118
|
// Note, we omit email and didDoc here to test that they are properly
|
|
119
119
|
// fetched via getSession in the agent
|
|
120
|
-
const body: com.atproto.server.refreshSession
|
|
120
|
+
const body: com.atproto.server.refreshSession.$OutputBody = {
|
|
121
121
|
accessJwt: session.accessJwt,
|
|
122
122
|
refreshJwt: session.refreshJwt,
|
|
123
123
|
|
package/src/password-session.ts
CHANGED
|
@@ -38,7 +38,7 @@ export type DeleteFailure = XrpcFailure<
|
|
|
38
38
|
* service URL used for authentication. Store this data securely to resume sessions
|
|
39
39
|
* later without re-authenticating.
|
|
40
40
|
*/
|
|
41
|
-
export type SessionData = com.atproto.server.createSession
|
|
41
|
+
export type SessionData = com.atproto.server.createSession.$OutputBody & {
|
|
42
42
|
service: string
|
|
43
43
|
}
|
|
44
44
|
|
|
@@ -442,7 +442,7 @@ export class PasswordSession implements Agent {
|
|
|
442
442
|
* ```
|
|
443
443
|
*/
|
|
444
444
|
static async createAccount(
|
|
445
|
-
body: com.atproto.server.createAccount
|
|
445
|
+
body: com.atproto.server.createAccount.$InputBody,
|
|
446
446
|
{
|
|
447
447
|
service,
|
|
448
448
|
headers,
|