@grantex/sdk 0.3.13 → 0.4.1
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/README.md +108 -3
- package/dist/http.js +1 -1
- package/dist/http.js.map +1 -1
- package/dist/index.d.ts +4 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -1
- package/dist/index.js.map +1 -1
- package/dist/oauth-agent.d.ts +71 -0
- package/dist/oauth-agent.d.ts.map +1 -0
- package/dist/oauth-agent.js +359 -0
- package/dist/oauth-agent.js.map +1 -0
- package/dist/prepaid-wallets.d.ts +179 -0
- package/dist/prepaid-wallets.d.ts.map +1 -0
- package/dist/prepaid-wallets.js +127 -0
- package/dist/prepaid-wallets.js.map +1 -0
- package/dist/resources/audit.d.ts +2 -1
- package/dist/resources/audit.d.ts.map +1 -1
- package/dist/resources/audit.js +3 -0
- package/dist/resources/audit.js.map +1 -1
- package/dist/resources/tokens.d.ts.map +1 -1
- package/dist/resources/tokens.js +5 -1
- package/dist/resources/tokens.js.map +1 -1
- package/dist/types.d.ts +32 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/verify.d.ts.map +1 -1
- package/dist/verify.js +1 -0
- package/dist/verify.js.map +1 -1
- package/dist/webhook.d.ts +41 -0
- package/dist/webhook.d.ts.map +1 -1
- package/dist/webhook.js +54 -0
- package/dist/webhook.js.map +1 -1
- package/package.json +6 -1
package/README.md
CHANGED
|
@@ -72,6 +72,105 @@ const grantex = new Grantex({
|
|
|
72
72
|
| `jwksUri` | `string` | `${baseUrl}/.well-known/jwks.json` | URL from which the verifier retrieves signing keys |
|
|
73
73
|
| `timeout` | `number` | `30000` | Request timeout in milliseconds |
|
|
74
74
|
|
|
75
|
+
## OAuth Agent Profile Client
|
|
76
|
+
|
|
77
|
+
`OAuthAgentClient` implements the client role in the prepared
|
|
78
|
+
`draft-mishra-oauth-agent-grants-03` profile. It discovers and validates RFC
|
|
79
|
+
8414 metadata, creates an ES256 DPoP key by default, uses PAR and PKCE S256,
|
|
80
|
+
validates `state` and the RFC 9207 `iss` response parameter, rotates refresh
|
|
81
|
+
tokens, performs same-resource RFC 8693 attenuation, and creates DPoP proofs
|
|
82
|
+
for protected-resource requests.
|
|
83
|
+
|
|
84
|
+
```typescript
|
|
85
|
+
import { OAuthAgentClient } from '@grantex/sdk';
|
|
86
|
+
|
|
87
|
+
const client = await OAuthAgentClient.create({
|
|
88
|
+
issuer: 'https://grantex.dev',
|
|
89
|
+
clientId: 'ag_01J...',
|
|
90
|
+
redirectUri: 'https://agent.example/callback',
|
|
91
|
+
resource: 'https://api.example/resource',
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
const pending = await client.beginAuthorization({
|
|
95
|
+
scopes: ['grantex.resource.read'],
|
|
96
|
+
principalHint: 'principal@example.com',
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
// Redirect the Principal to pending.authorizationUrl. In the callback:
|
|
100
|
+
const tokens = await client.completeAuthorization(callbackUrl);
|
|
101
|
+
|
|
102
|
+
const response = await client.fetch(
|
|
103
|
+
'https://api.example/resource',
|
|
104
|
+
tokens.access_token,
|
|
105
|
+
);
|
|
106
|
+
|
|
107
|
+
const narrower = await client.attenuate(tokens.access_token, [
|
|
108
|
+
'grantex.resource.read',
|
|
109
|
+
]);
|
|
110
|
+
const rotated = await client.refresh(tokens.refresh_token!);
|
|
111
|
+
await client.revoke(rotated.refresh_token!, 'refresh_token');
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
Persist the generated key securely if an instance must survive process
|
|
115
|
+
restarts. Supply the matching `privateKey` and `publicJwk` to `create`; both are
|
|
116
|
+
required together. `principalHint` is optional account-discovery input and is
|
|
117
|
+
not proof of the Principal's identity; live approval still requires the
|
|
118
|
+
authorization server's passkey authentication. Plain HTTP endpoints are rejected unless
|
|
119
|
+
`allowInsecureLoopback` is enabled for local loopback testing. Revision `-02`
|
|
120
|
+
of the draft family is published as an active individual Internet-Draft;
|
|
121
|
+
revision `-03` is the working candidate implemented here. Neither is an
|
|
122
|
+
IETF-endorsed or independently certified standard.
|
|
123
|
+
|
|
124
|
+
## Agent prepaid wallets (0.4.0 repository source)
|
|
125
|
+
|
|
126
|
+
`PrepaidWalletAgentClient` uses an `OAuthAgentClient` and DPoP access token to
|
|
127
|
+
list assigned wallets, reserve payments, and request threshold reloads.
|
|
128
|
+
`PrincipalPrepaidWalletClient` uses a short-lived principal-session token to
|
|
129
|
+
create and fund wallets, assign policy, approve reloads, inspect activity, and
|
|
130
|
+
block an assignment, wallet, or all wallets for one agent.
|
|
131
|
+
|
|
132
|
+
The access token must include `wallet:spend` and each action scope used in a
|
|
133
|
+
payment (for example `weather:read`). Agent wallet listings intentionally omit
|
|
134
|
+
custody-provider IDs, wallet addresses, principal IDs, and wallet metadata.
|
|
135
|
+
|
|
136
|
+
```typescript
|
|
137
|
+
import {
|
|
138
|
+
PrepaidWalletAgentClient,
|
|
139
|
+
PrincipalPrepaidWalletClient,
|
|
140
|
+
} from '@grantex/sdk';
|
|
141
|
+
|
|
142
|
+
const agentWallets = new PrepaidWalletAgentClient({
|
|
143
|
+
oauthClient,
|
|
144
|
+
accessToken,
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
const principalWallets = new PrincipalPrepaidWalletClient({
|
|
148
|
+
baseUrl: 'https://grantex.dev',
|
|
149
|
+
sessionToken,
|
|
150
|
+
});
|
|
151
|
+
|
|
152
|
+
const authorization = await agentWallets.authorizePayment({
|
|
153
|
+
amount: '1000',
|
|
154
|
+
asset: 'USDC',
|
|
155
|
+
network: 'grantex:prepaid',
|
|
156
|
+
recipient: 'merchant:weather-api',
|
|
157
|
+
resource: 'https://merchant.example/weather',
|
|
158
|
+
scope: 'weather:read',
|
|
159
|
+
maxTimeoutSeconds: 120,
|
|
160
|
+
idempotencyKey: crypto.randomUUID(),
|
|
161
|
+
});
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
Amounts are atomic-unit integer strings. Managed prepaid-wallet APIs are
|
|
165
|
+
available in `@grantex/sdk` 0.4.0 and later.
|
|
166
|
+
|
|
167
|
+
Self-hosted wallet deployments must also provide correct public resource
|
|
168
|
+
routing, migration `091`, durable notification delivery, merchant-side
|
|
169
|
+
idempotency, and any external custody/provider integration. See [Prepaid Wallet
|
|
170
|
+
Production
|
|
171
|
+
Readiness](https://docs.grantex.dev/guides/prepaid-wallet-production);
|
|
172
|
+
installing the SDK alone does not provide those dependencies.
|
|
173
|
+
|
|
75
174
|
## Commerce V1 / OACP
|
|
76
175
|
|
|
77
176
|
The SDK includes a `commerce` resource for the Grantex Commerce V1 control
|
|
@@ -342,8 +441,10 @@ console.log(token.refreshToken); // for token refresh
|
|
|
342
441
|
| `grantToken` | `string` | Signed RS256 JWT — the agent's bearer credential |
|
|
343
442
|
| `grantId` | `string` | Grant record ID |
|
|
344
443
|
| `scopes` | `string[]` | Scopes the user approved |
|
|
345
|
-
| `expiresAt` | `string` |
|
|
346
|
-
| `refreshToken` | `string` | Refresh token for
|
|
444
|
+
| `expiresAt` | `string` | Underlying grant expiry (ISO 8601) |
|
|
445
|
+
| `refreshToken` | `string` | Refresh token for rotating credentials while the grant remains active |
|
|
446
|
+
|
|
447
|
+
Refresh tokens are single-use and rotate on every accepted refresh. If a refresh response is lost after the server commits rotation, retry the same previous refresh token immediately; Grantex can return the already-rotated token pair for five minutes (300 seconds) while the grant remains active. Refresh does not extend `expiresAt`; after the grant expires, re-authorize.
|
|
347
448
|
|
|
348
449
|
---
|
|
349
450
|
|
|
@@ -443,7 +544,7 @@ const { entries } = await grantex.audit.list({
|
|
|
443
544
|
#### `grantex.audit.get(entryId)`
|
|
444
545
|
|
|
445
546
|
```typescript
|
|
446
|
-
const entry = await grantex.audit.get('
|
|
547
|
+
const entry = await grantex.audit.get('alog_01J...');
|
|
447
548
|
console.log(entry.hash); // SHA-256 hash for tamper evidence
|
|
448
549
|
console.log(entry.prevHash); // previous entry hash (chain integrity)
|
|
449
550
|
```
|
|
@@ -801,3 +902,7 @@ const result = await grantex.enforce({ grantToken: token, connector: 'my-crm', t
|
|
|
801
902
|
## License
|
|
802
903
|
|
|
803
904
|
[Apache 2.0](https://github.com/mishrasanjeev/grantex/blob/main/LICENSE)
|
|
905
|
+
|
|
906
|
+
## Ownership
|
|
907
|
+
|
|
908
|
+
Grantex is owned by Orchestrum Technologies LLP. Inventor and owner: Sanjeev Kumar. Ownership contact: [sanjeev@orchestrum.in](mailto:sanjeev@orchestrum.in) or [mishra.sanjeev@gmail.com](mailto:mishra.sanjeev@gmail.com).
|
package/dist/http.js
CHANGED
package/dist/http.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http.js","sourceRoot":"","sources":["../src/http.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAGrF,MAAM,WAAW,GAAG,
|
|
1
|
+
{"version":3,"file":"http.js","sourceRoot":"","sources":["../src/http.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAGrF,MAAM,WAAW,GAAG,OAAO,CAAC;AAC5B,MAAM,kBAAkB,GAAG,MAAM,CAAC;AAClC,MAAM,mBAAmB,GAAG,CAAC,CAAC;AAC9B,MAAM,mBAAmB,GAAG,GAAG,CAAC;AAChC,MAAM,kBAAkB,GAAG,MAAM,CAAC;AAClC,MAAM,sBAAsB,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC;AAE7D,SAAS,qBAAqB,CAAC,OAAgB;IAC7C,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC;IAC/C,MAAM,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAAC;IACvD,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC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AC;QACD,OAAQ,IAA+B,CAAC,SAAS,CAAE,CAAC;IACtD,CAAC;IACD,MAAM,MAAM,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC;IACjC,IAAI,MAAM,IAAI,OAAO,MAAM,CAAC,SAAS,CAAC,KAAK,QAAQ,EAAE,CAAC;QACpD,OAAO,MAAM,CAAC,SAAS,CAAC,CAAC;IAC3B,CAAC;IACD,IACE,IAAI,KAAK,IAAI;QACb,OAAO,IAAI,KAAK,QAAQ;QACxB,OAAO,IAAI,IAAI;QACf,OAAQ,IAAgC,CAAC,OAAO,CAAC,KAAK,QAAQ,EAC9D,CAAC;QACD,OAAQ,IAA+B,CAAC,OAAO,CAAE,CAAC;IACpD,CAAC;IACD,OAAO,QAAQ,MAAM,EAAE,CAAC;AAC1B,CAAC;AAED,SAAS,WAAW,CAAC,IAAa;IAChC,IAAI,IAAI,KAAK,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ;QAAE,OAAO,SAAS,CAAC;IAChE,MAAM,KAAK,GAAI,IAAgC,CAAC,OAAO,CAAC,CAAC;IACzD,IAAI,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,OAAO,SAAS,CAAC;IAC1F,OAAO,KAAgC,CAAC;AAC1C,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
export { Grantex } from './client.js';
|
|
2
2
|
export { verifyGrantToken } from './verify.js';
|
|
3
|
-
export { verifyWebhookSignature } from './webhook.js';
|
|
3
|
+
export { verifyWebhookSignature, verifyWebhook, type VerifyWebhookOptions } from './webhook.js';
|
|
4
4
|
export { generatePkce, type PkceChallenge } from './pkce.js';
|
|
5
|
+
export { OAuthAgentClient, generateOAuthAgentKey, type OAuthAuthorizationServerMetadata, type OAuthAgentClientOptions, type OAuthAgentKeyPair, type BeginAgentAuthorizationOptions, type PendingAgentAuthorization, type OAuthAgentTokenResponse, } from './oauth-agent.js';
|
|
6
|
+
export { PrepaidWalletAgentClient, PrincipalPrepaidWalletClient, type PrepaidCustodyMode, type PrepaidWalletStatus, type WalletAssignmentStatus, type PrepaidWallet, type AssignedPrepaidWallet, type WalletAssignment, type CreatePrepaidWalletParams, type AssignPrepaidWalletParams, type PrepaidAuthorizationRequest, type PrepaidAuthorizationResponse, type WalletReloadRequest, type PrepaidWalletActivity, } from './prepaid-wallets.js';
|
|
5
7
|
export { GrantexError, GrantexApiError, GrantexAuthError, GrantexTokenError, GrantexNetworkError, } from './errors.js';
|
|
6
8
|
export { EventsClient, type GrantexEvent as GrantexStreamEvent, type StreamOptions, type EventHandler } from './resources/events.js';
|
|
7
9
|
export { PassportsClient, type IssuePassportParams, type IssuedPassportResponse, type GetPassportResponse, type RevokePassportResponse, type ListPassportsParams, } from './resources/passports.js';
|
|
8
10
|
export { ToolManifest, Permission, permissionCovers, type EnforceOptions, type EnforceResult, type ToolManifestOptions, type WrapToolOptions, type EnforceMiddlewareOptions } from './manifest.js';
|
|
9
11
|
export { DpdpClient } from './resources/dpdp.js';
|
|
10
12
|
export { CommerceClient, type CommerceEnvironment, type CommerceProviderKey, type CommercePassportType, type CommercePaymentStatus, type CommerceRecord, type CommerceDataResponse, type CommerceListResponse, type CommerceProfile, type CommerceIdempotentRequest, type CommerceTenantCreateParams, type CommerceTenantUpdateParams, type CommerceDeveloperTenantBindParams, type CommerceMerchantCreateParams, type CommerceMerchantUpdateParams, type CommerceAgentCreateParams, type CommerceAgentUpdateParams, type CommerceCatalogVariantInput, type CommerceCatalogProductCreateParams, type CommerceCatalogProductUpdateParams, type CommerceCatalogProductListParams, type CommerceCatalogSearchParams, type CommerceCartCreateParams, type CommerceConsentRequestCreateParams, type CommerceConsentExchangeParams, type CommercePassportVerifyParams, type CommercePassportRevokeParams, type CommercePolicyCreateParams, type CommercePolicyEvaluateParams, type CommercePaymentIntentCreateParams, type CommercePaymentIntentListParams, type CommerceCheckoutLinkCreateParams, type CommerceProviderCredentialCreateParams, type CommerceProviderCredentialPatchParams, type CommerceProviderCredentialListParams, type CommerceWebhookSourceCreateParams, type CommerceWebhookSourceListParams, type CommerceOpsHealthParams, type CommerceProviderWebhookEventListParams, type CommerceProviderWebhookReplayParams, type CommerceMcpJsonRpcRequest, } from './resources/commerce.js';
|
|
11
|
-
export type { RateLimit, GrantexClientOptions, SignupParams, SignupResponse, RotateKeyResponse, Agent, RegisterAgentParams, UpdateAgentParams, ListAgentsResponse, AuthorizeParams, AuthorizationRequest, Grant, ListGrantsParams, ListGrantsResponse, VerifiedGrant, DelegateParams, ExchangeTokenParams, ExchangeTokenResponse, RefreshTokenParams, VerifyTokenResponse, CreatePrincipalSessionParams, PrincipalSessionResponse, LogAuditParams, AuditEntry, ListAuditParams, ListAuditResponse, VerifyGrantTokenOptions, WebhookEventType, CreateWebhookParams, WebhookEndpoint, WebhookEndpointWithSecret, ListWebhooksResponse, SubscriptionStatus, CreateCheckoutParams, CheckoutResponse, CreatePortalParams, PortalResponse, Policy, CreatePolicyParams, UpdatePolicyParams, ListPoliciesResponse, AnomalyType, AnomalySeverity, Anomaly, DetectAnomaliesResponse, ListAnomaliesResponse, ScimEmail, ScimUserMeta, ScimUser, ScimListResponse, CreateScimUserParams, UpdateScimUserParams, ScimToken, ScimTokenWithSecret, CreateScimTokenParams, ListScimTokensResponse, SsoConfig, CreateSsoConfigParams, SsoLoginResponse, SsoCallbackResponse, StoreCredentialParams, StoreCredentialResponse, VaultCredential, ListVaultCredentialsParams, ListVaultCredentialsResponse, ExchangeCredentialParams, ExchangeCredentialResponse, AllocateBudgetParams, BudgetAllocation, DebitBudgetParams, DebitBudgetResponse, BudgetTransaction, BudgetTransactionsResponse, ComplianceSummary, ComplianceExportGrantsParams, ComplianceExportAuditParams, ComplianceGrantsExport, ComplianceAuditExport, EvidencePackParams, EvidencePack, ChainIntegrity, UsageResponse, UsageHistoryEntry, UsageHistoryResponse, CreateDomainParams, CreateDomainResponse, DomainEntry, ListDomainsResponse, VerifyDomainResponse, WebAuthnRegistrationOptions, WebAuthnRegistrationVerifyParams, WebAuthnCredential, ListWebAuthnCredentialsResponse, VerifiableCredentialRecord, ListCredentialsParams, ListCredentialsResponse, VCVerificationResult, SDJWTPresentParams, SDJWTPresentResult, UpdateDeveloperSettingsParams, UpdateDeveloperSettingsResponse, DpdpPurpose, CreateConsentRecordParams, ConsentRecord, ListConsentRecordsResponse, WithdrawConsentParams, WithdrawConsentResponse, PrincipalRecordsResponse, ErasureResponse, CreateConsentNoticeParams, ConsentNotice, FileGrievanceParams, Grievance, DpdpExportType, CreateDpdpExportParams, DpdpExport, } from './types.js';
|
|
13
|
+
export type { RateLimit, GrantexClientOptions, SignupParams, SignupResponse, RotateKeyResponse, Agent, RegisterAgentParams, UpdateAgentParams, ListAgentsResponse, AuthorizeParams, AuthorizationRequest, Grant, ListGrantsParams, ListGrantsResponse, VerifiedGrant, DelegateParams, ExchangeTokenParams, ExchangeTokenResponse, RefreshTokenParams, VerifyTokenResponse, CreatePrincipalSessionParams, PrincipalSessionResponse, LogAuditParams, AuditEntry, AuditCheckpoint, ListAuditParams, ListAuditResponse, VerifyGrantTokenOptions, WebhookEventType, CreateWebhookParams, WebhookEndpoint, WebhookEndpointWithSecret, ListWebhooksResponse, SubscriptionStatus, CreateCheckoutParams, CheckoutResponse, CreatePortalParams, PortalResponse, Policy, CreatePolicyParams, UpdatePolicyParams, ListPoliciesResponse, AnomalyType, AnomalySeverity, Anomaly, DetectAnomaliesResponse, ListAnomaliesResponse, ScimEmail, ScimUserMeta, ScimUser, ScimListResponse, CreateScimUserParams, UpdateScimUserParams, ScimToken, ScimTokenWithSecret, CreateScimTokenParams, ListScimTokensResponse, SsoConfig, CreateSsoConfigParams, SsoLoginResponse, SsoCallbackResponse, StoreCredentialParams, StoreCredentialResponse, VaultCredential, ListVaultCredentialsParams, ListVaultCredentialsResponse, ExchangeCredentialParams, ExchangeCredentialResponse, AllocateBudgetParams, BudgetAllocation, DebitBudgetParams, DebitBudgetResponse, BudgetTransaction, BudgetTransactionsResponse, ComplianceSummary, ComplianceExportGrantsParams, ComplianceExportAuditParams, ComplianceGrantsExport, ComplianceAuditExport, EvidencePackParams, EvidencePack, ChainIntegrity, UsageResponse, UsageHistoryEntry, UsageHistoryResponse, CreateDomainParams, CreateDomainResponse, DomainEntry, ListDomainsResponse, VerifyDomainResponse, WebAuthnRegistrationOptions, WebAuthnRegistrationVerifyParams, WebAuthnCredential, ListWebAuthnCredentialsResponse, VerifiableCredentialRecord, ListCredentialsParams, ListCredentialsResponse, VCVerificationResult, SDJWTPresentParams, SDJWTPresentResult, UpdateDeveloperSettingsParams, UpdateDeveloperSettingsResponse, DpdpPurpose, CreateConsentRecordParams, ConsentRecord, ListConsentRecordsResponse, WithdrawConsentParams, WithdrawConsentResponse, PrincipalRecordsResponse, ErasureResponse, CreateConsentNoticeParams, ConsentNotice, FileGrievanceParams, Grievance, DpdpExportType, CreateDpdpExportParams, DpdpExport, } from './types.js';
|
|
12
14
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAGtC,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAG/C,OAAO,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAGtC,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAG/C,OAAO,EAAE,sBAAsB,EAAE,aAAa,EAAE,KAAK,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAGhG,OAAO,EAAE,YAAY,EAAE,KAAK,aAAa,EAAE,MA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from './client.js';
|
|
|
3
3
|
// Standalone token verification (no Grantex account needed)
|
|
4
4
|
export { verifyGrantToken } from './verify.js';
|
|
5
5
|
// Webhook signature verification
|
|
6
|
-
export { verifyWebhookSignature } from './webhook.js';
|
|
6
|
+
export { verifyWebhookSignature, verifyWebhook } from './webhook.js';
|
|
7
7
|
// PKCE helper
|
|
8
8
|
export { generatePkce } from './pkce.js';
|
|
9
|
+
// OAuth agent-grants profile client (PAR + PKCE + RFC 9207 + DPoP)
|
|
10
|
+
export { OAuthAgentClient, generateOAuthAgentKey, } from './oauth-agent.js';
|
|
11
|
+
// Agent prepaid wallets and x402 authorization bridge
|
|
12
|
+
export { PrepaidWalletAgentClient, PrincipalPrepaidWalletClient, } from './prepaid-wallets.js';
|
|
9
13
|
// Error classes
|
|
10
14
|
export { GrantexError, GrantexApiError, GrantexAuthError, GrantexTokenError, GrantexNetworkError, } from './errors.js';
|
|
11
15
|
// Event streaming
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc;AACd,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAEtC,4DAA4D;AAC5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,iCAAiC;AACjC,OAAO,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc;AACd,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAEtC,4DAA4D;AAC5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,iCAAiC;AACjC,OAAO,EAAE,sBAAsB,EAAE,aAAa,EAA6B,MAAM,cAAc,CAAC;AAEhG,cAAc;AACd,OAAO,EAAE,YAAY,EAAsB,MAAM,WAAW,CAAC;AAE7D,mEAAmE;AACnE,OAAO,EACL,gBAAgB,EAChB,qBAAqB,GAOtB,MAAM,kBAAkB,CAAC;AAE1B,sDAAsD;AACtD,OAAO,EACL,wBAAwB,EACxB,4BAA4B,GAa7B,MAAM,sBAAsB,CAAC;AAE9B,gBAAgB;AAChB,OAAO,EACL,YAAY,EACZ,eAAe,EACf,gBAAgB,EAChB,iBAAiB,EACjB,mBAAmB,GACpB,MAAM,aAAa,CAAC;AAErB,kBAAkB;AAClB,OAAO,EAAE,YAAY,EAAkF,MAAM,uBAAuB,CAAC;AAErI,iCAAiC;AACjC,OAAO,EACL,eAAe,GAMhB,MAAM,0BAA0B,CAAC;AAElC,oBAAoB;AACpB,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,gBAAgB,EAA0H,MAAM,eAAe,CAAC;AAEnM,kBAAkB;AAClB,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEjD,mCAAmC;AACnC,OAAO,EACL,cAAc,GAyCf,MAAM,yBAAyB,CAAC"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { type CryptoKey, type JWK } from 'jose';
|
|
2
|
+
export interface OAuthAuthorizationServerMetadata {
|
|
3
|
+
issuer: string;
|
|
4
|
+
authorization_endpoint: string;
|
|
5
|
+
token_endpoint: string;
|
|
6
|
+
jwks_uri: string;
|
|
7
|
+
revocation_endpoint: string;
|
|
8
|
+
pushed_authorization_request_endpoint: string;
|
|
9
|
+
require_pushed_authorization_requests: true;
|
|
10
|
+
response_types_supported: string[];
|
|
11
|
+
grant_types_supported: string[];
|
|
12
|
+
code_challenge_methods_supported: string[];
|
|
13
|
+
authorization_response_iss_parameter_supported: true;
|
|
14
|
+
dpop_signing_alg_values_supported: string[];
|
|
15
|
+
token_endpoint_auth_methods_supported: string[];
|
|
16
|
+
revocation_endpoint_auth_methods_supported: string[];
|
|
17
|
+
}
|
|
18
|
+
export interface OAuthAgentClientOptions {
|
|
19
|
+
issuer: string;
|
|
20
|
+
clientId: string;
|
|
21
|
+
redirectUri: string;
|
|
22
|
+
resource: string;
|
|
23
|
+
privateKey?: CryptoKey;
|
|
24
|
+
publicJwk?: JWK;
|
|
25
|
+
allowInsecureLoopback?: boolean;
|
|
26
|
+
}
|
|
27
|
+
export interface OAuthAgentKeyPair {
|
|
28
|
+
privateKey: CryptoKey;
|
|
29
|
+
publicJwk: JWK;
|
|
30
|
+
thumbprint: string;
|
|
31
|
+
}
|
|
32
|
+
export declare function generateOAuthAgentKey(): Promise<OAuthAgentKeyPair>;
|
|
33
|
+
export interface BeginAgentAuthorizationOptions {
|
|
34
|
+
scopes: string[];
|
|
35
|
+
principalHint?: string;
|
|
36
|
+
authorizationDetails?: Array<Record<string, unknown>>;
|
|
37
|
+
}
|
|
38
|
+
export interface PendingAgentAuthorization {
|
|
39
|
+
authorizationUrl: string;
|
|
40
|
+
requestUri: string;
|
|
41
|
+
state: string;
|
|
42
|
+
expiresIn: number;
|
|
43
|
+
}
|
|
44
|
+
export interface OAuthAgentTokenResponse {
|
|
45
|
+
access_token: string;
|
|
46
|
+
token_type: 'DPoP';
|
|
47
|
+
expires_in: number;
|
|
48
|
+
refresh_token?: string;
|
|
49
|
+
scope: string;
|
|
50
|
+
issued_token_type?: string;
|
|
51
|
+
}
|
|
52
|
+
export declare class OAuthAgentClient {
|
|
53
|
+
#private;
|
|
54
|
+
readonly metadata: OAuthAuthorizationServerMetadata;
|
|
55
|
+
readonly clientId: string;
|
|
56
|
+
readonly redirectUri: string;
|
|
57
|
+
readonly resource: string;
|
|
58
|
+
readonly publicJwk: JWK;
|
|
59
|
+
readonly keyThumbprint: string;
|
|
60
|
+
private constructor();
|
|
61
|
+
static create(options: OAuthAgentClientOptions): Promise<OAuthAgentClient>;
|
|
62
|
+
beginAuthorization(options: BeginAgentAuthorizationOptions): Promise<PendingAgentAuthorization>;
|
|
63
|
+
completeAuthorization(callbackUrl: string): Promise<OAuthAgentTokenResponse>;
|
|
64
|
+
refresh(refreshToken: string): Promise<OAuthAgentTokenResponse>;
|
|
65
|
+
attenuate(accessToken: string, scopes: string[]): Promise<OAuthAgentTokenResponse>;
|
|
66
|
+
revoke(token: string, tokenTypeHint?: 'access_token' | 'refresh_token'): Promise<void>;
|
|
67
|
+
fetch(input: string | URL, accessToken: string, init?: RequestInit): Promise<Response>;
|
|
68
|
+
createDpopProof(method: string, targetUri: string, accessToken?: string): Promise<string>;
|
|
69
|
+
tokenRequest(params: URLSearchParams): Promise<OAuthAgentTokenResponse>;
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=oauth-agent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"oauth-agent.d.ts","sourceRoot":"","sources":["../src/oauth-agent.ts"],"names":[],"mappings":"AACA,OAAO,EAOL,KAAK,SAAS,EACd,KAAK,GAAG,EACT,MAAM,MAAM,CAAC;AAMd,MAAM,WAAW,gCAAgC;IAC/C,MAAM,EAAE,MAAM,CAAC;IACf,sBAAsB,EAAE,MAAM,CAAC;IAC/B,cAAc,EAAE,MAAM,CAAC;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,qCAAqC,EAAE,MAAM,CAAC;IAC9C,qCAAqC,EAAE,IAAI,CAAC;IAC5C,wBAAwB,EAAE,MAAM,EAAE,CAAC;IACnC,qBAAqB,EAAE,MAAM,EAAE,CAAC;IAChC,gCAAgC,EAAE,MAAM,EAAE,CAAC;IAC3C,8CAA8C,EAAE,IAAI,CAAC;IACrD,iCAAiC,EAAE,MAAM,EAAE,CAAC;IAC5C,qCAAqC,EAAE,MAAM,EAAE,CAAC;IAChD,0CAA0C,EAAE,MAAM,EAAE,CAAC;CACtD;AAED,MAAM,WAAW,uBAAuB;IACtC,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,SAAS,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