diff --git a/.changeset/nasty-ways-change.md b/.changeset/nasty-ways-change.md new file mode 100644 index 0000000..8c1a8f2 --- /dev/null +++ b/.changeset/nasty-ways-change.md @@ -0,0 +1,5 @@ +--- +"@agentcommercekit/vc": minor +--- + +Replaced StatusList2021 with BitstringStatusList for VC revocation diff --git a/docs/demos/example-identity.mdx b/docs/demos/example-identity.mdx index d7c3789..6e06ded 100644 --- a/docs/demos/example-identity.mdx +++ b/docs/demos/example-identity.mdx @@ -12,7 +12,7 @@ The API supports issuing, verifying, and revoking two primary credential types: - **`ControllerCredential`**: proves ownership of DIDs (part of ACK-ID). - **`PaymentReceiptCredential`**: provides proof of payment meeting a Payment Request (part of ACK-Pay). -The issuer implements credential revocation using [StatusList2021](https://www.w3.org/community/reports/credentials/CG-FINAL-vc-status-list-2021-20230102/), a privacy-preserving and efficient revocation list method. +The issuer implements credential revocation using [Bitstring Status List](https://www.w3.org/TR/vc-bitstring-status-list/), a privacy-preserving and efficient revocation list method. ## Installation and Setup @@ -158,7 +158,7 @@ curl --request DELETE \ #### `GET /status/:listId` -Retrieve StatusList2021 credential for revocation checks. +Retrieve Bitstring Status List credential for revocation checks. **Sample cURL:** diff --git a/examples/issuer/README.md b/examples/issuer/README.md index f757ae1..03c9ac1 100644 --- a/examples/issuer/README.md +++ b/examples/issuer/README.md @@ -7,7 +7,7 @@ The API allows for the issuance, verification, and revocation of the following c - `ControllerCredential`: ACK-ID credentials that prove DID ownership hierarchies. - `PaymentReceiptCredential`: ACK-Pay credentials that provide proof of payment that satisfies a given Payment Request. -This issuer supports credential revocation using [StatusList2021](https://www.w3.org/community/reports/credentials/CG-FINAL-vc-status-list-2021-20230102/), which is a privacy-preserving, space-efficient mechanism for maintaining a credential revocation list. +This issuer supports credential revocation using [Bitstring Status List](https://www.w3.org/TR/vc-bitstring-status-list/), which is a privacy-preserving, space-efficient mechanism for maintaining a credential revocation list. ## Getting Started @@ -269,7 +269,7 @@ curl --request DELETE \ #### GET /status/:listId -Retrieve a StatusList2021 credential for checking revocation status +Retrieve a Bitstring Status List credential for checking revocation status **Response Body** diff --git a/examples/issuer/src/routes/status.ts b/examples/issuer/src/routes/status.ts index 2672e96..175fb14 100644 --- a/examples/issuer/src/routes/status.ts +++ b/examples/issuer/src/routes/status.ts @@ -9,7 +9,10 @@ import { database } from "@/middleware/database" import { didResolver } from "@/middleware/did-resolver" import { issuer } from "@/middleware/issuer" import type { ApiResponse } from "@repo/api-utils/api-response" -import type { StatusList2021Credential, Verifiable } from "agentcommercekit" +import type { + BitstringStatusListCredential, + Verifiable +} from "agentcommercekit" import type { Env } from "hono" const app = new Hono() @@ -21,16 +24,18 @@ app.use("*", didResolver()) /** * GET /status/:listId * - * @description Retrieves a StatusList2021 credential for checking revocation status + * @description Retrieves a BitstringStatusListCredential for checking revocation status * * URL Parameters: * - listId: string - ID of the status list to retrieve * - * @returns Signed StatusList2021 credential with compressed bit string + * @returns Signed BitstringStatusListCredential with compressed bit string */ app.get( "/:listId", - async (c): Promise>> => { + async ( + c + ): Promise>> => { const listId = c.req.param("listId") const db = c.get("db") const issuer = c.get("issuer") diff --git a/examples/verifier/README.md b/examples/verifier/README.md index 5a0e151..d6c960c 100644 --- a/examples/verifier/README.md +++ b/examples/verifier/README.md @@ -5,7 +5,7 @@ This example showcases a **Credential Verifier** for [ACK-ID](https://www.agentc - `ControllerCredential`: ACK-ID credentials that prove DID ownership hierarchies. - `PaymentReceiptCredential`: ACK-Pay credentials that provide proof of payment that satisfies a given Payment Request. -This verifier uses [StatusList2021](https://www.w3.org/community/reports/credentials/CG-FINAL-vc-status-list-2021-20230102/), to check if a credential is revoked.# Installation +This verifier uses [Bitstring Status List](https://www.w3.org/TR/vc-bitstring-status-list/), to check if a credential is revoked. ## Getting Started @@ -98,7 +98,7 @@ curl --request POST \ }, "credentialStatus": { "id": "http://localhost:3456/status/0#0", - "type": "StatusList2021Entry", + "type": "BitstringStatusListEntry", "statusPurpose": "revocation", "statusListIndex": "0", "statusListCredential": "http://localhost:3456/status/0" diff --git a/packages/vc/src/revocation/is-status-list-credential.ts b/packages/vc/src/revocation/is-status-list-credential.ts index 1afcb66..4ba9d7d 100644 --- a/packages/vc/src/revocation/is-status-list-credential.ts +++ b/packages/vc/src/revocation/is-status-list-credential.ts @@ -1,13 +1,13 @@ import * as v from "valibot" import { isCredential } from "../is-credential" -import { statusList2021ClaimSchema } from "../schemas/valibot" -import type { StatusList2021Credential } from "./types" +import { bitstringStatusListClaimSchema } from "../schemas/valibot" +import type { BitstringStatusListCredential } from "./types" import type { CredentialSubject } from "../types" -function isStatusList2021Claim( +function isStatusListClaim( credentialSubject: CredentialSubject -): credentialSubject is v.InferOutput { - return v.is(statusList2021ClaimSchema, credentialSubject) +): credentialSubject is v.InferOutput { + return v.is(bitstringStatusListClaimSchema, credentialSubject) } /** @@ -18,9 +18,9 @@ function isStatusList2021Claim( */ export function isStatusListCredential( credential: unknown -): credential is StatusList2021Credential { +): credential is BitstringStatusListCredential { if (!isCredential(credential)) { return false } - return isStatusList2021Claim(credential.credentialSubject) + return isStatusListClaim(credential.credentialSubject) } diff --git a/packages/vc/src/revocation/make-revocable.test.ts b/packages/vc/src/revocation/make-revocable.test.ts index 3f92c26..2e63ce3 100644 --- a/packages/vc/src/revocation/make-revocable.test.ts +++ b/packages/vc/src/revocation/make-revocable.test.ts @@ -24,7 +24,7 @@ describe("makeRevocable", () => { expect(revocableCredential.credentialStatus).toEqual({ id: mockStatusListId, - type: "StatusList2021Entry", + type: "BitstringStatusListEntry", statusPurpose: "revocation", statusListIndex: mockStatusListIndex.toString(), statusListCredential: mockStatusListUrl diff --git a/packages/vc/src/revocation/make-revocable.ts b/packages/vc/src/revocation/make-revocable.ts index 9f00903..da19e68 100644 --- a/packages/vc/src/revocation/make-revocable.ts +++ b/packages/vc/src/revocation/make-revocable.ts @@ -31,7 +31,7 @@ export function makeRevocable( ...credential, credentialStatus: { id, - type: "StatusList2021Entry", + type: "BitstringStatusListEntry", statusPurpose: "revocation", statusListIndex: statusListIndex.toString(), statusListCredential: statusListUrl diff --git a/packages/vc/src/revocation/status-list-credential.test.ts b/packages/vc/src/revocation/status-list-credential.test.ts index 69528bb..2c7b880 100644 --- a/packages/vc/src/revocation/status-list-credential.test.ts +++ b/packages/vc/src/revocation/status-list-credential.test.ts @@ -13,10 +13,10 @@ describe("createStatusListCredential", () => { const credential = createStatusListCredential(params) - expect(credential.type).toContain("StatusList2021Credential") + expect(credential.type).toContain("BitstringStatusListCredential") expect(credential.issuer).toEqual({ id: issuer }) expect(credential.credentialSubject).toBeDefined() - expect(credential.credentialSubject.type).toBe("StatusList2021") + expect(credential.credentialSubject.type).toBe("BitstringStatusList") expect(credential.credentialSubject.statusPurpose).toBe("revocation") expect(credential.credentialSubject.encodedList).toBe(params.encodedList) }) diff --git a/packages/vc/src/revocation/status-list-credential.ts b/packages/vc/src/revocation/status-list-credential.ts index 4c5e393..bda32f7 100644 --- a/packages/vc/src/revocation/status-list-credential.ts +++ b/packages/vc/src/revocation/status-list-credential.ts @@ -1,5 +1,5 @@ import { createCredential } from "../create-credential" -import type { StatusList2021Credential } from "./types" +import type { BitstringStatusListCredential } from "./types" type CreateStatusListCredentialParams = { /** @@ -20,20 +20,20 @@ type CreateStatusListCredentialParams = { * Generates a status list credential. * * @param params - The {@link CreateStatusListCredentialParams} to use - * @returns A {@link StatusList2021Credential} + * @returns A {@link BitstringStatusListCredential} */ export function createStatusListCredential({ url, encodedList, issuer -}: CreateStatusListCredentialParams): StatusList2021Credential { +}: CreateStatusListCredentialParams): BitstringStatusListCredential { return createCredential({ id: url, - type: "StatusList2021Credential", + type: "BitstringStatusListCredential", issuer, subject: `${url}#list`, attestation: { - type: "StatusList2021", + type: "BitstringStatusList", statusPurpose: "revocation", encodedList } diff --git a/packages/vc/src/revocation/types.ts b/packages/vc/src/revocation/types.ts index deebac7..fd638f0 100644 --- a/packages/vc/src/revocation/types.ts +++ b/packages/vc/src/revocation/types.ts @@ -1,19 +1,19 @@ -import type { statusList2021ClaimSchema } from "../schemas/valibot" +import type { bitstringStatusListClaimSchema } from "../schemas/valibot" import type { W3CCredential } from "../types" import type * as v from "valibot" -type StatusList2021Entry = { +type BitstringStatusListEntry = { id: string - type: "StatusList2021Entry" + type: "BitstringStatusListEntry" statusPurpose: string statusListIndex: string statusListCredential: string } -export type StatusList2021Credential = W3CCredential & { - credentialSubject: v.InferOutput +export type BitstringStatusListCredential = W3CCredential & { + credentialSubject: v.InferOutput } export type Revocable = T & { - credentialStatus: StatusList2021Entry + credentialStatus: BitstringStatusListEntry } diff --git a/packages/vc/src/schemas/valibot.ts b/packages/vc/src/schemas/valibot.ts index eae12b3..d61d6c0 100644 --- a/packages/vc/src/schemas/valibot.ts +++ b/packages/vc/src/schemas/valibot.ts @@ -36,9 +36,9 @@ export const jwtProofSchema = v.object({ jwt: v.string() }) -export const statusList2021ClaimSchema = v.object({ +export const bitstringStatusListClaimSchema = v.object({ id: v.string(), - type: v.literal("StatusList2021"), + type: v.literal("BitstringStatusList"), statusPurpose: v.string(), encodedList: v.string() }) diff --git a/packages/vc/src/schemas/zod/v3.ts b/packages/vc/src/schemas/zod/v3.ts index 1c1db0c..49894dd 100644 --- a/packages/vc/src/schemas/zod/v3.ts +++ b/packages/vc/src/schemas/zod/v3.ts @@ -37,9 +37,9 @@ export const jwtProofSchema = z.object({ jwt: z.string() }) -export const statusList2021ClaimSchema = z.object({ +export const bitstringStatusListClaimSchema = z.object({ id: z.string(), - type: z.literal("StatusList2021"), + type: z.literal("BitstringStatusList"), statusPurpose: z.string(), encodedList: z.string() }) diff --git a/packages/vc/src/schemas/zod/v4.ts b/packages/vc/src/schemas/zod/v4.ts index f77b9bc..da556ce 100644 --- a/packages/vc/src/schemas/zod/v4.ts +++ b/packages/vc/src/schemas/zod/v4.ts @@ -36,9 +36,9 @@ export const jwtProofSchema = z.object({ jwt: z.string() }) -export const statusList2021ClaimSchema = z.object({ +export const bitstringStatusListClaimSchema = z.object({ id: z.string(), - type: z.literal("StatusList2021"), + type: z.literal("BitstringStatusList"), statusPurpose: z.string(), encodedList: z.string() }) diff --git a/packages/vc/src/verification/is-revoked.ts b/packages/vc/src/verification/is-revoked.ts index c8f713f..1b1fe19 100644 --- a/packages/vc/src/verification/is-revoked.ts +++ b/packages/vc/src/verification/is-revoked.ts @@ -1,6 +1,9 @@ import { BitBuffer } from "bit-buffers" import { isStatusListCredential } from "../revocation/is-status-list-credential" -import type { Revocable, StatusList2021Credential } from "../revocation/types" +import type { + BitstringStatusListCredential, + Revocable +} from "../revocation/types" import type { W3CCredential } from "../types" /** @@ -21,7 +24,7 @@ export function isRevocable( async function fetchStatusList( credential: Revocable -): Promise { +): Promise { const statusListUrl = credential.credentialStatus.statusListCredential try {