Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions .changeset/config.json

This file was deleted.

1 change: 0 additions & 1 deletion js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
"test": "pnpm -r test"
},
"devDependencies": {
"@changesets/cli": "^2.27",
"prettier": "^3.3",
"turbo": "^2.2",
"typescript": "^5.6"
Expand Down
1 change: 1 addition & 0 deletions js/packages/core/src/__tests__/smoke.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,7 @@ describe("Enums", () => {
expect(IDKitErrorCodes.CredentialUnavailable).toBe(
"credential_unavailable",
);
expect(IDKitErrorCodes.FeatureUnavailable).toBe("feature_unavailable");
expect(IDKitErrorCodes.UserPresenceFailed).toBe("user_presence_failed");
expect(IDKitErrorCodes.WorldId4NotAvailable).toBe(
"world_id_4_not_available",
Expand Down
1 change: 1 addition & 0 deletions js/packages/core/src/types/result.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ export enum IDKitErrorCodes {
UserRejected = "user_rejected",
VerificationRejected = "verification_rejected",
CredentialUnavailable = "credential_unavailable",
FeatureUnavailable = "feature_unavailable",
WorldId4NotAvailable = "world_id_4_not_available",
WorldId3NotAvailable = "world_id_3_not_available",
MalformedRequest = "malformed_request",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ enum class IDKitErrorCode(val rawValue: String) {
USER_REJECTED("user_rejected"),
VERIFICATION_REJECTED("verification_rejected"),
CREDENTIAL_UNAVAILABLE("credential_unavailable"),
FEATURE_UNAVAILABLE("feature_unavailable"),
WORLD_ID_4_NOT_AVAILABLE("world_id_4_not_available"),
WORLD_ID_3_NOT_AVAILABLE("world_id_3_not_available"),
MALFORMED_REQUEST("malformed_request"),
Expand Down Expand Up @@ -138,6 +139,7 @@ enum class IDKitErrorCode(val rawValue: String) {
AppError.USER_REJECTED -> USER_REJECTED
AppError.VERIFICATION_REJECTED -> VERIFICATION_REJECTED
AppError.CREDENTIAL_UNAVAILABLE -> CREDENTIAL_UNAVAILABLE
AppError.FEATURE_UNAVAILABLE -> FEATURE_UNAVAILABLE
AppError.WORLD_ID4_NOT_AVAILABLE -> WORLD_ID_4_NOT_AVAILABLE
AppError.WORLD_ID3_NOT_AVAILABLE -> WORLD_ID_3_NOT_AVAILABLE
AppError.MALFORMED_REQUEST -> MALFORMED_REQUEST
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,10 @@ class IDKitTests {
IDKitStatus.Failed(IDKitErrorCode.INVALID_NETWORK),
IDKitRequest.mapStatus(StatusWrapper.Failed(AppError.INVALID_NETWORK)),
)
assertEquals(
IDKitStatus.Failed(IDKitErrorCode.FEATURE_UNAVAILABLE),
IDKitRequest.mapStatus(StatusWrapper.Failed(AppError.FEATURE_UNAVAILABLE)),
)
assertEquals(
IDKitStatus.Failed(IDKitErrorCode.USER_PRESENCE_FAILED),
IDKitRequest.mapStatus(StatusWrapper.Failed(AppError.USER_PRESENCE_FAILED)),
Expand Down
1 change: 1 addition & 0 deletions rust/core/src/bridge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3443,6 +3443,7 @@ mod tests {
);

let cases = [
("feature_unavailable", AppError::FeatureUnavailable),
("world_id_4_not_available", AppError::WorldId4NotAvailable),
("world_id_3_not_available", AppError::WorldId3NotAvailable),
("duplicate_nonce", AppError::DuplicateNonce),
Expand Down
5 changes: 5 additions & 0 deletions rust/core/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ pub enum AppError {
#[error("Requested credential is not available")]
CredentialUnavailable,

/// Requested feature is not enabled for the app
#[error("Requested feature is not available")]
FeatureUnavailable,

/// World ID 4.0 credential is not available
#[error("World ID 4.0 is not available")]
#[serde(rename = "world_id_4_not_available")]
Expand Down Expand Up @@ -178,6 +182,7 @@ impl AppError {
"user_rejected" => Self::UserRejected,
"verification_rejected" => Self::VerificationRejected,
"credential_unavailable" => Self::CredentialUnavailable,
"feature_unavailable" => Self::FeatureUnavailable,
"world_id_4_not_available" => Self::WorldId4NotAvailable,
"world_id_3_not_available" => Self::WorldId3NotAvailable,
"malformed_request" => Self::MalformedRequest,
Expand Down
1 change: 1 addition & 0 deletions rust/core/src/wasm_bindings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1616,6 +1616,7 @@ export type IDKitErrorCode =
| "user_rejected"
| "verification_rejected"
| "credential_unavailable"
| "feature_unavailable"
| "world_id_4_not_available"
| "world_id_3_not_available"
| "malformed_request"
Expand Down
3 changes: 3 additions & 0 deletions swift/Sources/IDKit/IDKit.swift
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,7 @@ public enum IDKitErrorCode: String, Equatable {
case userRejected = "user_rejected"
case verificationRejected = "verification_rejected"
case credentialUnavailable = "credential_unavailable"
case featureUnavailable = "feature_unavailable"
case worldId4NotAvailable = "world_id_4_not_available"
case worldId3NotAvailable = "world_id_3_not_available"
case malformedRequest = "malformed_request"
Expand Down Expand Up @@ -268,6 +269,8 @@ public enum IDKitErrorCode: String, Equatable {
.verificationRejected
case .credentialUnavailable:
.credentialUnavailable
case .featureUnavailable:
.featureUnavailable
case .worldId4NotAvailable:
.worldId4NotAvailable
case .worldId3NotAvailable:
Expand Down
6 changes: 6 additions & 0 deletions swift/Tests/IDKitTests/IDKitTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ private func sampleRpContext() throws -> RpContext {
)
}

@Test("feature unavailable maps to the canonical public error")
func featureUnavailableErrorMapping() {
#expect(IDKitErrorCode.from(appError: .featureUnavailable) == .featureUnavailable)
#expect(IDKitErrorCode.featureUnavailable.rawValue == "feature_unavailable")
}


@Test("IDKit entrypoints expose canonical builders")
func idkitEntrypoints() throws {
Expand Down
Loading