Skip to content

Conversation

@Custard7
Copy link
Collaborator

@Custard7 Custard7 commented Jan 6, 2026

Issue & Verify API routes

Summary

This PR introduces two new endpoints in the brain-service that enable credential issuance and verification through the LearnCard Network API, along with corresponding SDK methods and comprehensive documentation.

Features

New Brain-Service Endpoints

  • issueCredential - Authenticated endpoint that allows clients to issue credentials using registered signing authorities

    • Uses the user's primary signing authority if none specified
    • Supports optional encryption of the resulting credential
    • Requires credentials:write scope
  • verifyCredential - Public endpoint for verifying credentials

    • Returns verification result with checks, warnings, and errors
    • No authentication required

Network Plugin Enhancements

  • Added issueCredentialWithNetwork() method for explicit network-based credential issuance
  • Added verifyCredentialWithNetwork() method for network-based verification
  • Added issueCredential override that automatically delegates to network signing when no local keypair is available (API key mode)

API Key LearnCard Support

API key-initialized LearnCards can now seamlessly issue credentials via learnCard.invoke.issueCredential() - the network plugin automatically detects the absence of a local keypair and delegates to the user's registered signing authority.

Files Changed

Package/Service Files
@learncard/types src/lcn.ts - Added IssueCredentialInputValidator, VerifyCredentialInputValidator
brain-service src/routes/credentials.ts - New route implementations
brain-service test/credentials.spec.ts - Unit tests (12 new tests)
@learncard/network-plugin src/plugin.ts, src/types.ts - New methods + issueCredential override
E2E tests tests/e2e/tests/credential-issuance.spec.ts - New E2E test file
Docs docs/sdks/learncard-core/construction.md - API key initialization guide

Testing

Unit Tests Added

  • issueCredential tests: auth requirements, scope validation, signing authority handling (8 tests)
  • verifyCredential tests: public access, result structure, error handling (4 tests)

E2E Tests Added

  • Credential issuance with primary and specific signing authorities
  • API key authentication flow
  • Credential verification (valid/invalid credentials)

Documentation

Added comprehensive documentation for API key initialization in docs/sdks/learncard-core/construction.md:

  • When to use API key initialization
  • Step-by-step guide for generating and using API tokens
  • Limitations and considerations

@changeset-bot
Copy link

changeset-bot bot commented Jan 6, 2026

🦋 Changeset detected

Latest commit: 6e18c7f

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 46 packages
Name Type
@learncard/types Patch
@learncard/network-plugin Patch
@learncard/network-brain-service Patch
@learncard/chapi-example Patch
@learncard/snap-example-dapp Patch
@learncard/lca-api-client Patch
@learncard/create-http-bridge Patch
@learncard/cli Patch
@learncard/core Patch
@learncard/helpers Patch
@learncard/init Patch
@learncard/react Patch
@learncard/network-brain-client Patch
@learncard/learn-cloud-client Patch
@learncard/simple-signing-client Patch
@learncard/ceramic-plugin Patch
@learncard/chapi-plugin Patch
@learncard/claimable-boosts-plugin Patch
@learncard/did-web-plugin Patch
@learncard/didkey-plugin Patch
@learncard/didkit-plugin Patch
@learncard/encryption-plugin Patch
@learncard/idx-plugin Patch
@learncard/learn-card-plugin Patch
@learncard/learn-cloud-plugin Patch
@learncard/linked-claims-plugin Patch
@learncard/open-badge-v2-plugin Patch
@learncard/vc-api-plugin Patch
@learncard/vc-templates-plugin Patch
@learncard/vc-plugin Patch
@learncard/vpqr-plugin Patch
learn-card-discord-bot Patch
@learncard/meta-mask-snap Patch
@learncard/lca-api-service Patch
@learncard/learn-cloud-service Patch
@learncard/simple-signing-service Patch
learn-card-app Patch
scoutpass-app Patch
@learncard/snap-chapi-example Patch
learn-card-base Patch
@learncard/expiration-plugin Patch
@learncard/crypto-plugin Patch
@learncard/dynamic-loader-plugin Patch
@learncard/ethereum-plugin Patch
@learncard/lca-api-plugin Patch
@learncard/simple-signing-plugin Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@netlify
Copy link

