-
Notifications
You must be signed in to change notification settings - Fork 572
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add did doc output to getSession for session resumption (#1806)
* add optional did doc output to getSession lexicon * add did doc output to getSession on pds, update client to use it * api test fixes * api changeset * tidy
- Loading branch information
Showing
12 changed files
with
40 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@atproto/api': patch | ||
--- | ||
|
||
respect pds endpoint during session resumption |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
import assert from 'assert' | ||
import { defaultFetchHandler } from '@atproto/xrpc' | ||
import { | ||
AtpAgent, | ||
|
@@ -6,6 +7,7 @@ import { | |
AtpSessionData, | ||
} from '..' | ||
import { TestNetworkNoAppView } from '@atproto/dev-env' | ||
import { getPdsEndpoint, isValidDidDoc } from '@atproto/common-web' | ||
|
||
describe('agent', () => { | ||
let network: TestNetworkNoAppView | ||
|
@@ -46,16 +48,19 @@ describe('agent', () => { | |
expect(agent.session?.did).toEqual(res.data.did) | ||
expect(agent.session?.email).toEqual('[email protected]') | ||
expect(agent.session?.emailConfirmed).toEqual(false) | ||
assert(isValidDidDoc(res.data.didDoc)) | ||
expect(agent.api.xrpc.uri.origin).toEqual(getPdsEndpoint(res.data.didDoc)) | ||
|
||
const { data: sessionInfo } = await agent.api.com.atproto.server.getSession( | ||
{}, | ||
) | ||
expect(sessionInfo).toEqual({ | ||
expect(sessionInfo).toMatchObject({ | ||
did: res.data.did, | ||
handle: res.data.handle, | ||
email: '[email protected]', | ||
emailConfirmed: false, | ||
}) | ||
expect(isValidDidDoc(sessionInfo.didDoc)).toBe(true) | ||
|
||
expect(events.length).toEqual(1) | ||
expect(events[0]).toEqual('create') | ||
|
@@ -93,15 +98,18 @@ describe('agent', () => { | |
expect(agent2.session?.did).toEqual(res1.data.did) | ||
expect(agent2.session?.email).toEqual('[email protected]') | ||
expect(agent2.session?.emailConfirmed).toEqual(false) | ||
assert(isValidDidDoc(res1.data.didDoc)) | ||
expect(agent2.api.xrpc.uri.origin).toEqual(getPdsEndpoint(res1.data.didDoc)) | ||
|
||
const { data: sessionInfo } = | ||
await agent2.api.com.atproto.server.getSession({}) | ||
expect(sessionInfo).toEqual({ | ||
expect(sessionInfo).toMatchObject({ | ||
did: res1.data.did, | ||
handle: res1.data.handle, | ||
email, | ||
emailConfirmed: false, | ||
}) | ||
expect(isValidDidDoc(sessionInfo.didDoc)).toBe(true) | ||
|
||
expect(events.length).toEqual(2) | ||
expect(events[0]).toEqual('create') | ||
|
@@ -136,15 +144,18 @@ describe('agent', () => { | |
expect(agent2.hasSession).toEqual(true) | ||
expect(agent2.session?.handle).toEqual(res1.data.handle) | ||
expect(agent2.session?.did).toEqual(res1.data.did) | ||
assert(isValidDidDoc(res1.data.didDoc)) | ||
expect(agent2.api.xrpc.uri.origin).toEqual(getPdsEndpoint(res1.data.didDoc)) | ||
|
||
const { data: sessionInfo } = | ||
await agent2.api.com.atproto.server.getSession({}) | ||
expect(sessionInfo).toEqual({ | ||
expect(sessionInfo).toMatchObject({ | ||
did: res1.data.did, | ||
handle: res1.data.handle, | ||
email: res1.data.email, | ||
emailConfirmed: false, | ||
}) | ||
expect(isValidDidDoc(sessionInfo.didDoc)).toBe(true) | ||
|
||
expect(events.length).toEqual(2) | ||
expect(events[0]).toEqual('create') | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters