@proofchain/sdk 2.21.1 → 2.23.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -3520,12 +3520,29 @@ declare class NftClient {
3520
3520
 
3521
3521
  /**
3522
3522
  * Partner Keys Resource - OTT (One-Time Token) auth for partner integrations
3523
+ *
3524
+ * Flow:
3525
+ * 1. Mobile app generates OTT: POST /partner-keys/generate (tenant API key + user JWT)
3526
+ * 2. OTT is passed to partner webview via URL param
3527
+ * 3. Partner backend redeems OTT: POST /partner-keys/redeem (integrator API key)
3523
3528
  */
3524
3529
 
3525
- interface OTTRequestResponse {
3530
+ interface OTTGenerateRequest {
3531
+ ttl?: number;
3532
+ session_data_keys?: string[];
3533
+ }
3534
+ interface OTTGenerateResponse {
3526
3535
  ott: string;
3527
3536
  expires_in: number;
3528
3537
  }
3538
+ interface OTTRedeemResponse {
3539
+ user_id: string;
3540
+ tenant_id: string;
3541
+ tenant_name: string | null;
3542
+ session_data: Record<string, unknown>;
3543
+ issued_at: string;
3544
+ expires_at: string;
3545
+ }
3529
3546
  interface OTTConfigUpdate {
3530
3547
  ott_enabled?: boolean;
3531
3548
  ott_ttl_seconds?: number;
@@ -3542,21 +3559,210 @@ interface OTTConfigResponse {
3542
3559
  ott_jwt_ttl_seconds: number;
3543
3560
  ott_session_data_keys?: string[];
3544
3561
  }
3562
+ /** @deprecated Use OTTGenerateResponse */
3563
+ type OTTRequestResponse = OTTGenerateResponse;
3545
3564
  declare class PartnerKeysClient {
3546
3565
  private http;
3547
3566
  constructor(http: HttpClient);
3548
3567
  /**
3549
- * Request a one-time token for a partner key (end-user JWKS auth).
3568
+ * Generate a one-time token for the authenticated end-user.
3569
+ *
3570
+ * Requires: tenant API key (X-API-Key) + end-user JWT (Authorization: Bearer).
3571
+ * The SDK must be initialised with both `apiKey` and `userToken`.
3572
+ *
3573
+ * @param options.ttl - Token lifetime in seconds (30–3600, default 300)
3574
+ * @param options.session_data_keys - Whitelist of JWT claims to include
3575
+ */
3576
+ generate(options?: OTTGenerateRequest): Promise<OTTGenerateResponse>;
3577
+ /**
3578
+ * Redeem a one-time token to get the user's identity.
3579
+ *
3580
+ * Requires: integrator API key (X-API-Key). The token is single-use
3581
+ * and deleted on successful redemption.
3582
+ *
3583
+ * @param ott - The opaque one-time token
3550
3584
  */
3551
- requestOTT(keyId: string): Promise<OTTRequestResponse>;
3585
+ redeem(ott: string): Promise<OTTRedeemResponse>;
3552
3586
  /**
3553
- * Update OTT configuration for a partner key.
3587
+ * Update OTT configuration for a partner key (tenant admin).
3554
3588
  */
3555
3589
  updateOTTConfig(keyId: string, config: OTTConfigUpdate): Promise<OTTConfigResponse>;
3556
3590
  /**
3557
- * Get OTT configuration for a partner key.
3591
+ * Get OTT configuration for a partner key (tenant admin).
3558
3592
  */
3559
3593
  getOTTConfig(keyId: string): Promise<OTTConfigResponse>;
3594
+ /** @deprecated Use generate() */
3595
+ requestOTT(_keyId: string): Promise<OTTGenerateResponse>;
3596
+ }
3597
+
3598
+ /**
3599
+ * Attestations API Client
3600
+ *
3601
+ * Manage on-chain and off-chain attestations — EIP-712 signed credentials
3602
+ * issued to users' smart wallet addresses.
3603
+ *
3604
+ * Includes public credential discovery endpoints that require no authentication.
3605
+ */
3606
+
3607
+ interface AttestationSchema {
3608
+ id: string;
3609
+ name: string;
3610
+ slug: string;
3611
+ description?: string;
3612
+ attestation_type: string;
3613
+ schema_definition: Record<string, any>;
3614
+ revocable: boolean;
3615
+ default_expiry_days?: number;
3616
+ icon?: string;
3617
+ color?: string;
3618
+ version: number;
3619
+ is_active: boolean;
3620
+ created_at: string;
3621
+ }
3622
+ interface Attestation {
3623
+ id: string;
3624
+ uid: string;
3625
+ tenant_id: string;
3626
+ schema_id: string;
3627
+ attester_address: string;
3628
+ attester_type: string;
3629
+ subject_address: string;
3630
+ subject_user_id?: string;
3631
+ data: Record<string, any>;
3632
+ ref_type?: string;
3633
+ ref_id?: string;
3634
+ signature?: string;
3635
+ signature_type?: string;
3636
+ status: string;
3637
+ expires_at?: string;
3638
+ revoked_at?: string;
3639
+ revocation_reason?: string;
3640
+ tx_hash?: string;
3641
+ block_number?: number;
3642
+ ipfs_hash?: string;
3643
+ created_at: string;
3644
+ }
3645
+ interface WalletCredential {
3646
+ uid: string;
3647
+ attestation_type?: string;
3648
+ issuer_name?: string;
3649
+ issuer_client_id?: string;
3650
+ subject_address: string;
3651
+ data: Record<string, any>;
3652
+ signature?: string;
3653
+ signature_type?: string;
3654
+ status: string;
3655
+ tx_hash?: string;
3656
+ expires_at?: string;
3657
+ created_at: string;
3658
+ }
3659
+ interface WalletCredentialVerifySummary {
3660
+ wallet_address: string;
3661
+ total_credentials: number;
3662
+ credential_types: Record<string, number>;
3663
+ latest_scores: Record<string, any>;
3664
+ is_verified: boolean;
3665
+ }
3666
+ interface AttestationConfig {
3667
+ id: string;
3668
+ tenant_id: string;
3669
+ auto_attest_passports: boolean;
3670
+ auto_attest_cohort_scores: boolean;
3671
+ attest_on_score_change: boolean;
3672
+ min_score_change_threshold: number;
3673
+ anchor_attestations: boolean;
3674
+ reward_anchoring_mode: string;
3675
+ public_attestations: boolean;
3676
+ }
3677
+ interface CreateAttestationRequest {
3678
+ schema_id: string;
3679
+ subject_address: string;
3680
+ data: Record<string, any>;
3681
+ subject_user_id?: string;
3682
+ ref_type?: string;
3683
+ ref_id?: string;
3684
+ expires_at?: string;
3685
+ }
3686
+ interface ListAttestationsOptions {
3687
+ attestation_type?: string;
3688
+ status?: string;
3689
+ limit?: number;
3690
+ }
3691
+ interface ListWalletCredentialsOptions {
3692
+ attestation_type?: string;
3693
+ limit?: number;
3694
+ offset?: number;
3695
+ }
3696
+ interface UpdateConfigRequest {
3697
+ attest_on_score_change?: boolean;
3698
+ min_score_change_threshold?: number;
3699
+ anchor_attestations?: boolean;
3700
+ reward_anchoring_mode?: string;
3701
+ auto_attest_cohort_scores?: boolean;
3702
+ public_attestations?: boolean;
3703
+ }
3704
+ declare class AttestationsClient {
3705
+ private http;
3706
+ constructor(http: HttpClient);
3707
+ /**
3708
+ * List attestation schemas for the tenant
3709
+ */
3710
+ listSchemas(options?: {
3711
+ attestation_type?: string;
3712
+ }): Promise<AttestationSchema[]>;
3713
+ /**
3714
+ * Get a specific schema
3715
+ */
3716
+ getSchema(schemaId: string): Promise<AttestationSchema>;
3717
+ /**
3718
+ * Create a new attestation. The attestation will be EIP-712 signed
3719
+ * by the tenant's treasury wallet.
3720
+ */
3721
+ create(request: CreateAttestationRequest): Promise<Attestation>;
3722
+ /**
3723
+ * List attestations created by the tenant
3724
+ */
3725
+ list(options?: ListAttestationsOptions): Promise<Attestation[]>;
3726
+ /**
3727
+ * List attestations for a specific subject wallet within the tenant
3728
+ */
3729
+ listBySubject(subjectAddress: string, options?: ListAttestationsOptions): Promise<Attestation[]>;
3730
+ /**
3731
+ * Get a specific attestation by ID
3732
+ */
3733
+ get(attestationId: string): Promise<Attestation>;
3734
+ /**
3735
+ * Revoke an attestation
3736
+ */
3737
+ revoke(attestationId: string, reason?: string): Promise<Attestation>;
3738
+ /**
3739
+ * Anchor an attestation on-chain (requires anchor_attestations enabled)
3740
+ */
3741
+ anchor(attestationId: string): Promise<Attestation>;
3742
+ /**
3743
+ * Get the tenant's attestation configuration
3744
+ */
3745
+ getConfig(): Promise<AttestationConfig>;
3746
+ /**
3747
+ * Update the tenant's attestation configuration
3748
+ */
3749
+ updateConfig(request: UpdateConfigRequest): Promise<AttestationConfig>;
3750
+ /**
3751
+ * List all valid credentials held by a wallet address.
3752
+ * This is a public endpoint — no authentication required.
3753
+ */
3754
+ getWalletCredentials(walletAddress: string, options?: ListWalletCredentialsOptions): Promise<WalletCredential[]>;
3755
+ /**
3756
+ * Get a specific credential by wallet address and attestation UID.
3757
+ * This is a public endpoint — no authentication required.
3758
+ */
3759
+ getWalletCredential(walletAddress: string, attestationUid: string): Promise<WalletCredential>;
3760
+ /**
3761
+ * Get an aggregate verification summary for a wallet's credentials.
3762
+ * Returns credential counts by type and latest score values.
3763
+ * This is a public endpoint — no authentication required.
3764
+ */
3765
+ verifyWalletCredentials(walletAddress: string): Promise<WalletCredentialVerifySummary>;
3560
3766
  }
3561
3767
 
3562
3768
  /**
@@ -3761,6 +3967,8 @@ declare class ProofChain {
3761
3967
  nft: NftClient;
3762
3968
  /** Partner Keys client for OTT auth operations */
3763
3969
  partnerKeys: PartnerKeysClient;
3970
+ /** Attestations client for EIP-712 signed credentials and public discovery */
3971
+ attestations: AttestationsClient;
3764
3972
  constructor(options: ProofChainOptions);
3765
3973
  /**
3766
3974
  * Create a client for end-user JWT authentication (PWA/frontend use).
@@ -3978,4 +4186,4 @@ declare class TimeoutError extends ProofChainError {
3978
4186
  constructor(message?: string);
3979
4187
  }
3980
4188
 
3981
- export { type Achievement, type ActivitySummaryView, type AddNFTRequest, type AnchorResult, type ApiKey, type AttestRequest, type AttestationMode, type AttestationResult, AuthenticationError, AuthorizationError, type AvailableView, type Badge, type BatchIngestRequest, type BatchIngestResponse, type BatchVerifyResult, type BlockchainProof, type BlockchainStats, type Certificate, type CertificateVerifyResult, CertificatesResource, type Channel, type ChannelState, type ChannelStatus, ChannelsResource, type ClaimNFTResult, type ClaimRewardResult, type CohortDefinition, type CohortGroupStats, CohortLeaderboardClient, type CohortLeaderboardEntry, type CohortLeaderboardOptions, type CohortLeaderboardResponse, type ComprehensiveWalletInfo, type CreateAchievementRequest, type CreateApiKeyRequest, type CreateBadgeRequest, type CreateChannelRequest, type CreateCredentialTypeRequest, type CreateDataViewRequest, type CreateDualWalletsRequest, type CreateEndUserRequest, type CreateEventRequest, type CreatePassportDefinitionRequest, type CreatePassportRequest, type CreateQuestRequest, type CreateQuestStepRequest, type CreateRewardDefinitionRequest, type CreateSchemaRequest, type CreateTemplateFieldRequest, type CreateTemplateRequest, type CreateWalletRequest as CreateUserWalletRequest, type CreateWalletRequest$1 as CreateWalletRequest, type CreateWebhookRequest, type CredentialType, type CredentialVerifyResult, CredentialsClient, type DataViewColumn, type DataViewComputation, type DataViewDetail, type DataViewExecuteResult, type DataViewInfo, type DataViewListResponse, type DataViewPreviewRequest, type DataViewPreviewResult, type DataViewSummary, DataViewsClient, type DistributeResult, DocumentsResource, type DualWallets, type EarnedReward, type EndUser, EndUserIngestionClient, type EndUserIngestionClientOptions, type EndUserListResponse, EndUsersClient, type Event, type EventBatchProof, type EventMetadata, type EventStatus, EventsResource, type ExecuteSwapRequest, type Facet, type FacetsResponse, type FanProfileView, type FanpassGroupStats, FanpassLeaderboardClient, type FanpassLeaderboardEntry, type FanpassLeaderboardOptions, type FanpassLeaderboardResponse, type FanpassUserComparisonResponse, type FieldValue, type GDPRDeletionRequest, type GDPRDeletionResponse, type GDPRPreviewResponse, type IngestEventRequest, type IngestEventResponse, IngestionClient, type IngestionClientOptions, type IssueCertificateRequest, type IssueCredentialRequest, type IssuedCredential, type LeaderboardUserProfile$1 as LeaderboardUserProfile, type LinkWalletRequest, type ListCertificatesRequest, type ListCohortsOptions, type ListEndUsersOptions, type ListEventsRequest, type ListIssuedCredentialsOptions, type ListMintsOptions, type ListMintsResponse, type ListQuestsOptions, type ListRewardsOptions, type ListSchemasOptions, type ManualRewardRequest, type MergeUsersRequest, type Milestone, type MintNFTRequest, type NFT, type NFTMint, NetworkError, NftClient, NotFoundError, type NotificationCallback, type NotificationEvent, type NotificationEventType, NotificationsClient, type OTTConfigResponse, type OTTConfigUpdate, type OTTRequestResponse, PartnerKeysClient, type Passport, PassportClient, type PassportDefinition, type PassportFieldValue, type PassportHistory, type PassportTemplate, type PassportV2Data, type PassportWithFields, ProofChain, ProofChainError, type ProofChainOptions, type ProofVerifyResult, type PushSubscriptionJSON, type Quest, type QuestStep, type QuestWithProgress, QuestsClient, RateLimitError, type RegisterWalletRequest, type RevokeResult, type RewardAsset, type RewardAttestationResult, type RewardDefinition, type RewardEarned, type VerifyResult as RewardVerifyResult, RewardsClient, type Schema, type SchemaDetail, type SchemaField, type SchemaListResponse, type ValidationError$1 as SchemaValidationError, SchemasClient, type SearchFilters, type SearchQueryRequest, type SearchRequest, SearchResource, type SearchResponse, type SearchResult, type SearchStats, ServerError, type SetProfileRequest, type Settlement, type StepCompletionResult, type StepProgress, type StepStartResult, type StreamAck, type StreamEventRequest, type SubscribeOptions, type SwapQuote, type SwapQuoteRequest, type SwapResult, type TemplateField, type TenantInfo, TenantResource, type TierDefinition, TimeoutError, type TokenBalance, type TransferRequest, type TransferResult, type Unsubscribe, type UpdateDataViewRequest, type UpdateEndUserRequest, type UpdatePassportRequest, type UpdateWebhookRequest, type UsageStats, type UserAchievement, type UserActivity, type UserActivityResponse, type UserBadge, type UserBreakdownResponse, type UserCohortBreakdownEntry, type UserCredentialsSummary, type UserQuestProgress, type UserReward$1 as UserReward, type UserRewardsResponse, type UserWalletSummary, type UserWithWallets, type UsersWithWalletsResponse, type ValidateDataRequest, ValidationError, type ValidationErrorDetail, type ValidationResult, type VaultFile, type VaultFolder, type VaultListResponse, VaultResource, type VaultStats, type VaultUploadRequest, type VerificationResult, VerifyResource, type ViewColumn, type ViewTemplate, type Wallet, type WalletBalance, WalletClient, type WalletCreationResult, type WalletStats, type Webhook, WebhooksResource };
4189
+ export { type Achievement, type ActivitySummaryView, type AddNFTRequest, type AnchorResult, type ApiKey, type AttestRequest, type AttestationConfig, type AttestationMode, type Attestation as AttestationRecord, type AttestationResult, type AttestationSchema, AttestationsClient, AuthenticationError, AuthorizationError, type AvailableView, type Badge, type BatchIngestRequest, type BatchIngestResponse, type BatchVerifyResult, type BlockchainProof, type BlockchainStats, type Certificate, type CertificateVerifyResult, CertificatesResource, type Channel, type ChannelState, type ChannelStatus, ChannelsResource, type ClaimNFTResult, type ClaimRewardResult, type CohortDefinition, type CohortGroupStats, CohortLeaderboardClient, type CohortLeaderboardEntry, type CohortLeaderboardOptions, type CohortLeaderboardResponse, type ComprehensiveWalletInfo, type CreateAchievementRequest, type CreateApiKeyRequest, type CreateAttestationRequest, type CreateBadgeRequest, type CreateChannelRequest, type CreateCredentialTypeRequest, type CreateDataViewRequest, type CreateDualWalletsRequest, type CreateEndUserRequest, type CreateEventRequest, type CreatePassportDefinitionRequest, type CreatePassportRequest, type CreateQuestRequest, type CreateQuestStepRequest, type CreateRewardDefinitionRequest, type CreateSchemaRequest, type CreateTemplateFieldRequest, type CreateTemplateRequest, type CreateWalletRequest as CreateUserWalletRequest, type CreateWalletRequest$1 as CreateWalletRequest, type CreateWebhookRequest, type CredentialType, type CredentialVerifyResult, CredentialsClient, type DataViewColumn, type DataViewComputation, type DataViewDetail, type DataViewExecuteResult, type DataViewInfo, type DataViewListResponse, type DataViewPreviewRequest, type DataViewPreviewResult, type DataViewSummary, DataViewsClient, type DistributeResult, DocumentsResource, type DualWallets, type EarnedReward, type EndUser, EndUserIngestionClient, type EndUserIngestionClientOptions, type EndUserListResponse, EndUsersClient, type Event, type EventBatchProof, type EventMetadata, type EventStatus, EventsResource, type ExecuteSwapRequest, type Facet, type FacetsResponse, type FanProfileView, type FanpassGroupStats, FanpassLeaderboardClient, type FanpassLeaderboardEntry, type FanpassLeaderboardOptions, type FanpassLeaderboardResponse, type FanpassUserComparisonResponse, type FieldValue, type GDPRDeletionRequest, type GDPRDeletionResponse, type GDPRPreviewResponse, type IngestEventRequest, type IngestEventResponse, IngestionClient, type IngestionClientOptions, type IssueCertificateRequest, type IssueCredentialRequest, type IssuedCredential, type LeaderboardUserProfile$1 as LeaderboardUserProfile, type LinkWalletRequest, type ListAttestationsOptions, type ListCertificatesRequest, type ListCohortsOptions, type ListEndUsersOptions, type ListEventsRequest, type ListIssuedCredentialsOptions, type ListMintsOptions, type ListMintsResponse, type ListQuestsOptions, type ListRewardsOptions, type ListSchemasOptions, type ListWalletCredentialsOptions, type ManualRewardRequest, type MergeUsersRequest, type Milestone, type MintNFTRequest, type NFT, type NFTMint, NetworkError, NftClient, NotFoundError, type NotificationCallback, type NotificationEvent, type NotificationEventType, NotificationsClient, type OTTConfigResponse, type OTTConfigUpdate, type OTTGenerateRequest, type OTTGenerateResponse, type OTTRedeemResponse, type OTTRequestResponse, PartnerKeysClient, type Passport, PassportClient, type PassportDefinition, type PassportFieldValue, type PassportHistory, type PassportTemplate, type PassportV2Data, type PassportWithFields, ProofChain, ProofChainError, type ProofChainOptions, type ProofVerifyResult, type PushSubscriptionJSON, type Quest, type QuestStep, type QuestWithProgress, QuestsClient, RateLimitError, type RegisterWalletRequest, type RevokeResult, type RewardAsset, type RewardAttestationResult, type RewardDefinition, type RewardEarned, type VerifyResult as RewardVerifyResult, RewardsClient, type Schema, type SchemaDetail, type SchemaField, type SchemaListResponse, type ValidationError$1 as SchemaValidationError, SchemasClient, type SearchFilters, type SearchQueryRequest, type SearchRequest, SearchResource, type SearchResponse, type SearchResult, type SearchStats, ServerError, type SetProfileRequest, type Settlement, type StepCompletionResult, type StepProgress, type StepStartResult, type StreamAck, type StreamEventRequest, type SubscribeOptions, type SwapQuote, type SwapQuoteRequest, type SwapResult, type TemplateField, type TenantInfo, TenantResource, type TierDefinition, TimeoutError, type TokenBalance, type TransferRequest, type TransferResult, type Unsubscribe, type UpdateConfigRequest as UpdateAttestationConfigRequest, type UpdateDataViewRequest, type UpdateEndUserRequest, type UpdatePassportRequest, type UpdateWebhookRequest, type UsageStats, type UserAchievement, type UserActivity, type UserActivityResponse, type UserBadge, type UserBreakdownResponse, type UserCohortBreakdownEntry, type UserCredentialsSummary, type UserQuestProgress, type UserReward$1 as UserReward, type UserRewardsResponse, type UserWalletSummary, type UserWithWallets, type UsersWithWalletsResponse, type ValidateDataRequest, ValidationError, type ValidationErrorDetail, type ValidationResult, type VaultFile, type VaultFolder, type VaultListResponse, VaultResource, type VaultStats, type VaultUploadRequest, type VerificationResult, VerifyResource, type ViewColumn, type ViewTemplate, type Wallet, type WalletBalance, WalletClient, type WalletCreationResult, type WalletCredential, type WalletCredentialVerifySummary, type WalletStats, type Webhook, WebhooksResource };
package/dist/index.d.ts CHANGED
@@ -3520,12 +3520,29 @@ declare class NftClient {
3520
3520
 
3521
3521
  /**
3522
3522
  * Partner Keys Resource - OTT (One-Time Token) auth for partner integrations
3523
+ *
3524
+ * Flow:
3525
+ * 1. Mobile app generates OTT: POST /partner-keys/generate (tenant API key + user JWT)
3526
+ * 2. OTT is passed to partner webview via URL param
3527
+ * 3. Partner backend redeems OTT: POST /partner-keys/redeem (integrator API key)
3523
3528
  */
3524
3529
 
3525
- interface OTTRequestResponse {
3530
+ interface OTTGenerateRequest {
3531
+ ttl?: number;
3532
+ session_data_keys?: string[];
3533
+ }
3534
+ interface OTTGenerateResponse {
3526
3535
  ott: string;
3527
3536
  expires_in: number;
3528
3537
  }
3538
+ interface OTTRedeemResponse {
3539
+ user_id: string;
3540
+ tenant_id: string;
3541
+ tenant_name: string | null;
3542
+ session_data: Record<string, unknown>;
3543
+ issued_at: string;
3544
+ expires_at: string;
3545
+ }
3529
3546
  interface OTTConfigUpdate {
3530
3547
  ott_enabled?: boolean;
3531
3548
  ott_ttl_seconds?: number;
@@ -3542,21 +3559,210 @@ interface OTTConfigResponse {
3542
3559
  ott_jwt_ttl_seconds: number;
3543
3560
  ott_session_data_keys?: string[];
3544
3561
  }
3562
+ /** @deprecated Use OTTGenerateResponse */
3563
+ type OTTRequestResponse = OTTGenerateResponse;
3545
3564
  declare class PartnerKeysClient {
3546
3565
  private http;
3547
3566
  constructor(http: HttpClient);
3548
3567
  /**
3549
- * Request a one-time token for a partner key (end-user JWKS auth).
3568
+ * Generate a one-time token for the authenticated end-user.
3569
+ *
3570
+ * Requires: tenant API key (X-API-Key) + end-user JWT (Authorization: Bearer).
3571
+ * The SDK must be initialised with both `apiKey` and `userToken`.
3572
+ *
3573
+ * @param options.ttl - Token lifetime in seconds (30–3600, default 300)
3574
+ * @param options.session_data_keys - Whitelist of JWT claims to include
3575
+ */
3576
+ generate(options?: OTTGenerateRequest): Promise<OTTGenerateResponse>;
3577
+ /**
3578
+ * Redeem a one-time token to get the user's identity.
3579
+ *
3580
+ * Requires: integrator API key (X-API-Key). The token is single-use
3581
+ * and deleted on successful redemption.
3582
+ *
3583
+ * @param ott - The opaque one-time token
3550
3584
  */
3551
- requestOTT(keyId: string): Promise<OTTRequestResponse>;
3585
+ redeem(ott: string): Promise<OTTRedeemResponse>;
3552
3586
  /**
3553
- * Update OTT configuration for a partner key.
3587
+ * Update OTT configuration for a partner key (tenant admin).
3554
3588
  */
3555
3589
  updateOTTConfig(keyId: string, config: OTTConfigUpdate): Promise<OTTConfigResponse>;
3556
3590
  /**
3557
- * Get OTT configuration for a partner key.
3591
+ * Get OTT configuration for a partner key (tenant admin).
3558
3592
  */
3559
3593
  getOTTConfig(keyId: string): Promise<OTTConfigResponse>;
3594
+ /** @deprecated Use generate() */
3595
+ requestOTT(_keyId: string): Promise<OTTGenerateResponse>;
3596
+ }
3597
+
3598
+ /**
3599
+ * Attestations API Client
3600
+ *
3601
+ * Manage on-chain and off-chain attestations — EIP-712 signed credentials
3602
+ * issued to users' smart wallet addresses.
3603
+ *
3604
+ * Includes public credential discovery endpoints that require no authentication.
3605
+ */
3606
+
3607
+ interface AttestationSchema {
3608
+ id: string;
3609
+ name: string;
3610
+ slug: string;
3611
+ description?: string;
3612
+ attestation_type: string;
3613
+ schema_definition: Record<string, any>;
3614
+ revocable: boolean;
3615
+ default_expiry_days?: number;
3616
+ icon?: string;
3617
+ color?: string;
3618
+ version: number;
3619
+ is_active: boolean;
3620
+ created_at: string;
3621
+ }
3622
+ interface Attestation {
3623
+ id: string;
3624
+ uid: string;
3625
+ tenant_id: string;
3626
+ schema_id: string;
3627
+ attester_address: string;
3628
+ attester_type: string;
3629
+ subject_address: string;
3630
+ subject_user_id?: string;
3631
+ data: Record<string, any>;
3632
+ ref_type?: string;
3633
+ ref_id?: string;
3634
+ signature?: string;
3635
+ signature_type?: string;
3636
+ status: string;
3637
+ expires_at?: string;
3638
+ revoked_at?: string;
3639
+ revocation_reason?: string;
3640
+ tx_hash?: string;
3641
+ block_number?: number;
3642
+ ipfs_hash?: string;
3643
+ created_at: string;
3644
+ }
3645
+ interface WalletCredential {
3646
+ uid: string;
3647
+ attestation_type?: string;
3648
+ issuer_name?: string;
3649
+ issuer_client_id?: string;
3650
+ subject_address: string;
3651
+ data: Record<string, any>;
3652
+ signature?: string;
3653
+ signature_type?: string;
3654
+ status: string;
3655
+ tx_hash?: string;
3656
+ expires_at?: string;
3657
+ created_at: string;
3658
+ }
3659
+ interface WalletCredentialVerifySummary {
3660
+ wallet_address: string;
3661
+ total_credentials: number;
3662
+ credential_types: Record<string, number>;
3663
+ latest_scores: Record<string, any>;
3664
+ is_verified: boolean;
3665
+ }
3666
+ interface AttestationConfig {
3667
+ id: string;
3668
+ tenant_id: string;
3669
+ auto_attest_passports: boolean;
3670
+ auto_attest_cohort_scores: boolean;
3671
+ attest_on_score_change: boolean;
3672
+ min_score_change_threshold: number;
3673
+ anchor_attestations: boolean;
3674
+ reward_anchoring_mode: string;
3675
+ public_attestations: boolean;
3676
+ }
3677
+ interface CreateAttestationRequest {
3678
+ schema_id: string;
3679
+ subject_address: string;
3680
+ data: Record<string, any>;
3681
+ subject_user_id?: string;
3682
+ ref_type?: string;
3683
+ ref_id?: string;
3684
+ expires_at?: string;
3685
+ }
3686
+ interface ListAttestationsOptions {
3687
+ attestation_type?: string;
3688
+ status?: string;
3689
+ limit?: number;
3690
+ }
3691
+ interface ListWalletCredentialsOptions {
3692
+ attestation_type?: string;
3693
+ limit?: number;
3694
+ offset?: number;
3695
+ }
3696
+ interface UpdateConfigRequest {
3697
+ attest_on_score_change?: boolean;
3698
+ min_score_change_threshold?: number;
3699
+ anchor_attestations?: boolean;
3700
+ reward_anchoring_mode?: string;
3701
+ auto_attest_cohort_scores?: boolean;
3702
+ public_attestations?: boolean;
3703
+ }
3704
+ declare class AttestationsClient {
3705
+ private http;
3706
+ constructor(http: HttpClient);
3707
+ /**
3708
+ * List attestation schemas for the tenant
3709
+ */
3710
+ listSchemas(options?: {
3711
+ attestation_type?: string;
3712
+ }): Promise<AttestationSchema[]>;
3713
+ /**
3714
+ * Get a specific schema
3715
+ */
3716
+ getSchema(schemaId: string): Promise<AttestationSchema>;
3717
+ /**
3718
+ * Create a new attestation. The attestation will be EIP-712 signed
3719
+ * by the tenant's treasury wallet.
3720
+ */
3721
+ create(request: CreateAttestationRequest): Promise<Attestation>;
3722
+ /**
3723
+ * List attestations created by the tenant
3724
+ */
3725
+ list(options?: ListAttestationsOptions): Promise<Attestation[]>;
3726
+ /**
3727
+ * List attestations for a specific subject wallet within the tenant
3728
+ */
3729
+ listBySubject(subjectAddress: string, options?: ListAttestationsOptions): Promise<Attestation[]>;
3730
+ /**
3731
+ * Get a specific attestation by ID
3732
+ */
3733
+ get(attestationId: string): Promise<Attestation>;
3734
+ /**
3735
+ * Revoke an attestation
3736
+ */
3737
+ revoke(attestationId: string, reason?: string): Promise<Attestation>;
3738
+ /**
3739
+ * Anchor an attestation on-chain (requires anchor_attestations enabled)
3740
+ */
3741
+ anchor(attestationId: string): Promise<Attestation>;
3742
+ /**
3743
+ * Get the tenant's attestation configuration
3744
+ */
3745
+ getConfig(): Promise<AttestationConfig>;
3746
+ /**
3747
+ * Update the tenant's attestation configuration
3748
+ */
3749
+ updateConfig(request: UpdateConfigRequest): Promise<AttestationConfig>;
3750
+ /**
3751
+ * List all valid credentials held by a wallet address.
3752
+ * This is a public endpoint — no authentication required.
3753
+ */
3754
+ getWalletCredentials(walletAddress: string, options?: ListWalletCredentialsOptions): Promise<WalletCredential[]>;
3755
+ /**
3756
+ * Get a specific credential by wallet address and attestation UID.
3757
+ * This is a public endpoint — no authentication required.
3758
+ */
3759
+ getWalletCredential(walletAddress: string, attestationUid: string): Promise<WalletCredential>;
3760
+ /**
3761
+ * Get an aggregate verification summary for a wallet's credentials.
3762
+ * Returns credential counts by type and latest score values.
3763
+ * This is a public endpoint — no authentication required.
3764
+ */
3765
+ verifyWalletCredentials(walletAddress: string): Promise<WalletCredentialVerifySummary>;
3560
3766
  }
3561
3767
 
3562
3768
  /**
@@ -3761,6 +3967,8 @@ declare class ProofChain {
3761
3967
  nft: NftClient;
3762
3968
  /** Partner Keys client for OTT auth operations */
3763
3969
  partnerKeys: PartnerKeysClient;
3970
+ /** Attestations client for EIP-712 signed credentials and public discovery */
3971
+ attestations: AttestationsClient;
3764
3972
  constructor(options: ProofChainOptions);
3765
3973
  /**
3766
3974
  * Create a client for end-user JWT authentication (PWA/frontend use).
@@ -3978,4 +4186,4 @@ declare class TimeoutError extends ProofChainError {
3978
4186
  constructor(message?: string);
3979
4187
  }
3980
4188
 
3981
- export { type Achievement, type ActivitySummaryView, type AddNFTRequest, type AnchorResult, type ApiKey, type AttestRequest, type AttestationMode, type AttestationResult, AuthenticationError, AuthorizationError, type AvailableView, type Badge, type BatchIngestRequest, type BatchIngestResponse, type BatchVerifyResult, type BlockchainProof, type BlockchainStats, type Certificate, type CertificateVerifyResult, CertificatesResource, type Channel, type ChannelState, type ChannelStatus, ChannelsResource, type ClaimNFTResult, type ClaimRewardResult, type CohortDefinition, type CohortGroupStats, CohortLeaderboardClient, type CohortLeaderboardEntry, type CohortLeaderboardOptions, type CohortLeaderboardResponse, type ComprehensiveWalletInfo, type CreateAchievementRequest, type CreateApiKeyRequest, type CreateBadgeRequest, type CreateChannelRequest, type CreateCredentialTypeRequest, type CreateDataViewRequest, type CreateDualWalletsRequest, type CreateEndUserRequest, type CreateEventRequest, type CreatePassportDefinitionRequest, type CreatePassportRequest, type CreateQuestRequest, type CreateQuestStepRequest, type CreateRewardDefinitionRequest, type CreateSchemaRequest, type CreateTemplateFieldRequest, type CreateTemplateRequest, type CreateWalletRequest as CreateUserWalletRequest, type CreateWalletRequest$1 as CreateWalletRequest, type CreateWebhookRequest, type CredentialType, type CredentialVerifyResult, CredentialsClient, type DataViewColumn, type DataViewComputation, type DataViewDetail, type DataViewExecuteResult, type DataViewInfo, type DataViewListResponse, type DataViewPreviewRequest, type DataViewPreviewResult, type DataViewSummary, DataViewsClient, type DistributeResult, DocumentsResource, type DualWallets, type EarnedReward, type EndUser, EndUserIngestionClient, type EndUserIngestionClientOptions, type EndUserListResponse, EndUsersClient, type Event, type EventBatchProof, type EventMetadata, type EventStatus, EventsResource, type ExecuteSwapRequest, type Facet, type FacetsResponse, type FanProfileView, type FanpassGroupStats, FanpassLeaderboardClient, type FanpassLeaderboardEntry, type FanpassLeaderboardOptions, type FanpassLeaderboardResponse, type FanpassUserComparisonResponse, type FieldValue, type GDPRDeletionRequest, type GDPRDeletionResponse, type GDPRPreviewResponse, type IngestEventRequest, type IngestEventResponse, IngestionClient, type IngestionClientOptions, type IssueCertificateRequest, type IssueCredentialRequest, type IssuedCredential, type LeaderboardUserProfile$1 as LeaderboardUserProfile, type LinkWalletRequest, type ListCertificatesRequest, type ListCohortsOptions, type ListEndUsersOptions, type ListEventsRequest, type ListIssuedCredentialsOptions, type ListMintsOptions, type ListMintsResponse, type ListQuestsOptions, type ListRewardsOptions, type ListSchemasOptions, type ManualRewardRequest, type MergeUsersRequest, type Milestone, type MintNFTRequest, type NFT, type NFTMint, NetworkError, NftClient, NotFoundError, type NotificationCallback, type NotificationEvent, type NotificationEventType, NotificationsClient, type OTTConfigResponse, type OTTConfigUpdate, type OTTRequestResponse, PartnerKeysClient, type Passport, PassportClient, type PassportDefinition, type PassportFieldValue, type PassportHistory, type PassportTemplate, type PassportV2Data, type PassportWithFields, ProofChain, ProofChainError, type ProofChainOptions, type ProofVerifyResult, type PushSubscriptionJSON, type Quest, type QuestStep, type QuestWithProgress, QuestsClient, RateLimitError, type RegisterWalletRequest, type RevokeResult, type RewardAsset, type RewardAttestationResult, type RewardDefinition, type RewardEarned, type VerifyResult as RewardVerifyResult, RewardsClient, type Schema, type SchemaDetail, type SchemaField, type SchemaListResponse, type ValidationError$1 as SchemaValidationError, SchemasClient, type SearchFilters, type SearchQueryRequest, type SearchRequest, SearchResource, type SearchResponse, type SearchResult, type SearchStats, ServerError, type SetProfileRequest, type Settlement, type StepCompletionResult, type StepProgress, type StepStartResult, type StreamAck, type StreamEventRequest, type SubscribeOptions, type SwapQuote, type SwapQuoteRequest, type SwapResult, type TemplateField, type TenantInfo, TenantResource, type TierDefinition, TimeoutError, type TokenBalance, type TransferRequest, type TransferResult, type Unsubscribe, type UpdateDataViewRequest, type UpdateEndUserRequest, type UpdatePassportRequest, type UpdateWebhookRequest, type UsageStats, type UserAchievement, type UserActivity, type UserActivityResponse, type UserBadge, type UserBreakdownResponse, type UserCohortBreakdownEntry, type UserCredentialsSummary, type UserQuestProgress, type UserReward$1 as UserReward, type UserRewardsResponse, type UserWalletSummary, type UserWithWallets, type UsersWithWalletsResponse, type ValidateDataRequest, ValidationError, type ValidationErrorDetail, type ValidationResult, type VaultFile, type VaultFolder, type VaultListResponse, VaultResource, type VaultStats, type VaultUploadRequest, type VerificationResult, VerifyResource, type ViewColumn, type ViewTemplate, type Wallet, type WalletBalance, WalletClient, type WalletCreationResult, type WalletStats, type Webhook, WebhooksResource };
4189
+ export { type Achievement, type ActivitySummaryView, type AddNFTRequest, type AnchorResult, type ApiKey, type AttestRequest, type AttestationConfig, type AttestationMode, type Attestation as AttestationRecord, type AttestationResult, type AttestationSchema, AttestationsClient, AuthenticationError, AuthorizationError, type AvailableView, type Badge, type BatchIngestRequest, type BatchIngestResponse, type BatchVerifyResult, type BlockchainProof, type BlockchainStats, type Certificate, type CertificateVerifyResult, CertificatesResource, type Channel, type ChannelState, type ChannelStatus, ChannelsResource, type ClaimNFTResult, type ClaimRewardResult, type CohortDefinition, type CohortGroupStats, CohortLeaderboardClient, type CohortLeaderboardEntry, type CohortLeaderboardOptions, type CohortLeaderboardResponse, type ComprehensiveWalletInfo, type CreateAchievementRequest, type CreateApiKeyRequest, type CreateAttestationRequest, type CreateBadgeRequest, type CreateChannelRequest, type CreateCredentialTypeRequest, type CreateDataViewRequest, type CreateDualWalletsRequest, type CreateEndUserRequest, type CreateEventRequest, type CreatePassportDefinitionRequest, type CreatePassportRequest, type CreateQuestRequest, type CreateQuestStepRequest, type CreateRewardDefinitionRequest, type CreateSchemaRequest, type CreateTemplateFieldRequest, type CreateTemplateRequest, type CreateWalletRequest as CreateUserWalletRequest, type CreateWalletRequest$1 as CreateWalletRequest, type CreateWebhookRequest, type CredentialType, type CredentialVerifyResult, CredentialsClient, type DataViewColumn, type DataViewComputation, type DataViewDetail, type DataViewExecuteResult, type DataViewInfo, type DataViewListResponse, type DataViewPreviewRequest, type DataViewPreviewResult, type DataViewSummary, DataViewsClient, type DistributeResult, DocumentsResource, type DualWallets, type EarnedReward, type EndUser, EndUserIngestionClient, type EndUserIngestionClientOptions, type EndUserListResponse, EndUsersClient, type Event, type EventBatchProof, type EventMetadata, type EventStatus, EventsResource, type ExecuteSwapRequest, type Facet, type FacetsResponse, type FanProfileView, type FanpassGroupStats, FanpassLeaderboardClient, type FanpassLeaderboardEntry, type FanpassLeaderboardOptions, type FanpassLeaderboardResponse, type FanpassUserComparisonResponse, type FieldValue, type GDPRDeletionRequest, type GDPRDeletionResponse, type GDPRPreviewResponse, type IngestEventRequest, type IngestEventResponse, IngestionClient, type IngestionClientOptions, type IssueCertificateRequest, type IssueCredentialRequest, type IssuedCredential, type LeaderboardUserProfile$1 as LeaderboardUserProfile, type LinkWalletRequest, type ListAttestationsOptions, type ListCertificatesRequest, type ListCohortsOptions, type ListEndUsersOptions, type ListEventsRequest, type ListIssuedCredentialsOptions, type ListMintsOptions, type ListMintsResponse, type ListQuestsOptions, type ListRewardsOptions, type ListSchemasOptions, type ListWalletCredentialsOptions, type ManualRewardRequest, type MergeUsersRequest, type Milestone, type MintNFTRequest, type NFT, type NFTMint, NetworkError, NftClient, NotFoundError, type NotificationCallback, type NotificationEvent, type NotificationEventType, NotificationsClient, type OTTConfigResponse, type OTTConfigUpdate, type OTTGenerateRequest, type OTTGenerateResponse, type OTTRedeemResponse, type OTTRequestResponse, PartnerKeysClient, type Passport, PassportClient, type PassportDefinition, type PassportFieldValue, type PassportHistory, type PassportTemplate, type PassportV2Data, type PassportWithFields, ProofChain, ProofChainError, type ProofChainOptions, type ProofVerifyResult, type PushSubscriptionJSON, type Quest, type QuestStep, type QuestWithProgress, QuestsClient, RateLimitError, type RegisterWalletRequest, type RevokeResult, type RewardAsset, type RewardAttestationResult, type RewardDefinition, type RewardEarned, type VerifyResult as RewardVerifyResult, RewardsClient, type Schema, type SchemaDetail, type SchemaField, type SchemaListResponse, type ValidationError$1 as SchemaValidationError, SchemasClient, type SearchFilters, type SearchQueryRequest, type SearchRequest, SearchResource, type SearchResponse, type SearchResult, type SearchStats, ServerError, type SetProfileRequest, type Settlement, type StepCompletionResult, type StepProgress, type StepStartResult, type StreamAck, type StreamEventRequest, type SubscribeOptions, type SwapQuote, type SwapQuoteRequest, type SwapResult, type TemplateField, type TenantInfo, TenantResource, type TierDefinition, TimeoutError, type TokenBalance, type TransferRequest, type TransferResult, type Unsubscribe, type UpdateConfigRequest as UpdateAttestationConfigRequest, type UpdateDataViewRequest, type UpdateEndUserRequest, type UpdatePassportRequest, type UpdateWebhookRequest, type UsageStats, type UserAchievement, type UserActivity, type UserActivityResponse, type UserBadge, type UserBreakdownResponse, type UserCohortBreakdownEntry, type UserCredentialsSummary, type UserQuestProgress, type UserReward$1 as UserReward, type UserRewardsResponse, type UserWalletSummary, type UserWithWallets, type UsersWithWalletsResponse, type ValidateDataRequest, ValidationError, type ValidationErrorDetail, type ValidationResult, type VaultFile, type VaultFolder, type VaultListResponse, VaultResource, type VaultStats, type VaultUploadRequest, type VerificationResult, VerifyResource, type ViewColumn, type ViewTemplate, type Wallet, type WalletBalance, WalletClient, type WalletCreationResult, type WalletCredential, type WalletCredentialVerifySummary, type WalletStats, type Webhook, WebhooksResource };
package/dist/index.js CHANGED
@@ -20,6 +20,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  // src/index.ts
21
21
  var index_exports = {};
22
22
  __export(index_exports, {
23
+ AttestationsClient: () => AttestationsClient,
23
24
  AuthenticationError: () => AuthenticationError,
24
25
  AuthorizationError: () => AuthorizationError,
25
26
  CertificatesResource: () => CertificatesResource,
@@ -136,13 +137,14 @@ var HttpClient = class {
136
137
  "Content-Type": "application/json",
137
138
  "User-Agent": USER_AGENT
138
139
  };
140
+ if (this.apiKey) {
141
+ headers["X-API-Key"] = this.apiKey;
142
+ }
139
143
  if (this.userToken) {
140
144
  headers["Authorization"] = `Bearer ${this.userToken}`;
141
145
  if (this.tenantId) {
142
146
  headers["X-Tenant-ID"] = this.tenantId;
143
147
  }
144
- } else if (this.apiKey) {
145
- headers["X-API-Key"] = this.apiKey;
146
148
  }
147
149
  return headers;
148
150
  }
@@ -238,13 +240,14 @@ var HttpClient = class {
238
240
  const headers = {
239
241
  "User-Agent": USER_AGENT
240
242
  };
243
+ if (this.apiKey) {
244
+ headers["X-API-Key"] = this.apiKey;
245
+ }
241
246
  if (this.userToken) {
242
247
  headers["Authorization"] = `Bearer ${this.userToken}`;
243
248
  if (this.tenantId) {
244
249
  headers["X-Tenant-ID"] = this.tenantId;
245
250
  }
246
- } else if (this.apiKey) {
247
- headers["X-API-Key"] = this.apiKey;
248
251
  }
249
252
  return this.fetchWithRetry(url, {
250
253
  method: "POST",
@@ -2710,23 +2713,177 @@ var PartnerKeysClient = class {
2710
2713
  this.http = http;
2711
2714
  }
2712
2715
  /**
2713
- * Request a one-time token for a partner key (end-user JWKS auth).
2716
+ * Generate a one-time token for the authenticated end-user.
2717
+ *
2718
+ * Requires: tenant API key (X-API-Key) + end-user JWT (Authorization: Bearer).
2719
+ * The SDK must be initialised with both `apiKey` and `userToken`.
2720
+ *
2721
+ * @param options.ttl - Token lifetime in seconds (30–3600, default 300)
2722
+ * @param options.session_data_keys - Whitelist of JWT claims to include
2714
2723
  */
2715
- async requestOTT(keyId) {
2716
- return this.http.post(`/partner-keys/${keyId}/ott/request`);
2724
+ async generate(options) {
2725
+ return this.http.post("/partner-keys/generate", options ?? {});
2717
2726
  }
2718
2727
  /**
2719
- * Update OTT configuration for a partner key.
2728
+ * Redeem a one-time token to get the user's identity.
2729
+ *
2730
+ * Requires: integrator API key (X-API-Key). The token is single-use
2731
+ * and deleted on successful redemption.
2732
+ *
2733
+ * @param ott - The opaque one-time token
2734
+ */
2735
+ async redeem(ott) {
2736
+ return this.http.post("/partner-keys/redeem", { ott });
2737
+ }
2738
+ /**
2739
+ * Update OTT configuration for a partner key (tenant admin).
2720
2740
  */
2721
2741
  async updateOTTConfig(keyId, config) {
2722
2742
  return this.http.patch(`/partner-keys/${keyId}/ott-config`, config);
2723
2743
  }
2724
2744
  /**
2725
- * Get OTT configuration for a partner key.
2745
+ * Get OTT configuration for a partner key (tenant admin).
2726
2746
  */
2727
2747
  async getOTTConfig(keyId) {
2728
2748
  return this.http.get(`/partner-keys/${keyId}/ott-config`);
2729
2749
  }
2750
+ /** @deprecated Use generate() */
2751
+ async requestOTT(_keyId) {
2752
+ return this.generate();
2753
+ }
2754
+ };
2755
+
2756
+ // src/attestations.ts
2757
+ var AttestationsClient = class {
2758
+ constructor(http) {
2759
+ this.http = http;
2760
+ }
2761
+ // ---------------------------------------------------------------------------
2762
+ // Schemas
2763
+ // ---------------------------------------------------------------------------
2764
+ /**
2765
+ * List attestation schemas for the tenant
2766
+ */
2767
+ async listSchemas(options) {
2768
+ return this.http.get("/attestations/schemas", {
2769
+ attestation_type: options?.attestation_type
2770
+ });
2771
+ }
2772
+ /**
2773
+ * Get a specific schema
2774
+ */
2775
+ async getSchema(schemaId) {
2776
+ return this.http.get(`/attestations/schemas/${schemaId}`);
2777
+ }
2778
+ // ---------------------------------------------------------------------------
2779
+ // Attestation Management (authenticated)
2780
+ // ---------------------------------------------------------------------------
2781
+ /**
2782
+ * Create a new attestation. The attestation will be EIP-712 signed
2783
+ * by the tenant's treasury wallet.
2784
+ */
2785
+ async create(request) {
2786
+ return this.http.post("/attestations", request);
2787
+ }
2788
+ /**
2789
+ * List attestations created by the tenant
2790
+ */
2791
+ async list(options) {
2792
+ return this.http.get("/attestations", {
2793
+ attestation_type: options?.attestation_type,
2794
+ status: options?.status,
2795
+ limit: options?.limit
2796
+ });
2797
+ }
2798
+ /**
2799
+ * List attestations for a specific subject wallet within the tenant
2800
+ */
2801
+ async listBySubject(subjectAddress, options) {
2802
+ return this.http.get(
2803
+ `/attestations/by-subject/${subjectAddress}`,
2804
+ {
2805
+ attestation_type: options?.attestation_type,
2806
+ status: options?.status,
2807
+ limit: options?.limit
2808
+ }
2809
+ );
2810
+ }
2811
+ /**
2812
+ * Get a specific attestation by ID
2813
+ */
2814
+ async get(attestationId) {
2815
+ return this.http.get(`/attestations/${attestationId}`);
2816
+ }
2817
+ /**
2818
+ * Revoke an attestation
2819
+ */
2820
+ async revoke(attestationId, reason) {
2821
+ const params = reason ? `?reason=${encodeURIComponent(reason)}` : "";
2822
+ return this.http.post(
2823
+ `/attestations/${attestationId}/revoke${params}`,
2824
+ {}
2825
+ );
2826
+ }
2827
+ /**
2828
+ * Anchor an attestation on-chain (requires anchor_attestations enabled)
2829
+ */
2830
+ async anchor(attestationId) {
2831
+ return this.http.post(
2832
+ `/attestations/${attestationId}/anchor`,
2833
+ {}
2834
+ );
2835
+ }
2836
+ // ---------------------------------------------------------------------------
2837
+ // Configuration
2838
+ // ---------------------------------------------------------------------------
2839
+ /**
2840
+ * Get the tenant's attestation configuration
2841
+ */
2842
+ async getConfig() {
2843
+ return this.http.get("/attestations/config");
2844
+ }
2845
+ /**
2846
+ * Update the tenant's attestation configuration
2847
+ */
2848
+ async updateConfig(request) {
2849
+ return this.http.put("/attestations/config", request);
2850
+ }
2851
+ // ---------------------------------------------------------------------------
2852
+ // Public Credential Discovery (no auth required)
2853
+ // ---------------------------------------------------------------------------
2854
+ /**
2855
+ * List all valid credentials held by a wallet address.
2856
+ * This is a public endpoint — no authentication required.
2857
+ */
2858
+ async getWalletCredentials(walletAddress, options) {
2859
+ return this.http.get(
2860
+ `/public/credentials/${walletAddress}`,
2861
+ {
2862
+ attestation_type: options?.attestation_type,
2863
+ limit: options?.limit,
2864
+ offset: options?.offset
2865
+ }
2866
+ );
2867
+ }
2868
+ /**
2869
+ * Get a specific credential by wallet address and attestation UID.
2870
+ * This is a public endpoint — no authentication required.
2871
+ */
2872
+ async getWalletCredential(walletAddress, attestationUid) {
2873
+ return this.http.get(
2874
+ `/public/credentials/${walletAddress}/${attestationUid}`
2875
+ );
2876
+ }
2877
+ /**
2878
+ * Get an aggregate verification summary for a wallet's credentials.
2879
+ * Returns credential counts by type and latest score values.
2880
+ * This is a public endpoint — no authentication required.
2881
+ */
2882
+ async verifyWalletCredentials(walletAddress) {
2883
+ return this.http.get(
2884
+ `/public/credentials/${walletAddress}/verify`
2885
+ );
2886
+ }
2730
2887
  };
2731
2888
 
2732
2889
  // src/client.ts
@@ -3030,6 +3187,7 @@ var ProofChain = class _ProofChain {
3030
3187
  this.credentials = new CredentialsClient(this.http);
3031
3188
  this.nft = new NftClient(this.http);
3032
3189
  this.partnerKeys = new PartnerKeysClient(this.http);
3190
+ this.attestations = new AttestationsClient(this.http);
3033
3191
  }
3034
3192
  /**
3035
3193
  * Create a client for end-user JWT authentication (PWA/frontend use).
@@ -3371,6 +3529,7 @@ var EndUserIngestionClient = class {
3371
3529
  };
3372
3530
  // Annotate the CommonJS export names for ESM import in node:
3373
3531
  0 && (module.exports = {
3532
+ AttestationsClient,
3374
3533
  AuthenticationError,
3375
3534
  AuthorizationError,
3376
3535
  CertificatesResource,
package/dist/index.mjs CHANGED
@@ -77,13 +77,14 @@ var HttpClient = class {
77
77
  "Content-Type": "application/json",
78
78
  "User-Agent": USER_AGENT
79
79
  };
80
+ if (this.apiKey) {
81
+ headers["X-API-Key"] = this.apiKey;
82
+ }
80
83
  if (this.userToken) {
81
84
  headers["Authorization"] = `Bearer ${this.userToken}`;
82
85
  if (this.tenantId) {
83
86
  headers["X-Tenant-ID"] = this.tenantId;
84
87
  }
85
- } else if (this.apiKey) {
86
- headers["X-API-Key"] = this.apiKey;
87
88
  }
88
89
  return headers;
89
90
  }
@@ -179,13 +180,14 @@ var HttpClient = class {
179
180
  const headers = {
180
181
  "User-Agent": USER_AGENT
181
182
  };
183
+ if (this.apiKey) {
184
+ headers["X-API-Key"] = this.apiKey;
185
+ }
182
186
  if (this.userToken) {
183
187
  headers["Authorization"] = `Bearer ${this.userToken}`;
184
188
  if (this.tenantId) {
185
189
  headers["X-Tenant-ID"] = this.tenantId;
186
190
  }
187
- } else if (this.apiKey) {
188
- headers["X-API-Key"] = this.apiKey;
189
191
  }
190
192
  return this.fetchWithRetry(url, {
191
193
  method: "POST",
@@ -2651,23 +2653,177 @@ var PartnerKeysClient = class {
2651
2653
  this.http = http;
2652
2654
  }
2653
2655
  /**
2654
- * Request a one-time token for a partner key (end-user JWKS auth).
2656
+ * Generate a one-time token for the authenticated end-user.
2657
+ *
2658
+ * Requires: tenant API key (X-API-Key) + end-user JWT (Authorization: Bearer).
2659
+ * The SDK must be initialised with both `apiKey` and `userToken`.
2660
+ *
2661
+ * @param options.ttl - Token lifetime in seconds (30–3600, default 300)
2662
+ * @param options.session_data_keys - Whitelist of JWT claims to include
2655
2663
  */
2656
- async requestOTT(keyId) {
2657
- return this.http.post(`/partner-keys/${keyId}/ott/request`);
2664
+ async generate(options) {
2665
+ return this.http.post("/partner-keys/generate", options ?? {});
2658
2666
  }
2659
2667
  /**
2660
- * Update OTT configuration for a partner key.
2668
+ * Redeem a one-time token to get the user's identity.
2669
+ *
2670
+ * Requires: integrator API key (X-API-Key). The token is single-use
2671
+ * and deleted on successful redemption.
2672
+ *
2673
+ * @param ott - The opaque one-time token
2674
+ */
2675
+ async redeem(ott) {
2676
+ return this.http.post("/partner-keys/redeem", { ott });
2677
+ }
2678
+ /**
2679
+ * Update OTT configuration for a partner key (tenant admin).
2661
2680
  */
2662
2681
  async updateOTTConfig(keyId, config) {
2663
2682
  return this.http.patch(`/partner-keys/${keyId}/ott-config`, config);
2664
2683
  }
2665
2684
  /**
2666
- * Get OTT configuration for a partner key.
2685
+ * Get OTT configuration for a partner key (tenant admin).
2667
2686
  */
2668
2687
  async getOTTConfig(keyId) {
2669
2688
  return this.http.get(`/partner-keys/${keyId}/ott-config`);
2670
2689
  }
2690
+ /** @deprecated Use generate() */
2691
+ async requestOTT(_keyId) {
2692
+ return this.generate();
2693
+ }
2694
+ };
2695
+
2696
+ // src/attestations.ts
2697
+ var AttestationsClient = class {
2698
+ constructor(http) {
2699
+ this.http = http;
2700
+ }
2701
+ // ---------------------------------------------------------------------------
2702
+ // Schemas
2703
+ // ---------------------------------------------------------------------------
2704
+ /**
2705
+ * List attestation schemas for the tenant
2706
+ */
2707
+ async listSchemas(options) {
2708
+ return this.http.get("/attestations/schemas", {
2709
+ attestation_type: options?.attestation_type
2710
+ });
2711
+ }
2712
+ /**
2713
+ * Get a specific schema
2714
+ */
2715
+ async getSchema(schemaId) {
2716
+ return this.http.get(`/attestations/schemas/${schemaId}`);
2717
+ }
2718
+ // ---------------------------------------------------------------------------
2719
+ // Attestation Management (authenticated)
2720
+ // ---------------------------------------------------------------------------
2721
+ /**
2722
+ * Create a new attestation. The attestation will be EIP-712 signed
2723
+ * by the tenant's treasury wallet.
2724
+ */
2725
+ async create(request) {
2726
+ return this.http.post("/attestations", request);
2727
+ }
2728
+ /**
2729
+ * List attestations created by the tenant
2730
+ */
2731
+ async list(options) {
2732
+ return this.http.get("/attestations", {
2733
+ attestation_type: options?.attestation_type,
2734
+ status: options?.status,
2735
+ limit: options?.limit
2736
+ });
2737
+ }
2738
+ /**
2739
+ * List attestations for a specific subject wallet within the tenant
2740
+ */
2741
+ async listBySubject(subjectAddress, options) {
2742
+ return this.http.get(
2743
+ `/attestations/by-subject/${subjectAddress}`,
2744
+ {
2745
+ attestation_type: options?.attestation_type,
2746
+ status: options?.status,
2747
+ limit: options?.limit
2748
+ }
2749
+ );
2750
+ }
2751
+ /**
2752
+ * Get a specific attestation by ID
2753
+ */
2754
+ async get(attestationId) {
2755
+ return this.http.get(`/attestations/${attestationId}`);
2756
+ }
2757
+ /**
2758
+ * Revoke an attestation
2759
+ */
2760
+ async revoke(attestationId, reason) {
2761
+ const params = reason ? `?reason=${encodeURIComponent(reason)}` : "";
2762
+ return this.http.post(
2763
+ `/attestations/${attestationId}/revoke${params}`,
2764
+ {}
2765
+ );
2766
+ }
2767
+ /**
2768
+ * Anchor an attestation on-chain (requires anchor_attestations enabled)
2769
+ */
2770
+ async anchor(attestationId) {
2771
+ return this.http.post(
2772
+ `/attestations/${attestationId}/anchor`,
2773
+ {}
2774
+ );
2775
+ }
2776
+ // ---------------------------------------------------------------------------
2777
+ // Configuration
2778
+ // ---------------------------------------------------------------------------
2779
+ /**
2780
+ * Get the tenant's attestation configuration
2781
+ */
2782
+ async getConfig() {
2783
+ return this.http.get("/attestations/config");
2784
+ }
2785
+ /**
2786
+ * Update the tenant's attestation configuration
2787
+ */
2788
+ async updateConfig(request) {
2789
+ return this.http.put("/attestations/config", request);
2790
+ }
2791
+ // ---------------------------------------------------------------------------
2792
+ // Public Credential Discovery (no auth required)
2793
+ // ---------------------------------------------------------------------------
2794
+ /**
2795
+ * List all valid credentials held by a wallet address.
2796
+ * This is a public endpoint — no authentication required.
2797
+ */
2798
+ async getWalletCredentials(walletAddress, options) {
2799
+ return this.http.get(
2800
+ `/public/credentials/${walletAddress}`,
2801
+ {
2802
+ attestation_type: options?.attestation_type,
2803
+ limit: options?.limit,
2804
+ offset: options?.offset
2805
+ }
2806
+ );
2807
+ }
2808
+ /**
2809
+ * Get a specific credential by wallet address and attestation UID.
2810
+ * This is a public endpoint — no authentication required.
2811
+ */
2812
+ async getWalletCredential(walletAddress, attestationUid) {
2813
+ return this.http.get(
2814
+ `/public/credentials/${walletAddress}/${attestationUid}`
2815
+ );
2816
+ }
2817
+ /**
2818
+ * Get an aggregate verification summary for a wallet's credentials.
2819
+ * Returns credential counts by type and latest score values.
2820
+ * This is a public endpoint — no authentication required.
2821
+ */
2822
+ async verifyWalletCredentials(walletAddress) {
2823
+ return this.http.get(
2824
+ `/public/credentials/${walletAddress}/verify`
2825
+ );
2826
+ }
2671
2827
  };
2672
2828
 
2673
2829
  // src/client.ts
@@ -2971,6 +3127,7 @@ var ProofChain = class _ProofChain {
2971
3127
  this.credentials = new CredentialsClient(this.http);
2972
3128
  this.nft = new NftClient(this.http);
2973
3129
  this.partnerKeys = new PartnerKeysClient(this.http);
3130
+ this.attestations = new AttestationsClient(this.http);
2974
3131
  }
2975
3132
  /**
2976
3133
  * Create a client for end-user JWT authentication (PWA/frontend use).
@@ -3311,6 +3468,7 @@ var EndUserIngestionClient = class {
3311
3468
  }
3312
3469
  };
3313
3470
  export {
3471
+ AttestationsClient,
3314
3472
  AuthenticationError,
3315
3473
  AuthorizationError,
3316
3474
  CertificatesResource,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@proofchain/sdk",
3
- "version": "2.21.1",
3
+ "version": "2.23.0",
4
4
  "description": "Official JavaScript/TypeScript SDK for ProofChain - blockchain-anchored document attestation",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",