@heyanon-arp/sdk 0.0.6 → 0.0.7
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/attestation/attestation.d.ts +4 -16
- package/dist/attestation/index.d.ts +1 -1
- package/dist/did/document.d.ts +4 -6
- package/dist/did/format.d.ts +2 -2
- package/dist/did/index.d.ts +1 -1
- package/dist/envelope/verify.d.ts +3 -3
- package/dist/escrow/condition-hash.d.ts +4 -8
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -23
- package/dist/index.mjs +3 -22
- package/dist/purpose.d.ts +0 -2
- package/dist/types/body.d.ts +4 -7
- package/dist/types/identity.d.ts +1 -21
- package/dist/types/index.d.ts +1 -1
- package/dist/utils/nonce.d.ts +3 -3
- package/package.json +1 -1
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import type { KeyLinkPayload,
|
|
1
|
+
import type { KeyLinkPayload, ScryptPasswordAttestation } from '../types/identity';
|
|
2
2
|
/**
|
|
3
3
|
* Build an `ARP-KEY-LINK-v1` attestation record signed via
|
|
4
4
|
* `scrypt_password_proof` (V1 default). Caller assembles the payload
|
|
5
5
|
* (DID, both pubkeys, owner_id, nonce, etc.); SDK produces the MAC
|
|
6
6
|
* and wraps the record in the standard shape.
|
|
7
7
|
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
8
|
+
* Identity keys are immutable in alpha (no rotation); the KEY-LINK
|
|
9
|
+
* attestation is the single owner-signed link between identity and
|
|
10
|
+
* settlement keys, established once at registration.
|
|
11
11
|
*/
|
|
12
12
|
export declare function signKeyLinkAttestation(input: {
|
|
13
13
|
payload: KeyLinkPayload;
|
|
@@ -15,15 +15,3 @@ export declare function signKeyLinkAttestation(input: {
|
|
|
15
15
|
scryptSaltId: string;
|
|
16
16
|
}): ScryptPasswordAttestation<KeyLinkPayload>;
|
|
17
17
|
export declare function verifyKeyLinkAttestation(attestation: ScryptPasswordAttestation<KeyLinkPayload>, scryptKey: Uint8Array): boolean;
|
|
18
|
-
/**
|
|
19
|
-
* Build an `ARP-KEY-ROTATION-v1` attestation. Same scrypt+HMAC
|
|
20
|
-
* mechanics as KEY-LINK but with rotation-specific payload fields
|
|
21
|
-
* (`current_identity_public_key` + `new_identity_public_key` +
|
|
22
|
-
* `supersedes_attestation_id`). The DID stays frozen.
|
|
23
|
-
*/
|
|
24
|
-
export declare function signKeyRotationAttestation(input: {
|
|
25
|
-
payload: KeyRotationPayload;
|
|
26
|
-
scryptKey: Uint8Array;
|
|
27
|
-
scryptSaltId: string;
|
|
28
|
-
}): ScryptPasswordAttestation<KeyRotationPayload>;
|
|
29
|
-
export declare function verifyKeyRotationAttestation(attestation: ScryptPasswordAttestation<KeyRotationPayload>, scryptKey: Uint8Array): boolean;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { deriveScryptKey, scryptPasswordProofSign, scryptPasswordProofVerify } from './scrypt-proof';
|
|
2
|
-
export { signKeyLinkAttestation, verifyKeyLinkAttestation
|
|
2
|
+
export { signKeyLinkAttestation, verifyKeyLinkAttestation } from './attestation';
|
package/dist/did/document.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* DID document shape per [00-core/identity.md](../../../00-core/identity.md).
|
|
3
3
|
*
|
|
4
|
-
* Returned by the platform's DID resolver. Verification uses
|
|
5
|
-
* `
|
|
6
|
-
*
|
|
7
|
-
*
|
|
4
|
+
* Returned by the platform's DID resolver. Verification uses the
|
|
5
|
+
* `identity` verification method from the document. Identity keys are
|
|
6
|
+
* immutable in alpha (no rotation), so it always matches `decoded(did)`;
|
|
7
|
+
* resolving via the document keeps a single source of truth.
|
|
8
8
|
*
|
|
9
9
|
* No `service[]` endpoint: delivery is server-mediated and agents
|
|
10
10
|
* pull (poll/SSE inbox), so there is no per-agent inbound endpoint
|
|
@@ -14,12 +14,10 @@ export interface DidDocument {
|
|
|
14
14
|
id: string;
|
|
15
15
|
verificationMethod: VerificationMethod[];
|
|
16
16
|
metadata: {
|
|
17
|
-
key_mode: KeyMode;
|
|
18
17
|
owner_attestation_id: string;
|
|
19
18
|
registered_at: string;
|
|
20
19
|
};
|
|
21
20
|
}
|
|
22
|
-
export type KeyMode = 'single_key' | 'separated_soft' | 'separated_hard' | 'policy_controlled';
|
|
23
21
|
export interface VerificationMethod {
|
|
24
22
|
id: string;
|
|
25
23
|
type: 'Ed25519VerificationKey2020';
|
package/dist/did/format.d.ts
CHANGED
|
@@ -17,7 +17,7 @@ export declare function formatDid(identityPublicKey: Uint8Array): string;
|
|
|
17
17
|
export declare function parseDid(did: string): Uint8Array | null;
|
|
18
18
|
/**
|
|
19
19
|
* Validate a string as a syntactically well-formed `did:arp:` DID.
|
|
20
|
-
* Does not check the underlying pubkey is registered
|
|
21
|
-
*
|
|
20
|
+
* Does not check the underlying pubkey is registered — that is a
|
|
21
|
+
* server-side concern.
|
|
22
22
|
*/
|
|
23
23
|
export declare function isValidDid(did: string): boolean;
|
package/dist/did/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { formatDid, parseDid, isValidDid } from './format';
|
|
2
|
-
export type { DidDocument,
|
|
2
|
+
export type { DidDocument, VerificationMethod } from './document';
|
|
@@ -30,8 +30,8 @@ export type VerifyResult = {
|
|
|
30
30
|
* application-layer concerns; this function focuses on the bytes.
|
|
31
31
|
*
|
|
32
32
|
* `senderIdentityPubkey` MUST be 32 bytes. Callers resolve it via the
|
|
33
|
-
* DID document
|
|
34
|
-
*
|
|
35
|
-
* (
|
|
33
|
+
* DID document's `identity` verification method, keeping a single source
|
|
34
|
+
* of truth ([00-core/identity.md](../../../00-core/identity.md)). Identity
|
|
35
|
+
* keys are immutable in alpha, so it equals `decoded(sender_did)`.
|
|
36
36
|
*/
|
|
37
37
|
export declare function verifyEnvelope<TBody extends Body>(envelope: Envelope<TBody>, senderIdentityPubkey: Uint8Array): VerifyResult;
|
|
@@ -13,8 +13,10 @@ import type { AssetIdentifier } from '../types';
|
|
|
13
13
|
* `amount` is intentionally NOT here — the concrete locked amount AND its
|
|
14
14
|
* mint are bound at settlement via the digest (`buildReleaseDigest` binds
|
|
15
15
|
* `amount` u64 + `mint` 32B) and on-chain in the Lock account. The
|
|
16
|
-
* condition_hash binds the agreed TERMS (scope / pricing /
|
|
17
|
-
*
|
|
16
|
+
* condition_hash binds the agreed TERMS (scope / pricing / currency), not
|
|
17
|
+
* the amount. (Settlement is always escrow in V1 — no `settlement_model`.
|
|
18
|
+
* The per-unit rate card — `rateAmount` / `rateUnit` — is NOT bound either:
|
|
19
|
+
* nothing enforces it, so it stays out of the subset.)
|
|
18
20
|
*
|
|
19
21
|
* The shape MUST match server-side + CLI derivation byte-for-byte; the
|
|
20
22
|
* golden vectors in `condition-hash.test.ts` pin it.
|
|
@@ -23,9 +25,6 @@ export interface DelegationTermsSubset {
|
|
|
23
25
|
delegationId: string;
|
|
24
26
|
scopeSummary: string;
|
|
25
27
|
pricingModel: string;
|
|
26
|
-
settlementModel: string;
|
|
27
|
-
rateAmount?: string;
|
|
28
|
-
rateUnit?: string;
|
|
29
28
|
currency?: AssetIdentifier;
|
|
30
29
|
}
|
|
31
30
|
/**
|
|
@@ -39,9 +38,6 @@ export interface DelegationTermsInput {
|
|
|
39
38
|
delegationId?: string;
|
|
40
39
|
scopeSummary?: string;
|
|
41
40
|
pricingModel?: string;
|
|
42
|
-
settlementModel?: string;
|
|
43
|
-
rateAmount?: string;
|
|
44
|
-
rateUnit?: string;
|
|
45
41
|
currency?: AssetIdentifier;
|
|
46
42
|
[other: string]: unknown;
|
|
47
43
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
* - did — `did:arp:<...>` parse/format + DID document types
|
|
9
9
|
* - envelope — sign / verify envelope (steps 4-6 of protocol verification)
|
|
10
10
|
* - cosignature — receipt + dispute-response co-signatures
|
|
11
|
-
* - challenge — ARP-CHALLENGE-v1 ownership proof (registration
|
|
12
|
-
* - attestation — scrypt key-link
|
|
11
|
+
* - challenge — ARP-CHALLENGE-v1 ownership proof (registration)
|
|
12
|
+
* - attestation — scrypt key-link owner attestation
|
|
13
13
|
* - server-chain — signed_message_hash, server_event_hash, audit walker
|
|
14
14
|
* - settlement — ARP-SOLANA-* digest stubs (V1.5)
|
|
15
15
|
* - purpose — domain separators (`ARP-*-v1`)
|
package/dist/index.js
CHANGED
|
@@ -166,8 +166,6 @@ var Purpose = {
|
|
|
166
166
|
VC: "ARP-VC-v1",
|
|
167
167
|
/** Owner attestation linking identity ↔ settlement keys at registration. */
|
|
168
168
|
KEY_LINK: "ARP-KEY-LINK-v1",
|
|
169
|
-
/** Owner attestation for an identity-key rotation event. */
|
|
170
|
-
KEY_ROTATION: "ARP-KEY-ROTATION-v1",
|
|
171
169
|
/**
|
|
172
170
|
* Settlement-key signature authorising an on-chain `release_lock`.
|
|
173
171
|
* V1.5 — digest now binds fee_bps_at_lock + fee_recipient_at_lock.
|
|
@@ -332,20 +330,6 @@ function verifyKeyLinkAttestation(attestation, scryptKey) {
|
|
|
332
330
|
if (attestation.payload.purpose !== "ARP-KEY-LINK-v1") return false;
|
|
333
331
|
return scryptPasswordProofVerify(attestation.payload, attestation.sig, scryptKey);
|
|
334
332
|
}
|
|
335
|
-
function signKeyRotationAttestation(input) {
|
|
336
|
-
if (input.payload.purpose !== "ARP-KEY-ROTATION-v1") {
|
|
337
|
-
throw new Error(`signKeyRotationAttestation: expected purpose ARP-KEY-ROTATION-v1, got ${input.payload.purpose}`);
|
|
338
|
-
}
|
|
339
|
-
if (input.payload.owner_signing_method !== "scrypt_password_proof") {
|
|
340
|
-
throw new Error(`signKeyRotationAttestation: this helper handles scrypt_password_proof only; got ${input.payload.owner_signing_method}`);
|
|
341
|
-
}
|
|
342
|
-
const sig = scryptPasswordProofSign(input.payload, input.scryptKey);
|
|
343
|
-
return { payload: input.payload, sig, scrypt_salt_id: input.scryptSaltId };
|
|
344
|
-
}
|
|
345
|
-
function verifyKeyRotationAttestation(attestation, scryptKey) {
|
|
346
|
-
if (attestation.payload.purpose !== "ARP-KEY-ROTATION-v1") return false;
|
|
347
|
-
return scryptPasswordProofVerify(attestation.payload, attestation.sig, scryptKey);
|
|
348
|
-
}
|
|
349
333
|
function signedMessageHash(envelope) {
|
|
350
334
|
const input = envelope.attachments === void 0 ? { protected: envelope.protected, body: envelope.body } : { protected: envelope.protected, body: envelope.body, attachments: envelope.attachments };
|
|
351
335
|
const digest = sha2.sha256(canonicalBytes(input));
|
|
@@ -719,7 +703,7 @@ function resolveAsset(input) {
|
|
|
719
703
|
}
|
|
720
704
|
var WELL_KNOWN_ASSET_KEYS = Object.keys(WELL_KNOWN_ASSETS);
|
|
721
705
|
function deriveDelegationConditionHash(delegation) {
|
|
722
|
-
const required = ["delegationId", "scopeSummary", "pricingModel"
|
|
706
|
+
const required = ["delegationId", "scopeSummary", "pricingModel"];
|
|
723
707
|
for (const field of required) {
|
|
724
708
|
if (delegation[field] === void 0) {
|
|
725
709
|
throw new Error(`deriveDelegationConditionHash: required field '${String(field)}' is missing from the delegation input`);
|
|
@@ -728,11 +712,8 @@ function deriveDelegationConditionHash(delegation) {
|
|
|
728
712
|
const subset = {
|
|
729
713
|
delegationId: delegation.delegationId,
|
|
730
714
|
scopeSummary: delegation.scopeSummary,
|
|
731
|
-
pricingModel: delegation.pricingModel
|
|
732
|
-
settlementModel: delegation.settlementModel
|
|
715
|
+
pricingModel: delegation.pricingModel
|
|
733
716
|
};
|
|
734
|
-
if (delegation.rateAmount !== void 0) subset.rateAmount = delegation.rateAmount;
|
|
735
|
-
if (delegation.rateUnit !== void 0) subset.rateUnit = delegation.rateUnit;
|
|
736
717
|
if (delegation.currency !== void 0) subset.currency = delegation.currency;
|
|
737
718
|
const bytes = canonicalBytes(subset);
|
|
738
719
|
return sha2.sha256(bytes);
|
|
@@ -855,7 +836,6 @@ exports.signChallenge = signChallenge;
|
|
|
855
836
|
exports.signCosignature = signCosignature;
|
|
856
837
|
exports.signEnvelope = signEnvelope;
|
|
857
838
|
exports.signKeyLinkAttestation = signKeyLinkAttestation;
|
|
858
|
-
exports.signKeyRotationAttestation = signKeyRotationAttestation;
|
|
859
839
|
exports.signedMessageHash = signedMessageHash;
|
|
860
840
|
exports.uuidV4 = uuidV4;
|
|
861
841
|
exports.verify = verify2;
|
|
@@ -863,4 +843,3 @@ exports.verifyChallenge = verifyChallenge;
|
|
|
863
843
|
exports.verifyCosignature = verifyCosignature;
|
|
864
844
|
exports.verifyEnvelope = verifyEnvelope;
|
|
865
845
|
exports.verifyKeyLinkAttestation = verifyKeyLinkAttestation;
|
|
866
|
-
exports.verifyKeyRotationAttestation = verifyKeyRotationAttestation;
|
package/dist/index.mjs
CHANGED
|
@@ -141,8 +141,6 @@ var Purpose = {
|
|
|
141
141
|
VC: "ARP-VC-v1",
|
|
142
142
|
/** Owner attestation linking identity ↔ settlement keys at registration. */
|
|
143
143
|
KEY_LINK: "ARP-KEY-LINK-v1",
|
|
144
|
-
/** Owner attestation for an identity-key rotation event. */
|
|
145
|
-
KEY_ROTATION: "ARP-KEY-ROTATION-v1",
|
|
146
144
|
/**
|
|
147
145
|
* Settlement-key signature authorising an on-chain `release_lock`.
|
|
148
146
|
* V1.5 — digest now binds fee_bps_at_lock + fee_recipient_at_lock.
|
|
@@ -307,20 +305,6 @@ function verifyKeyLinkAttestation(attestation, scryptKey) {
|
|
|
307
305
|
if (attestation.payload.purpose !== "ARP-KEY-LINK-v1") return false;
|
|
308
306
|
return scryptPasswordProofVerify(attestation.payload, attestation.sig, scryptKey);
|
|
309
307
|
}
|
|
310
|
-
function signKeyRotationAttestation(input) {
|
|
311
|
-
if (input.payload.purpose !== "ARP-KEY-ROTATION-v1") {
|
|
312
|
-
throw new Error(`signKeyRotationAttestation: expected purpose ARP-KEY-ROTATION-v1, got ${input.payload.purpose}`);
|
|
313
|
-
}
|
|
314
|
-
if (input.payload.owner_signing_method !== "scrypt_password_proof") {
|
|
315
|
-
throw new Error(`signKeyRotationAttestation: this helper handles scrypt_password_proof only; got ${input.payload.owner_signing_method}`);
|
|
316
|
-
}
|
|
317
|
-
const sig = scryptPasswordProofSign(input.payload, input.scryptKey);
|
|
318
|
-
return { payload: input.payload, sig, scrypt_salt_id: input.scryptSaltId };
|
|
319
|
-
}
|
|
320
|
-
function verifyKeyRotationAttestation(attestation, scryptKey) {
|
|
321
|
-
if (attestation.payload.purpose !== "ARP-KEY-ROTATION-v1") return false;
|
|
322
|
-
return scryptPasswordProofVerify(attestation.payload, attestation.sig, scryptKey);
|
|
323
|
-
}
|
|
324
308
|
function signedMessageHash(envelope) {
|
|
325
309
|
const input = envelope.attachments === void 0 ? { protected: envelope.protected, body: envelope.body } : { protected: envelope.protected, body: envelope.body, attachments: envelope.attachments };
|
|
326
310
|
const digest = sha256(canonicalBytes(input));
|
|
@@ -694,7 +678,7 @@ function resolveAsset(input) {
|
|
|
694
678
|
}
|
|
695
679
|
var WELL_KNOWN_ASSET_KEYS = Object.keys(WELL_KNOWN_ASSETS);
|
|
696
680
|
function deriveDelegationConditionHash(delegation) {
|
|
697
|
-
const required = ["delegationId", "scopeSummary", "pricingModel"
|
|
681
|
+
const required = ["delegationId", "scopeSummary", "pricingModel"];
|
|
698
682
|
for (const field of required) {
|
|
699
683
|
if (delegation[field] === void 0) {
|
|
700
684
|
throw new Error(`deriveDelegationConditionHash: required field '${String(field)}' is missing from the delegation input`);
|
|
@@ -703,11 +687,8 @@ function deriveDelegationConditionHash(delegation) {
|
|
|
703
687
|
const subset = {
|
|
704
688
|
delegationId: delegation.delegationId,
|
|
705
689
|
scopeSummary: delegation.scopeSummary,
|
|
706
|
-
pricingModel: delegation.pricingModel
|
|
707
|
-
settlementModel: delegation.settlementModel
|
|
690
|
+
pricingModel: delegation.pricingModel
|
|
708
691
|
};
|
|
709
|
-
if (delegation.rateAmount !== void 0) subset.rateAmount = delegation.rateAmount;
|
|
710
|
-
if (delegation.rateUnit !== void 0) subset.rateUnit = delegation.rateUnit;
|
|
711
692
|
if (delegation.currency !== void 0) subset.currency = delegation.currency;
|
|
712
693
|
const bytes = canonicalBytes(subset);
|
|
713
694
|
return sha256(bytes);
|
|
@@ -773,4 +754,4 @@ function computeCreateLockDiscriminator() {
|
|
|
773
754
|
return h.slice(0, 8);
|
|
774
755
|
}
|
|
775
756
|
|
|
776
|
-
export { CAIP19_REGEX, COSIGNATURE_PURPOSES, CREATE_LOCK_DISCRIMINATOR, DECLINE_REASONS, PROTECTED_PURPOSES, PURPOSE_PARTIAL_RELEASE_STRING, PURPOSE_REFUND_STRING, PURPOSE_RELEASE_STRING, Purpose, REFUND_REASON_BYTES, SCRYPT_PARAMS, SETTLEMENT_PURPOSES, SLIP44_SOLANA, SOLANA_CLUSTER_IDS, SPL_TOKEN_PROGRAM_ID_BASE58, USDC_MINTS, WELL_KNOWN_ASSETS, WELL_KNOWN_ASSET_KEYS, base58btcDecode, base58btcEncode, buildCreateLockIxData, buildPartialReleaseDigest, buildRefundDigest, buildReleaseDigest, bytes16ToDelegationId, canonicalBytes, canonicalJson, canonicalSha256Hex, computeCreateLockDiscriminator, delegationIdToBytes16, deriveDelegationConditionHash, deriveLockId, deriveScryptKey, detectTokenProgramFromOwner, detectTokenProgramFromOwnerBytes, expiresAt, findFirstChainDivergence, formatDid, generateKeyPair, getPublicKey2 as getPublicKey, isAssetIdentifier, isDeclineReason, isValidDid, parseCaip19SolanaAssetId, parseDid, pollUntil, resolveAsset, rfc3339, scryptPasswordProofSign, scryptPasswordProofVerify, senderNonce, serverEventHash, sign2 as sign, signChallenge, signCosignature, signEnvelope, signKeyLinkAttestation,
|
|
757
|
+
export { CAIP19_REGEX, COSIGNATURE_PURPOSES, CREATE_LOCK_DISCRIMINATOR, DECLINE_REASONS, PROTECTED_PURPOSES, PURPOSE_PARTIAL_RELEASE_STRING, PURPOSE_REFUND_STRING, PURPOSE_RELEASE_STRING, Purpose, REFUND_REASON_BYTES, SCRYPT_PARAMS, SETTLEMENT_PURPOSES, SLIP44_SOLANA, SOLANA_CLUSTER_IDS, SPL_TOKEN_PROGRAM_ID_BASE58, USDC_MINTS, WELL_KNOWN_ASSETS, WELL_KNOWN_ASSET_KEYS, base58btcDecode, base58btcEncode, buildCreateLockIxData, buildPartialReleaseDigest, buildRefundDigest, buildReleaseDigest, bytes16ToDelegationId, canonicalBytes, canonicalJson, canonicalSha256Hex, computeCreateLockDiscriminator, delegationIdToBytes16, deriveDelegationConditionHash, deriveLockId, deriveScryptKey, detectTokenProgramFromOwner, detectTokenProgramFromOwnerBytes, expiresAt, findFirstChainDivergence, formatDid, generateKeyPair, getPublicKey2 as getPublicKey, isAssetIdentifier, isDeclineReason, isValidDid, parseCaip19SolanaAssetId, parseDid, pollUntil, resolveAsset, rfc3339, scryptPasswordProofSign, scryptPasswordProofVerify, senderNonce, serverEventHash, sign2 as sign, signChallenge, signCosignature, signEnvelope, signKeyLinkAttestation, signedMessageHash, uuidV4, verify2 as verify, verifyChallenge, verifyCosignature, verifyEnvelope, verifyKeyLinkAttestation };
|
package/dist/purpose.d.ts
CHANGED
|
@@ -23,8 +23,6 @@ export declare const Purpose: {
|
|
|
23
23
|
readonly VC: "ARP-VC-v1";
|
|
24
24
|
/** Owner attestation linking identity ↔ settlement keys at registration. */
|
|
25
25
|
readonly KEY_LINK: "ARP-KEY-LINK-v1";
|
|
26
|
-
/** Owner attestation for an identity-key rotation event. */
|
|
27
|
-
readonly KEY_ROTATION: "ARP-KEY-ROTATION-v1";
|
|
28
26
|
/**
|
|
29
27
|
* Settlement-key signature authorising an on-chain `release_lock`.
|
|
30
28
|
* V1.5 — digest now binds fee_bps_at_lock + fee_recipient_at_lock.
|
package/dist/types/body.d.ts
CHANGED
|
@@ -22,9 +22,9 @@ import type { Body, Did, Sha256Hex } from './envelope';
|
|
|
22
22
|
* `solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp/spl:EPjFWdd5...` (USDC Solana mainnet)
|
|
23
23
|
* `solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp/slip44:501` (native SOL Solana mainnet)
|
|
24
24
|
* Required, validated against the CAIP-19 regex on the server.
|
|
25
|
-
* - `decimals` — integer 0-18, used to convert human-readable
|
|
26
|
-
* `
|
|
27
|
-
*
|
|
25
|
+
* - `decimals` — integer 0-18, used to convert the human-readable
|
|
26
|
+
* `amount` string to base units for on-chain escrow
|
|
27
|
+
* (USDC = 6, SOL = 9, ETH = 18). Required.
|
|
28
28
|
* - `symbol` — short human-readable hint for UI ("USDC", "SOL").
|
|
29
29
|
* Not used for any logic — purely display sugar. Optional.
|
|
30
30
|
*
|
|
@@ -112,7 +112,7 @@ export interface DelegationBody extends Body<DelegationContent> {
|
|
|
112
112
|
type: 'delegation';
|
|
113
113
|
}
|
|
114
114
|
export interface DelegationContent {
|
|
115
|
-
action: 'offer' | 'accept' | 'decline' | 'cancel';
|
|
115
|
+
action: 'offer' | 'accept' | 'decline' | 'cancel' | 'fund';
|
|
116
116
|
delegation_id: string;
|
|
117
117
|
title?: string;
|
|
118
118
|
brief?: Record<string, unknown>;
|
|
@@ -122,9 +122,6 @@ export interface DelegationContent {
|
|
|
122
122
|
currency?: AssetIdentifier;
|
|
123
123
|
scope_summary?: string;
|
|
124
124
|
pricing_model?: 'flat' | 'usage_based';
|
|
125
|
-
settlement_model?: 'prepaid' | 'escrow';
|
|
126
|
-
rate_amount?: string;
|
|
127
|
-
rate_unit?: 'task' | 'thread' | 'handoff';
|
|
128
125
|
/** Machine-readable reason — REQUIRED when `action === 'decline'`. See `DeclineReason`. */
|
|
129
126
|
reason?: DeclineReason;
|
|
130
127
|
/** Optional free-text elaboration (e.g. "delegation offer missing required brief.goal field"). */
|
package/dist/types/identity.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { KeyMode } from '../did';
|
|
2
1
|
import type { Did } from './envelope';
|
|
3
2
|
/**
|
|
4
3
|
* Owner attestation methods per [00-core/identity.md](../../../00-core/identity.md).
|
|
@@ -17,38 +16,19 @@ export interface KeyLinkPayload {
|
|
|
17
16
|
agent_did: Did;
|
|
18
17
|
identity_public_key: string;
|
|
19
18
|
settlement_public_key: string;
|
|
20
|
-
key_mode: KeyMode;
|
|
21
19
|
owner_id: string;
|
|
22
20
|
owner_signing_method: OwnerSigningMethod;
|
|
23
21
|
link_method: 'manual' | 'imported' | 'derived_bip39';
|
|
24
22
|
created_at: string;
|
|
25
23
|
nonce: string;
|
|
26
24
|
}
|
|
27
|
-
/**
|
|
28
|
-
* `ARP-KEY-ROTATION-v1` payload — separate purpose from KEY-LINK
|
|
29
|
-
* because rotation breaks the `agent_did = base58btc(identity_pubkey)`
|
|
30
|
-
* invariant. Agent DID stays frozen; identity_public_key changes.
|
|
31
|
-
*/
|
|
32
|
-
export interface KeyRotationPayload {
|
|
33
|
-
purpose: 'ARP-KEY-ROTATION-v1';
|
|
34
|
-
agent_did: Did;
|
|
35
|
-
current_identity_public_key: string;
|
|
36
|
-
new_identity_public_key: string;
|
|
37
|
-
settlement_public_key: string;
|
|
38
|
-
supersedes_attestation_id: string;
|
|
39
|
-
owner_id: string;
|
|
40
|
-
owner_signing_method: OwnerSigningMethod;
|
|
41
|
-
rotation_reason: 'scheduled' | 'compromise' | 'lost_device' | 'other';
|
|
42
|
-
created_at: string;
|
|
43
|
-
nonce: string;
|
|
44
|
-
}
|
|
45
25
|
/**
|
|
46
26
|
* `scrypt_password_proof` — the V1 owner attestation envelope. The
|
|
47
27
|
* signature is HMAC-SHA256(scrypt(password, salt), sha256(canonical(payload))),
|
|
48
28
|
* base64-encoded. NOT an Ed25519 signature; verification is
|
|
49
29
|
* server-side via the stored scrypt-derived key.
|
|
50
30
|
*/
|
|
51
|
-
export interface ScryptPasswordAttestation<TPayload extends KeyLinkPayload
|
|
31
|
+
export interface ScryptPasswordAttestation<TPayload extends KeyLinkPayload = KeyLinkPayload> {
|
|
52
32
|
payload: TPayload;
|
|
53
33
|
sig: string;
|
|
54
34
|
scrypt_salt_id: string;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export type { Sha256Hex, Ed25519Sig, Did, ProtectedBlock, Body, Attachments, CoSignature, SettlementSignatures, SettlementParty, EscrowLockAttachment, Envelope, PersistedEvent, } from './envelope';
|
|
2
2
|
export type { HandshakeBody, HandshakeContent, HandshakeResponseBody, HandshakeResponseContent, DelegationBody, DelegationContent, WorkRequestBody, WorkRequestContent, WorkResponseBody, WorkResponseContent, ReceiptBody, ReceiptContent, DisputeBody, DisputeContent, SettlementSignatureBody, SettlementSignatureContent, AnyBody, ReceiptCosignPayload, DisputeResponseCosignPayload, CosignPayload, DeclineReason, AssetIdentifier, } from './body';
|
|
3
3
|
export { DECLINE_REASONS, isDeclineReason } from './body';
|
|
4
|
-
export type { OwnerSigningMethod, KeyLinkPayload,
|
|
4
|
+
export type { OwnerSigningMethod, KeyLinkPayload, ScryptPasswordAttestation } from './identity';
|
|
5
5
|
export { SCRYPT_PARAMS } from './identity';
|
package/dist/utils/nonce.d.ts
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* Generate a 16-byte random nonce, base64url-encoded without padding.
|
|
3
3
|
*
|
|
4
4
|
* Used in `protected.sender_nonce` and inside attestation payloads
|
|
5
|
-
* (`ARP-KEY-LINK-v1
|
|
6
|
-
*
|
|
7
|
-
*
|
|
5
|
+
* (`ARP-KEY-LINK-v1`) to defend against accidental hash collisions and
|
|
6
|
+
* replay where two semantically distinct messages would otherwise hash
|
|
7
|
+
* to the same value.
|
|
8
8
|
*/
|
|
9
9
|
export declare function senderNonce(): string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@heyanon-arp/sdk",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.7",
|
|
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": [
|