Skip to content

Commit

Permalink
Directly pass create account params in agent (#2062)
Browse files Browse the repository at this point in the history
* directly pass create account params in agent

* changeset
  • Loading branch information
dholms authored Jan 19, 2024
1 parent b906c0c commit c6fc73a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 18 deletions.
5 changes: 5 additions & 0 deletions .changeset/light-lizards-tap.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@atproto/api': patch
---

Directly pass create account params in api agent
10 changes: 2 additions & 8 deletions packages/api/src/agent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import {
} from './client'
import {
AtpSessionData,
AtpAgentCreateAccountOpts,
AtpAgentLoginOpts,
AtpAgentFetchHandler,
AtpAgentFetchHandlerResponse,
Expand Down Expand Up @@ -86,15 +85,10 @@ export class AtpAgent {
* Create a new account and hydrate its session in this agent.
*/
async createAccount(
opts: AtpAgentCreateAccountOpts,
opts: ComAtprotoServerCreateAccount.InputSchema,
): Promise<ComAtprotoServerCreateAccount.Response> {
try {
const res = await this.api.com.atproto.server.createAccount({
handle: opts.handle,
password: opts.password,
email: opts.email,
inviteCode: opts.inviteCode,
})
const res = await this.api.com.atproto.server.createAccount(opts)
this.session = {
accessJwt: res.data.accessJwt,
refreshJwt: res.data.refreshJwt,
Expand Down
10 changes: 0 additions & 10 deletions packages/api/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,6 @@ export interface AtpAgentOpts {
persistSession?: AtpPersistSessionHandler
}

/**
* AtpAgent createAccount() opts
*/
export interface AtpAgentCreateAccountOpts {
email: string
password: string
handle: string
inviteCode?: string
}

/**
* AtpAgent login() opts
*/
Expand Down

0 comments on commit c6fc73a

Please sign in to comment.