Add the session kind option to createSession - #85
Merged
Merged
Conversation
The API accepts kind on POST /v1/sessions: kyc runs identity verification, sign_in is registration-only and mints a sign_in-scoped credential. Merchants that key durable state on the account with no compliance policy need the second kind and could not request it through the SDK. Omitted when unset, so existing callers keep the API default. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
createSessiongains an optionalkind('kyc' | 'sign_in'). The API already accepts it onPOST /v1/sessions:kyc(its default) runs identity verification,sign_inis registration-only (the buyer signs in with an AgentScore account, no identity documents) and mints asign_in-scoped credential. Merchants that key durable state on the buyer's account without any compliance policy, such as a prepaid metered store, could not mint that kind through the SDK, so their identity bootstrap either did not exist or forced a KYC flow the merchant does not need.SessionCreateResponsealso gains the optionalkindthe API echoes back. Whenkindis not passed the body omits it, so the API default is unchanged for every existing caller.Type of change
Public API
SessionCreateOptions.kind?: 'kyc' | 'sign_in'(new, optional) andSessionCreateResponse.kind?: 'kyc' | 'sign_in'(new, optional). No migration: existing calls behave exactly as before.Test plan
tests/index.test.ts: the first-class-fields test now passeskind: 'sign_in'and asserts it lands in the body; a new test asserts the body carries nokindkey when the option is absent. Locally:bun run lint,bun run typecheck,bun run test(7 files, 167 passed, 9 skipped).Checklist
Worked with Varun. Version bumped to 2.7.10; the tag follows the merge.
🤖 Generated with Claude Code