@heyanon-arp/sdk 0.0.11 → 0.0.13
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 +1 -1
- package/dist/assets.d.ts +1 -9
- package/dist/attestation/attestation.d.ts +1 -1
- package/dist/attestation/scrypt-proof.d.ts +5 -5
- package/dist/escrow/condition-hash.d.ts +11 -11
- package/dist/escrow/lifecycle-instructions.d.ts +1 -1
- package/dist/escrow/lock-id.d.ts +6 -7
- package/dist/index.js +3 -24
- package/dist/index.mjs +4 -21
- package/dist/purpose.d.ts +3 -15
- package/dist/types/body.d.ts +13 -30
- package/dist/types/envelope.d.ts +5 -13
- package/dist/types/identity.d.ts +4 -4
- package/dist/types/index.d.ts +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -100,7 +100,7 @@ verifyCosignature({ cosignature: cs, payload: cs.payload, signerIdentityPubkey:
|
|
|
100
100
|
| `challenge` | `ARP-CHALLENGE-v1` ownership proof for identity registration |
|
|
101
101
|
| `attestation` | `ARP-KEY-LINK-v1` / `ARP-KEY-ROTATION-v1` (scrypt password proof) |
|
|
102
102
|
| `server-chain` | `signed_message_hash` + `server_event_hash` builders for chain audit |
|
|
103
|
-
| `settlement` | `ARP-SOLANA-RELEASE-v1.5` / `…-
|
|
103
|
+
| `settlement` | `ARP-SOLANA-RELEASE-v1.5` / `…-REFUND-v1` digests |
|
|
104
104
|
| `escrow` | Solana `create_lock` ix data builder, condition-hash derivation |
|
|
105
105
|
| `purpose` | Domain separator constants |
|
|
106
106
|
| `utils` | UUID v4, sender_nonce, RFC 3339 timestamp helpers |
|
package/dist/assets.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* The protocol carries assets as `AssetIdentifier` ({ asset_id, decimals,
|
|
5
5
|
* symbol? }) with `asset_id` always a CAIP-19 string. Payment assets
|
|
6
|
-
* are a CLOSED per-cluster whitelist (mirroring the
|
|
6
|
+
* are a CLOSED per-cluster whitelist (mirroring the contract's
|
|
7
7
|
* on-chain `CollateralConfig` allowlist):
|
|
8
8
|
*
|
|
9
9
|
* - solana-mainnet: SOL, USDC, USDT, ANON
|
|
@@ -63,14 +63,6 @@ export declare const MAINNET_MINTS: {
|
|
|
63
63
|
export declare const DEVNET_MINTS: {
|
|
64
64
|
readonly USDC: "7ZjP2eJnQrW1SuE1kAP7tdrQuhkTVpco1NQKGjEMHpgg";
|
|
65
65
|
};
|
|
66
|
-
/**
|
|
67
|
-
* @deprecated Compatibility alias for the pre-whitelist public API.
|
|
68
|
-
* Use `MAINNET_MINTS` / `DEVNET_MINTS` / `ASSET_WHITELIST` instead.
|
|
69
|
-
*/
|
|
70
|
-
export declare const USDC_MINTS: {
|
|
71
|
-
readonly 'solana-mainnet': "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v";
|
|
72
|
-
readonly 'solana-devnet': "7ZjP2eJnQrW1SuE1kAP7tdrQuhkTVpco1NQKGjEMHpgg";
|
|
73
|
-
};
|
|
74
66
|
/**
|
|
75
67
|
* The payment whitelist, keyed by cluster. Closed list — an offer in
|
|
76
68
|
* any other asset is rejected server-side
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { KeyLinkPayload, ScryptPasswordAttestation } from '../types/identity';
|
|
2
2
|
/**
|
|
3
3
|
* Build an `ARP-KEY-LINK-v1` attestation record signed via
|
|
4
|
-
* `scrypt_password_proof
|
|
4
|
+
* `scrypt_password_proof`. Caller assembles the payload
|
|
5
5
|
* (DID, both pubkeys, nonce, etc.); SDK produces the MAC
|
|
6
6
|
* and wraps the record in the standard shape.
|
|
7
7
|
*
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Derive the scrypt key from an owner's password + salt. Uses
|
|
2
|
+
* Derive the scrypt key from an owner's password + salt. Uses the
|
|
3
3
|
* standard parameters: N=32768, r=8, p=1, dkLen=32. Designed to be
|
|
4
4
|
* computed once at owner registration time and stored encrypted-at-rest;
|
|
5
5
|
* subsequent attestation verification recomputes the HMAC, not scrypt.
|
|
6
6
|
*
|
|
7
|
-
* Synchronous variant is intentional —
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
7
|
+
* Synchronous variant is intentional — keys derive at low frequency
|
|
8
|
+
* (once per owner registration); the worst case is a few hundred ms
|
|
9
|
+
* which is acceptable. Async variants can be layered on top by the
|
|
10
|
+
* consumer if needed.
|
|
11
11
|
*/
|
|
12
12
|
export declare function deriveScryptKey(password: string, salt: Uint8Array): Uint8Array;
|
|
13
13
|
/**
|
|
@@ -14,7 +14,7 @@ import type { AssetIdentifier } from '../types';
|
|
|
14
14
|
* mint are bound on-chain at lock time (create_lock binds
|
|
15
15
|
* `amount` u64 + `mint` 32B) and on-chain in the Lock account. The
|
|
16
16
|
* condition_hash binds the agreed TERMS (scope / currency), not
|
|
17
|
-
* the amount. (Settlement is always escrow
|
|
17
|
+
* the amount. (Settlement is always escrow — no `settlement_model`.
|
|
18
18
|
* The per-unit rate card — `rateAmount` / `rateUnit` — is NOT bound either:
|
|
19
19
|
* nothing enforces it, so it stays out of the subset.)
|
|
20
20
|
*
|
|
@@ -23,11 +23,11 @@ import type { AssetIdentifier } from '../types';
|
|
|
23
23
|
*/
|
|
24
24
|
export interface DelegationTermsSubset {
|
|
25
25
|
/**
|
|
26
|
-
* Domain/version tag baked INTO the hashed bytes.
|
|
27
|
-
* pricing-model concept
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
26
|
+
* Domain/version tag baked INTO the hashed bytes. The terms carry no
|
|
27
|
+
* pricing-model concept (flat is the protocol's only semantics, not a
|
|
28
|
+
* setting). The tag gives future term-set changes an explicit version
|
|
29
|
+
* knob and prevents collisions across tag values over
|
|
30
|
+
* otherwise-identical fields.
|
|
31
31
|
*/
|
|
32
32
|
v: 'arp-condition-v2';
|
|
33
33
|
delegationId: string;
|
|
@@ -57,11 +57,11 @@ export interface DelegationTermsInput {
|
|
|
57
57
|
* delegation shape MUST NOT change `condition_hash` for existing
|
|
58
58
|
* delegations.
|
|
59
59
|
*
|
|
60
|
-
* Runs in
|
|
61
|
-
* offer-prep (CLI)
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
* →
|
|
60
|
+
* Runs in two places that MUST agree byte-for-byte: the buyer's
|
|
61
|
+
* offer-prep (CLI) — which writes the hash into the `create_lock` tx —
|
|
62
|
+
* and the server's `delegation.offer` validation (recompute + compare
|
|
63
|
+
* to the on-chain bound hash). Any field-set drift produces a different
|
|
64
|
+
* hash → the server rejects the offer.
|
|
65
65
|
*
|
|
66
66
|
* @returns 32-byte condition_hash
|
|
67
67
|
*/
|
package/dist/escrow/lock-id.d.ts
CHANGED
|
@@ -10,12 +10,11 @@
|
|
|
10
10
|
* seeded by `[<seed_prefix>, lock_id]`).
|
|
11
11
|
* - Server derives it independently when validating the offer's
|
|
12
12
|
* `attachments.escrow_lock.lock_id` claim.
|
|
13
|
-
* - Payee derives it
|
|
14
|
-
* the lock account and to feed into the settlement digest).
|
|
13
|
+
* - Payee derives it to look up the lock account on-chain.
|
|
15
14
|
*
|
|
16
|
-
* Versioning: `"arp-lock-v1"` is a permanent literal
|
|
17
|
-
*
|
|
18
|
-
*
|
|
15
|
+
* Versioning: `"arp-lock-v1"` is a permanent literal baked into the
|
|
16
|
+
* hash input. Changing the prefix would derive different lock_ids for
|
|
17
|
+
* the same delegation, so it is fixed.
|
|
19
18
|
*
|
|
20
19
|
* @param delegationId — `del_<uuid>` string form (e.g. `del_550e8400-e29b-41d4-a716-446655440000`).
|
|
21
20
|
* The wire-form prefix is part of the hash input
|
|
@@ -26,8 +25,8 @@
|
|
|
26
25
|
*/
|
|
27
26
|
export declare function deriveLockId(delegationId: string): Uint8Array;
|
|
28
27
|
/**
|
|
29
|
-
* Convert a delegation id to the 16-byte representation the
|
|
30
|
-
*
|
|
28
|
+
* Convert a delegation id to the 16-byte representation used as the
|
|
29
|
+
* `bytes16 delegation_id` lock-id substrate. RFC 4122 UUIDs are
|
|
31
30
|
* 128 bits = 16 bytes; the string form is 36 chars (32 hex + 4 dashes).
|
|
32
31
|
*
|
|
33
32
|
* Accepts BOTH wire-form variants the protocol uses:
|
package/dist/index.js
CHANGED
|
@@ -156,9 +156,9 @@ function verifyEnvelope(envelope, senderIdentityPubkey) {
|
|
|
156
156
|
var Purpose = {
|
|
157
157
|
/** Default for `protected.purpose` on body messages. */
|
|
158
158
|
ENVELOPE: "ARP-ENVELOPE-v1",
|
|
159
|
-
/** Receipt
|
|
159
|
+
/** Receipt domain separator (delegation completion). */
|
|
160
160
|
RECEIPT: "ARP-RECEIPT-v1",
|
|
161
|
-
/** Dispute response
|
|
161
|
+
/** Dispute response domain separator. */
|
|
162
162
|
DISPUTE_RESPONSE: "ARP-DISPUTE-RESPONSE-v1",
|
|
163
163
|
/** Identity ownership challenge proof. */
|
|
164
164
|
CHALLENGE: "ARP-CHALLENGE-v1",
|
|
@@ -168,27 +168,14 @@ var Purpose = {
|
|
|
168
168
|
KEY_LINK: "ARP-KEY-LINK-v1",
|
|
169
169
|
/**
|
|
170
170
|
* Settlement-key signature authorising an on-chain `release_lock`.
|
|
171
|
-
*
|
|
171
|
+
* The digest binds fee_bps_at_lock + fee_recipient_at_lock.
|
|
172
172
|
*/
|
|
173
173
|
SOLANA_RELEASE: "ARP-SOLANA-RELEASE-v1.5",
|
|
174
|
-
/**
|
|
175
|
-
* Settlement-key signature authorising an on-chain `partial_release`.
|
|
176
|
-
* V1.5 — digest now binds fee_bps_at_lock + fee_recipient_at_lock.
|
|
177
|
-
*/
|
|
178
|
-
SOLANA_PARTIAL_RELEASE: "ARP-SOLANA-PARTIAL-RELEASE-v1.5",
|
|
179
174
|
/** Settlement-key signature authorising an on-chain co-signed `refund_lock`. */
|
|
180
175
|
SOLANA_REFUND: "ARP-SOLANA-REFUND-v1",
|
|
181
176
|
/** Admin (platform multisig) signature authorising `resolve_dispute`. */
|
|
182
177
|
SOLANA_RESOLVE_DISPUTE: "ARP-SOLANA-RESOLVE-DISPUTE-v1"
|
|
183
178
|
};
|
|
184
|
-
var PROTECTED_PURPOSES = [Purpose.ENVELOPE];
|
|
185
|
-
var COSIGNATURE_PURPOSES = [Purpose.RECEIPT, Purpose.DISPUTE_RESPONSE];
|
|
186
|
-
var SETTLEMENT_PURPOSES = [
|
|
187
|
-
Purpose.SOLANA_RELEASE,
|
|
188
|
-
Purpose.SOLANA_PARTIAL_RELEASE,
|
|
189
|
-
Purpose.SOLANA_REFUND,
|
|
190
|
-
Purpose.SOLANA_RESOLVE_DISPUTE
|
|
191
|
-
];
|
|
192
179
|
|
|
193
180
|
// src/challenge/challenge.ts
|
|
194
181
|
var CHALLENGE_PURPOSE_BYTES = new TextEncoder().encode(Purpose.CHALLENGE);
|
|
@@ -444,10 +431,6 @@ var MAINNET_MINTS = {
|
|
|
444
431
|
var DEVNET_MINTS = {
|
|
445
432
|
USDC: "7ZjP2eJnQrW1SuE1kAP7tdrQuhkTVpco1NQKGjEMHpgg"
|
|
446
433
|
};
|
|
447
|
-
var USDC_MINTS = {
|
|
448
|
-
"solana-mainnet": MAINNET_MINTS.USDC,
|
|
449
|
-
"solana-devnet": DEVNET_MINTS.USDC
|
|
450
|
-
};
|
|
451
434
|
var SOL_MAINNET = {
|
|
452
435
|
asset_id: `solana:${SOLANA_CLUSTER_IDS["solana-mainnet"]}/slip44:${SLIP44_SOLANA}`,
|
|
453
436
|
decimals: 9,
|
|
@@ -730,7 +713,6 @@ function readU64LE(buf, off) {
|
|
|
730
713
|
|
|
731
714
|
exports.ASSET_WHITELIST = ASSET_WHITELIST;
|
|
732
715
|
exports.CAIP19_REGEX = CAIP19_REGEX;
|
|
733
|
-
exports.COSIGNATURE_PURPOSES = COSIGNATURE_PURPOSES;
|
|
734
716
|
exports.CREATE_LOCK_DISCRIMINATOR = CREATE_LOCK_DISCRIMINATOR;
|
|
735
717
|
exports.CREATE_LOCK_NATIVE_DISCRIMINATOR = CREATE_LOCK_NATIVE_DISCRIMINATOR;
|
|
736
718
|
exports.DECLINE_REASONS = DECLINE_REASONS;
|
|
@@ -743,14 +725,11 @@ exports.LOCK_TERMINAL_STATES = LOCK_TERMINAL_STATES;
|
|
|
743
725
|
exports.MAINNET_MINTS = MAINNET_MINTS;
|
|
744
726
|
exports.NATIVE_SOL_MINT_BASE58 = NATIVE_SOL_MINT_BASE58;
|
|
745
727
|
exports.NO_ARG_LIFECYCLE_INSTRUCTIONS = NO_ARG_LIFECYCLE_INSTRUCTIONS;
|
|
746
|
-
exports.PROTECTED_PURPOSES = PROTECTED_PURPOSES;
|
|
747
728
|
exports.Purpose = Purpose;
|
|
748
729
|
exports.SCRYPT_PARAMS = SCRYPT_PARAMS;
|
|
749
|
-
exports.SETTLEMENT_PURPOSES = SETTLEMENT_PURPOSES;
|
|
750
730
|
exports.SLIP44_SOLANA = SLIP44_SOLANA;
|
|
751
731
|
exports.SOLANA_CLUSTER_IDS = SOLANA_CLUSTER_IDS;
|
|
752
732
|
exports.SPL_TOKEN_PROGRAM_ID_BASE58 = SPL_TOKEN_PROGRAM_ID_BASE58;
|
|
753
|
-
exports.USDC_MINTS = USDC_MINTS;
|
|
754
733
|
exports.WELL_KNOWN_ASSETS = WELL_KNOWN_ASSETS;
|
|
755
734
|
exports.WELL_KNOWN_ASSET_KEYS = WELL_KNOWN_ASSET_KEYS;
|
|
756
735
|
exports.base58btcDecode = base58btcDecode;
|
package/dist/index.mjs
CHANGED
|
@@ -131,9 +131,9 @@ function verifyEnvelope(envelope, senderIdentityPubkey) {
|
|
|
131
131
|
var Purpose = {
|
|
132
132
|
/** Default for `protected.purpose` on body messages. */
|
|
133
133
|
ENVELOPE: "ARP-ENVELOPE-v1",
|
|
134
|
-
/** Receipt
|
|
134
|
+
/** Receipt domain separator (delegation completion). */
|
|
135
135
|
RECEIPT: "ARP-RECEIPT-v1",
|
|
136
|
-
/** Dispute response
|
|
136
|
+
/** Dispute response domain separator. */
|
|
137
137
|
DISPUTE_RESPONSE: "ARP-DISPUTE-RESPONSE-v1",
|
|
138
138
|
/** Identity ownership challenge proof. */
|
|
139
139
|
CHALLENGE: "ARP-CHALLENGE-v1",
|
|
@@ -143,27 +143,14 @@ var Purpose = {
|
|
|
143
143
|
KEY_LINK: "ARP-KEY-LINK-v1",
|
|
144
144
|
/**
|
|
145
145
|
* Settlement-key signature authorising an on-chain `release_lock`.
|
|
146
|
-
*
|
|
146
|
+
* The digest binds fee_bps_at_lock + fee_recipient_at_lock.
|
|
147
147
|
*/
|
|
148
148
|
SOLANA_RELEASE: "ARP-SOLANA-RELEASE-v1.5",
|
|
149
|
-
/**
|
|
150
|
-
* Settlement-key signature authorising an on-chain `partial_release`.
|
|
151
|
-
* V1.5 — digest now binds fee_bps_at_lock + fee_recipient_at_lock.
|
|
152
|
-
*/
|
|
153
|
-
SOLANA_PARTIAL_RELEASE: "ARP-SOLANA-PARTIAL-RELEASE-v1.5",
|
|
154
149
|
/** Settlement-key signature authorising an on-chain co-signed `refund_lock`. */
|
|
155
150
|
SOLANA_REFUND: "ARP-SOLANA-REFUND-v1",
|
|
156
151
|
/** Admin (platform multisig) signature authorising `resolve_dispute`. */
|
|
157
152
|
SOLANA_RESOLVE_DISPUTE: "ARP-SOLANA-RESOLVE-DISPUTE-v1"
|
|
158
153
|
};
|
|
159
|
-
var PROTECTED_PURPOSES = [Purpose.ENVELOPE];
|
|
160
|
-
var COSIGNATURE_PURPOSES = [Purpose.RECEIPT, Purpose.DISPUTE_RESPONSE];
|
|
161
|
-
var SETTLEMENT_PURPOSES = [
|
|
162
|
-
Purpose.SOLANA_RELEASE,
|
|
163
|
-
Purpose.SOLANA_PARTIAL_RELEASE,
|
|
164
|
-
Purpose.SOLANA_REFUND,
|
|
165
|
-
Purpose.SOLANA_RESOLVE_DISPUTE
|
|
166
|
-
];
|
|
167
154
|
|
|
168
155
|
// src/challenge/challenge.ts
|
|
169
156
|
var CHALLENGE_PURPOSE_BYTES = new TextEncoder().encode(Purpose.CHALLENGE);
|
|
@@ -419,10 +406,6 @@ var MAINNET_MINTS = {
|
|
|
419
406
|
var DEVNET_MINTS = {
|
|
420
407
|
USDC: "7ZjP2eJnQrW1SuE1kAP7tdrQuhkTVpco1NQKGjEMHpgg"
|
|
421
408
|
};
|
|
422
|
-
var USDC_MINTS = {
|
|
423
|
-
"solana-mainnet": MAINNET_MINTS.USDC,
|
|
424
|
-
"solana-devnet": DEVNET_MINTS.USDC
|
|
425
|
-
};
|
|
426
409
|
var SOL_MAINNET = {
|
|
427
410
|
asset_id: `solana:${SOLANA_CLUSTER_IDS["solana-mainnet"]}/slip44:${SLIP44_SOLANA}`,
|
|
428
411
|
decimals: 9,
|
|
@@ -703,4 +686,4 @@ function readU64LE(buf, off) {
|
|
|
703
686
|
return v;
|
|
704
687
|
}
|
|
705
688
|
|
|
706
|
-
export { ASSET_WHITELIST, CAIP19_REGEX,
|
|
689
|
+
export { ASSET_WHITELIST, CAIP19_REGEX, CREATE_LOCK_DISCRIMINATOR, CREATE_LOCK_NATIVE_DISCRIMINATOR, DECLINE_REASONS, DEVNET_MINTS, ESCROW_PDA_SEEDS, LOCK_ACCOUNT_DISCRIMINATOR, LOCK_ACCOUNT_SIZE, LOCK_STATE_NAMES, LOCK_TERMINAL_STATES, MAINNET_MINTS, NATIVE_SOL_MINT_BASE58, NO_ARG_LIFECYCLE_INSTRUCTIONS, Purpose, SCRYPT_PARAMS, SLIP44_SOLANA, SOLANA_CLUSTER_IDS, SPL_TOKEN_PROGRAM_ID_BASE58, WELL_KNOWN_ASSETS, WELL_KNOWN_ASSET_KEYS, base58btcDecode, base58btcEncode, buildCreateLockIxData, buildLifecycleIxData, buildResolveDisputeIxData, bytes16ToDelegationId, canonicalBytes, canonicalJson, canonicalSha256Hex, computeCreateLockDiscriminator, computeLockAccountDiscriminator, decodeLockAccount, delegationIdToBytes16, deriveDelegationConditionHash, deriveLockId, deriveScryptKey, detectTokenProgramFromOwner, detectTokenProgramFromOwnerBytes, expiresAt, findAssetByAssetId, findFirstChainDivergence, formatDid, generateKeyPair, getPublicKey2 as getPublicKey, instructionDiscriminator, isAssetIdentifier, isDeclineReason, isValidDid, isWhitelistedAssetId, listWhitelistedAssets, parseCaip19SolanaAssetId, parseDid, pollUntil, resolveAsset, rfc3339, scryptPasswordProofSign, scryptPasswordProofVerify, senderNonce, serverEventHash, sign2 as sign, signChallenge, signEnvelope, signKeyLinkAttestation, signedMessageHash, uuidV4, verify2 as verify, verifyChallenge, verifyEnvelope, verifyKeyLinkAttestation };
|
package/dist/purpose.d.ts
CHANGED
|
@@ -13,9 +13,9 @@
|
|
|
13
13
|
export declare const Purpose: {
|
|
14
14
|
/** Default for `protected.purpose` on body messages. */
|
|
15
15
|
readonly ENVELOPE: "ARP-ENVELOPE-v1";
|
|
16
|
-
/** Receipt
|
|
16
|
+
/** Receipt domain separator (delegation completion). */
|
|
17
17
|
readonly RECEIPT: "ARP-RECEIPT-v1";
|
|
18
|
-
/** Dispute response
|
|
18
|
+
/** Dispute response domain separator. */
|
|
19
19
|
readonly DISPUTE_RESPONSE: "ARP-DISPUTE-RESPONSE-v1";
|
|
20
20
|
/** Identity ownership challenge proof. */
|
|
21
21
|
readonly CHALLENGE: "ARP-CHALLENGE-v1";
|
|
@@ -25,24 +25,12 @@ export declare const Purpose: {
|
|
|
25
25
|
readonly KEY_LINK: "ARP-KEY-LINK-v1";
|
|
26
26
|
/**
|
|
27
27
|
* Settlement-key signature authorising an on-chain `release_lock`.
|
|
28
|
-
*
|
|
28
|
+
* The digest binds fee_bps_at_lock + fee_recipient_at_lock.
|
|
29
29
|
*/
|
|
30
30
|
readonly SOLANA_RELEASE: "ARP-SOLANA-RELEASE-v1.5";
|
|
31
|
-
/**
|
|
32
|
-
* Settlement-key signature authorising an on-chain `partial_release`.
|
|
33
|
-
* V1.5 — digest now binds fee_bps_at_lock + fee_recipient_at_lock.
|
|
34
|
-
*/
|
|
35
|
-
readonly SOLANA_PARTIAL_RELEASE: "ARP-SOLANA-PARTIAL-RELEASE-v1.5";
|
|
36
31
|
/** Settlement-key signature authorising an on-chain co-signed `refund_lock`. */
|
|
37
32
|
readonly SOLANA_REFUND: "ARP-SOLANA-REFUND-v1";
|
|
38
33
|
/** Admin (platform multisig) signature authorising `resolve_dispute`. */
|
|
39
34
|
readonly SOLANA_RESOLVE_DISPUTE: "ARP-SOLANA-RESOLVE-DISPUTE-v1";
|
|
40
35
|
};
|
|
41
36
|
export type PurposeValue = (typeof Purpose)[keyof typeof Purpose];
|
|
42
|
-
/**
|
|
43
|
-
* `protected.purpose` accepts a subset — the others are payload-level
|
|
44
|
-
* (co-signature / settlement-signature).
|
|
45
|
-
*/
|
|
46
|
-
export declare const PROTECTED_PURPOSES: readonly PurposeValue[];
|
|
47
|
-
export declare const COSIGNATURE_PURPOSES: readonly PurposeValue[];
|
|
48
|
-
export declare const SETTLEMENT_PURPOSES: readonly PurposeValue[];
|
package/dist/types/body.d.ts
CHANGED
|
@@ -7,14 +7,15 @@
|
|
|
7
7
|
* validation — those checks belong to the consumer (typically the
|
|
8
8
|
* backend's MessageService); SDK provides only the static types.
|
|
9
9
|
*/
|
|
10
|
-
import type { Body,
|
|
10
|
+
import type { Body, Sha256Hex } from './envelope';
|
|
11
11
|
/**
|
|
12
12
|
* Chain-qualified asset identifier carried by `delegation.currency`
|
|
13
|
-
* (the single asset for both rate + amount).
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
13
|
+
* (the single asset for both rate + amount). A plain ticker string like
|
|
14
|
+
* `'USDC'` can't disambiguate `USDC on Solana mainnet` from `USDC on
|
|
15
|
+
* Polygon` or `USDC.e bridged on Avalanche` (all the same ticker,
|
|
16
|
+
* different on-chain assets), and can't represent native tokens (SOL,
|
|
17
|
+
* ETH) where `slip44` is the canonical asset namespace; this CAIP-19
|
|
18
|
+
* shape can.
|
|
18
19
|
*
|
|
19
20
|
* Fields:
|
|
20
21
|
* - `asset_id` — [CAIP-19](https://github.com/ChainAgnostic/CAIPs/blob/main/CAIPs/caip-19.md)
|
|
@@ -43,7 +44,7 @@ export interface AssetIdentifier {
|
|
|
43
44
|
}
|
|
44
45
|
/**
|
|
45
46
|
* Closed enum of machine-readable decline reasons used across the
|
|
46
|
-
* two decline sites
|
|
47
|
+
* two decline sites:
|
|
47
48
|
* • `handshake_response.content.decision === 'decline'`
|
|
48
49
|
* • `delegation.content.action === 'decline'`
|
|
49
50
|
*
|
|
@@ -53,7 +54,7 @@ export interface AssetIdentifier {
|
|
|
53
54
|
* parsing free-text. The companion `reason_detail` field carries any
|
|
54
55
|
* additional context the sender wants to surface.
|
|
55
56
|
*
|
|
56
|
-
* Closed list
|
|
57
|
+
* Closed list — adding a value bumps the SDK and the server
|
|
57
58
|
* validator's allowlist. The intent of `unspecified` is for senders
|
|
58
59
|
* that genuinely have no useful detail (still better than no reason
|
|
59
60
|
* at all); `other` means "see `reason_detail` for the specifics".
|
|
@@ -158,9 +159,9 @@ export interface WorkResponseContent {
|
|
|
158
159
|
}
|
|
159
160
|
/**
|
|
160
161
|
* `receipt` — payee-signed message describing completed work. The
|
|
161
|
-
*
|
|
162
|
-
*
|
|
163
|
-
*
|
|
162
|
+
* payee's proposed verdict (`verdict_proposed`) is binding; settlement
|
|
163
|
+
* happens on-chain via `claim_work_payment`, gated by who sends the
|
|
164
|
+
* claim transaction inside which time window.
|
|
164
165
|
*/
|
|
165
166
|
export interface ReceiptBody extends Body<ReceiptContent> {
|
|
166
167
|
type: 'receipt';
|
|
@@ -193,7 +194,7 @@ export interface DisputeContent {
|
|
|
193
194
|
dispute_id: string;
|
|
194
195
|
delegation_id: string;
|
|
195
196
|
claim?: string;
|
|
196
|
-
remedy_requested?: 'refund' | 'rework' | '
|
|
197
|
+
remedy_requested?: 'refund' | 'rework' | 'release';
|
|
197
198
|
evidence_refs?: string[];
|
|
198
199
|
response_text?: string;
|
|
199
200
|
}
|
|
@@ -202,21 +203,3 @@ export interface DisputeContent {
|
|
|
202
203
|
* `body.type` via discriminated dispatch.
|
|
203
204
|
*/
|
|
204
205
|
export type AnyBody = HandshakeBody | HandshakeResponseBody | DelegationBody | WorkRequestBody | WorkResponseBody | ReceiptBody | DisputeBody;
|
|
205
|
-
/** Receipt co-signature payload — what gets `payload_hash`'d in `attachments.co_signature`. */
|
|
206
|
-
export interface ReceiptCosignPayload {
|
|
207
|
-
purpose: 'ARP-RECEIPT-v1';
|
|
208
|
-
delegation_id: string;
|
|
209
|
-
receipt_event_hash: Sha256Hex;
|
|
210
|
-
verdict: 'accepted' | 'accepted_with_notes' | 'rejected';
|
|
211
|
-
notes_hash: Sha256Hex | null;
|
|
212
|
-
}
|
|
213
|
-
/** Dispute response co-signature payload — analogous shape for `ARP-DISPUTE-RESPONSE-v1`. */
|
|
214
|
-
export interface DisputeResponseCosignPayload {
|
|
215
|
-
purpose: 'ARP-DISPUTE-RESPONSE-v1';
|
|
216
|
-
dispute_id: string;
|
|
217
|
-
dispute_event_hash: Sha256Hex;
|
|
218
|
-
stance: 'accept' | 'reject' | 'partial';
|
|
219
|
-
notes_hash: Sha256Hex | null;
|
|
220
|
-
responder_did: Did;
|
|
221
|
-
}
|
|
222
|
-
export type CosignPayload = ReceiptCosignPayload | DisputeResponseCosignPayload;
|
package/dist/types/envelope.d.ts
CHANGED
|
@@ -43,14 +43,12 @@ export interface Body<TContent = Record<string, unknown>> {
|
|
|
43
43
|
content: TContent;
|
|
44
44
|
}
|
|
45
45
|
/**
|
|
46
|
-
* Optional attachments.
|
|
47
|
-
* `
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
* passed through opaquely.
|
|
46
|
+
* Optional attachments. One top-level field is SDK-aware:
|
|
47
|
+
* `escrow_lock` (`delegation.offer` carries a pre-signed `create_lock`
|
|
48
|
+
* Solana tx). Other body-specific attachments live under their own
|
|
49
|
+
* keys and are passed through opaquely.
|
|
51
50
|
*/
|
|
52
51
|
export interface Attachments {
|
|
53
|
-
co_signature?: CoSignature;
|
|
54
52
|
escrow_lock?: EscrowLockAttachment;
|
|
55
53
|
[other: string]: unknown;
|
|
56
54
|
}
|
|
@@ -68,7 +66,7 @@ export interface Attachments {
|
|
|
68
66
|
* - `asset_id` is the CAIP-19 currency the lock holds; must equal
|
|
69
67
|
* `body.content.currency.asset_id` (defence-in-depth).
|
|
70
68
|
*
|
|
71
|
-
* There is NO expiry field: the
|
|
69
|
+
* There is NO expiry field: the contract's `create_lock` carries no
|
|
72
70
|
* expiry argument. `Lock.expiry` is a rolling deadline the chain
|
|
73
71
|
* derives from the Config windows on each state transition
|
|
74
72
|
* (`accept_lock` → work window, `submit_work` → review window, …).
|
|
@@ -82,12 +80,6 @@ export interface EscrowLockAttachment {
|
|
|
82
80
|
amount: string;
|
|
83
81
|
asset_id: string;
|
|
84
82
|
}
|
|
85
|
-
export interface CoSignature {
|
|
86
|
-
agent_did: Did;
|
|
87
|
-
purpose: PurposeValue;
|
|
88
|
-
payload_hash: Sha256Hex;
|
|
89
|
-
sig: Ed25519Sig;
|
|
90
|
-
}
|
|
91
83
|
/** Top-level envelope as it appears on the wire. */
|
|
92
84
|
export interface Envelope<TBody extends Body = Body> {
|
|
93
85
|
protected: ProtectedBlock;
|
package/dist/types/identity.d.ts
CHANGED
|
@@ -2,8 +2,8 @@ import type { Did } from './envelope';
|
|
|
2
2
|
/**
|
|
3
3
|
* Owner attestation methods per [00-core/identity.md](../../../00-core/identity.md).
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
* placeholders for forward-compat
|
|
5
|
+
* Only `scrypt_password_proof` is active; the others are reserved
|
|
6
|
+
* placeholders for forward-compat.
|
|
7
7
|
*/
|
|
8
8
|
export type OwnerSigningMethod = 'scrypt_password_proof' | 'ed25519_owner_key' | 'totp+passphrase';
|
|
9
9
|
/**
|
|
@@ -22,7 +22,7 @@ export interface KeyLinkPayload {
|
|
|
22
22
|
nonce: string;
|
|
23
23
|
}
|
|
24
24
|
/**
|
|
25
|
-
* `scrypt_password_proof` — the
|
|
25
|
+
* `scrypt_password_proof` — the owner attestation envelope. The
|
|
26
26
|
* signature is HMAC-SHA256(scrypt(password, salt), sha256(canonical(payload))),
|
|
27
27
|
* base64-encoded. NOT an Ed25519 signature; verification is
|
|
28
28
|
* server-side via the stored scrypt-derived key.
|
|
@@ -32,7 +32,7 @@ export interface ScryptPasswordAttestation<TPayload extends KeyLinkPayload = Key
|
|
|
32
32
|
sig: string;
|
|
33
33
|
scrypt_salt_id: string;
|
|
34
34
|
}
|
|
35
|
-
/** Standard scrypt parameters used for owner password proofs
|
|
35
|
+
/** Standard scrypt parameters used for owner password proofs. */
|
|
36
36
|
export declare const SCRYPT_PARAMS: {
|
|
37
37
|
readonly N: 32768;
|
|
38
38
|
readonly r: 8;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export type { Sha256Hex, Ed25519Sig, Did, ProtectedBlock, Body, Attachments,
|
|
2
|
-
export type { HandshakeBody, HandshakeContent, HandshakeResponseBody, HandshakeResponseContent, DelegationBody, DelegationContent, WorkRequestBody, WorkRequestContent, WorkResponseBody, WorkResponseContent, ReceiptBody, ReceiptContent, DisputeBody, DisputeContent, AnyBody,
|
|
1
|
+
export type { Sha256Hex, Ed25519Sig, Did, ProtectedBlock, Body, Attachments, EscrowLockAttachment, Envelope, PersistedEvent, } from './envelope';
|
|
2
|
+
export type { HandshakeBody, HandshakeContent, HandshakeResponseBody, HandshakeResponseContent, DelegationBody, DelegationContent, WorkRequestBody, WorkRequestContent, WorkResponseBody, WorkResponseContent, ReceiptBody, ReceiptContent, DisputeBody, DisputeContent, AnyBody, DeclineReason, AssetIdentifier, } from './body';
|
|
3
3
|
export { DECLINE_REASONS, isDeclineReason } from './body';
|
|
4
4
|
export type { AcceptPrefs, AcceptCurrency } from './agent';
|
|
5
5
|
export type { OwnerSigningMethod, KeyLinkPayload, ScryptPasswordAttestation } from './identity';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@heyanon-arp/sdk",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.13",
|
|
4
4
|
"description": "TypeScript SDK for the Agent Relationship Protocol — canonical JSON, Ed25519 envelope sign/verify, did:arp identity, receipt co-signatures, scrypt key attestation, chain-audit helpers.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"keywords": [
|