@attesso/types 1.0.1 → 1.0.3
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 +165 -0
- package/package.json +2 -2
package/README.md
ADDED
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
# @attesso/types
|
|
2
|
+
|
|
3
|
+
TypeScript type definitions for the Attesso SDK ecosystem.
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
npm install @attesso/types
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
## Overview
|
|
10
|
+
|
|
11
|
+
This package provides shared TypeScript types used across all Attesso packages. It has zero runtime dependencies - types are compile-time only.
|
|
12
|
+
|
|
13
|
+
## Core Types
|
|
14
|
+
|
|
15
|
+
### Mandates
|
|
16
|
+
|
|
17
|
+
```typescript
|
|
18
|
+
import type { Mandate, MandateResponse, CreateMandateRequest, MandateStatus } from '@attesso/types';
|
|
19
|
+
|
|
20
|
+
// MandateStatus: 'active' | 'revoked' | 'expired'
|
|
21
|
+
const mandate: MandateResponse = {
|
|
22
|
+
id: 'mandate_xyz',
|
|
23
|
+
botId: 'travel-agent-v1',
|
|
24
|
+
maxAmount: 50000, // cents
|
|
25
|
+
currency: 'USD',
|
|
26
|
+
merchant: 'United Airlines',
|
|
27
|
+
status: 'active',
|
|
28
|
+
createdAt: '2024-01-15T10:00:00Z',
|
|
29
|
+
};
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### Payments
|
|
33
|
+
|
|
34
|
+
```typescript
|
|
35
|
+
import type {
|
|
36
|
+
Payment,
|
|
37
|
+
PaymentResponse,
|
|
38
|
+
PaymentStatus,
|
|
39
|
+
PaymentErrorCode,
|
|
40
|
+
AuthorizePaymentRequest,
|
|
41
|
+
CapturePaymentRequest,
|
|
42
|
+
CapturePaymentResponse,
|
|
43
|
+
CancelAuthorizationResponse,
|
|
44
|
+
} from '@attesso/types';
|
|
45
|
+
|
|
46
|
+
// PaymentStatus: 'pending' | 'processing' | 'authorized' | 'completed' | 'failed' | 'cancelled'
|
|
47
|
+
// PaymentErrorCode: 'MANDATE_NOT_FOUND' | 'AMOUNT_EXCEEDS_LIMIT' | 'MERCHANT_MISMATCH' | ...
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### Passports
|
|
51
|
+
|
|
52
|
+
```typescript
|
|
53
|
+
import type {
|
|
54
|
+
PassportPayload,
|
|
55
|
+
PassportToken,
|
|
56
|
+
VerifyPassportResult,
|
|
57
|
+
EnhancedPassportPayload,
|
|
58
|
+
PassportReputation,
|
|
59
|
+
ReputationTier,
|
|
60
|
+
} from '@attesso/types';
|
|
61
|
+
|
|
62
|
+
// ReputationTier: 'verified_partner' | 'standard' | 'probationary'
|
|
63
|
+
const passport: PassportPayload = {
|
|
64
|
+
sub: 'user_123',
|
|
65
|
+
bot: 'travel-agent-v1',
|
|
66
|
+
mandate: 'mandate_xyz',
|
|
67
|
+
maxSpend: 50000,
|
|
68
|
+
merchant: 'United Airlines',
|
|
69
|
+
iat: 1705312800,
|
|
70
|
+
exp: 1705316400,
|
|
71
|
+
};
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### Users
|
|
75
|
+
|
|
76
|
+
```typescript
|
|
77
|
+
import type {
|
|
78
|
+
User,
|
|
79
|
+
BankAccount,
|
|
80
|
+
AuthChallengeRequest,
|
|
81
|
+
AuthChallengeResponse,
|
|
82
|
+
AuthTokenResponse,
|
|
83
|
+
} from '@attesso/types';
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### Fee Calculation
|
|
87
|
+
|
|
88
|
+
```typescript
|
|
89
|
+
import type {
|
|
90
|
+
RegionalFeeStructure,
|
|
91
|
+
RegionalFees,
|
|
92
|
+
InclusiveFeeConfig,
|
|
93
|
+
FeeBreakdown,
|
|
94
|
+
InclusiveFeeResult,
|
|
95
|
+
} from '@attesso/types';
|
|
96
|
+
|
|
97
|
+
import { STRIPE_REGIONAL_FEES } from '@attesso/types';
|
|
98
|
+
|
|
99
|
+
// Pre-configured regional fees
|
|
100
|
+
console.log(STRIPE_REGIONAL_FEES.EEA); // { variablePercent: 1.5, fixedCents: 25, currency: 'EUR' }
|
|
101
|
+
console.log(STRIPE_REGIONAL_FEES.US); // { variablePercent: 2.9, fixedCents: 30, currency: 'USD' }
|
|
102
|
+
console.log(STRIPE_REGIONAL_FEES.UK); // { variablePercent: 1.5, fixedCents: 20, currency: 'GBP' }
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
## Circuit Breaker Types
|
|
106
|
+
|
|
107
|
+
Types for the bot passport circuit breaker system:
|
|
108
|
+
|
|
109
|
+
```typescript
|
|
110
|
+
import type {
|
|
111
|
+
CircuitBreakerStatus,
|
|
112
|
+
RevocationReason,
|
|
113
|
+
AnomalyPattern,
|
|
114
|
+
AnomalySeverity,
|
|
115
|
+
PenaltyTier,
|
|
116
|
+
GRLCheckResult,
|
|
117
|
+
AnomalyDetectionResult,
|
|
118
|
+
} from '@attesso/types';
|
|
119
|
+
|
|
120
|
+
import { PENALTY_SCHEDULE, TRIPWIRE_THRESHOLDS } from '@attesso/types';
|
|
121
|
+
|
|
122
|
+
// CircuitBreakerStatus: 'green' | 'yellow' | 'red'
|
|
123
|
+
// AnomalyPattern: 'shotgun' | 'probe' | 'zombie' | 'excessive_errors'
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
## Cloud TEE Types
|
|
127
|
+
|
|
128
|
+
Types for AWS Nitro and GCP Confidential Computing attestation:
|
|
129
|
+
|
|
130
|
+
```typescript
|
|
131
|
+
import type {
|
|
132
|
+
CloudTEEPlatform,
|
|
133
|
+
NitroAttestationDocument,
|
|
134
|
+
GCPAttestationClaims,
|
|
135
|
+
CloudTEEVerificationResult,
|
|
136
|
+
DeviceAttestation,
|
|
137
|
+
EnclaveImageData,
|
|
138
|
+
FleetMandateRequest,
|
|
139
|
+
} from '@attesso/types';
|
|
140
|
+
|
|
141
|
+
// CloudTEEPlatform: 'aws_nitro' | 'gcp_confidential_vm' | 'gcp_confidential_space'
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
## Package Compatibility
|
|
145
|
+
|
|
146
|
+
This package is used by:
|
|
147
|
+
|
|
148
|
+
- `@attesso/sdk` - Client SDK
|
|
149
|
+
- `@attesso/gatekeeper` - Server-side verification
|
|
150
|
+
- `@attesso/rails` - Payment processing
|
|
151
|
+
- `@attesso/react-native-sdk` - Mobile SDK
|
|
152
|
+
- `vercel-ai-attesso` - Vercel AI SDK integration
|
|
153
|
+
|
|
154
|
+
## Requirements
|
|
155
|
+
|
|
156
|
+
- TypeScript 5.0+
|
|
157
|
+
|
|
158
|
+
## Links
|
|
159
|
+
|
|
160
|
+
- Website: https://attesso.com
|
|
161
|
+
- Support: info@attesso.com
|
|
162
|
+
|
|
163
|
+
## License
|
|
164
|
+
|
|
165
|
+
MIT
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@attesso/types",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "TypeScript types for Attesso
|
|
3
|
+
"version": "1.0.3",
|
|
4
|
+
"description": "TypeScript types for Attesso SDK - Mandate, Payment, Passport, User types",
|
|
5
5
|
"author": "Attesso",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": {
|