netlify bot commented Jan 6, 2026

Deploy Preview for learncarddocs canceled.

Name Link
🔨 Latest commit 6e18c7f
🔍 Latest deploy log https://app.netlify.com/projects/learncarddocs/deploys/695d8b1aefa66c00087fc799

@netlify
Copy link

netlify bot commented Jan 6, 2026

Deploy Preview for staging-learncardapp canceled.

Name Link
🔨 Latest commit 6e18c7f
🔍 Latest deploy log https://app.netlify.com/projects/staging-learncardapp/deploys/695d8b1abc24630008270e5d

@github-actions
Copy link
Contributor

github-actions bot commented Jan 6, 2026

👋 Hey there! It looks like you modified code, but didn't update the documentation in /docs.

If this PR introduces new features, changes APIs, or modifies behavior that users or developers need to know about, please consider updating the docs.


🏄 Windsurf Tip

You can ask Windsurf to help:

"Analyze the changes in this PR and update the gitbook docs in /docs accordingly."

Windsurf will review your changes and suggest appropriate documentation updates based on what was modified.


📚 Documentation Guide
Change Type Doc Location
New feature/API docs/tutorials/ or docs/how-to-guides/
SDK/API changes docs/sdks/
New concepts docs/core-concepts/
App UI/UX flows docs/apps/ (LearnCard App, ScoutPass)
Internal patterns CLAUDE.md

This is an automated reminder. If no docs are needed, feel free to ignore this message.

@gitstream-cm
Copy link
Contributor

gitstream-cm bot commented Jan 6, 2026

🥷 Code experts: TaylorBeeston

Custard7, TaylorBeeston have most 👩‍💻 activity in the files.
TaylorBeeston, Custard7 have most 🧠 knowledge in the files.

See details

docs/sdks/learncard-core/construction.md

Activity based on git-commit:

Custard7 TaylorBeeston
JAN
DEC 1335 additions & 3 deletions
NOV
OCT
SEP
AUG

Knowledge based on git-blame:
Custard7: 100%

packages/learn-card-types/src/lcn.ts

Activity based on git-commit:

Custard7 TaylorBeeston
JAN 1 additions & 0 deletions
DEC 179 additions & 81 deletions 41 additions & 0 deletions
NOV 550 additions & 64 deletions
OCT 94 additions & 1 deletions
SEP
AUG 6 additions & 2 deletions 19 additions & 1 deletions

Knowledge based on git-blame:
TaylorBeeston: 36%
Custard7: 27%

packages/plugins/learn-card-network/src/plugin.ts

Activity based on git-commit:

Custard7 TaylorBeeston
JAN 83 additions & 1 deletions
DEC 109 additions & 0 deletions 69 additions & 2 deletions
NOV 185 additions & 14 deletions
OCT 47 additions & 0 deletions
SEP 265 additions & 149 deletions
AUG 40 additions & 0 deletions

Knowledge based on git-blame:
TaylorBeeston: 31%
Custard7: 13%

packages/plugins/learn-card-network/src/types.ts

Activity based on git-commit:

Custard7 TaylorBeeston
JAN 1 additions & 0 deletions
DEC 50 additions & 0 deletions 4 additions & 0 deletions
NOV 130 additions & 5 deletions
OCT 26 additions & 2 deletions
SEP 10 additions & 7 deletions
AUG 2 additions & 1 deletions 17 additions & 0 deletions

Knowledge based on git-blame:
TaylorBeeston: 23%
Custard7: 12%

services/learn-card-network/brain-service/src/routes/credentials.ts

Activity based on git-commit:

Custard7 TaylorBeeston
JAN
DEC 5 additions & 5 deletions
NOV
OCT
SEP
AUG

Knowledge based on git-blame:
Custard7: 2%

services/learn-card-network/brain-service/test/credentials.spec.ts

Activity based on git-commit:

Custard7 TaylorBeeston
JAN
DEC 48 additions & 1 deletions
NOV
OCT
SEP
AUG

Knowledge based on git-blame:
TaylorBeeston: 8%

✨ Comment /gs review for LinearB AI review. Learn how to automate it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants