@xyo-network/payment-payload-plugins 3.0.23 → 3.0.25
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/neutral/Escrow/Terms/Party.d.ts +3 -0
- package/dist/neutral/Escrow/Terms/Party.d.ts.map +1 -0
- package/dist/neutral/Escrow/Terms/PartySecret.d.ts +3 -0
- package/dist/neutral/Escrow/Terms/PartySecret.d.ts.map +1 -0
- package/dist/neutral/Escrow/Terms/Terms.d.ts.map +1 -0
- package/dist/neutral/Escrow/Terms/index.d.ts +4 -0
- package/dist/neutral/Escrow/Terms/index.d.ts.map +1 -0
- package/dist/neutral/Escrow/index.d.ts +2 -3
- package/dist/neutral/Escrow/index.d.ts.map +1 -1
- package/dist/neutral/Escrow/util/index.d.ts +2 -0
- package/dist/neutral/Escrow/util/index.d.ts.map +1 -0
- package/dist/neutral/Escrow/{createEscrowIntent.d.ts → util/secret/createEscrowIntent.d.ts} +1 -13
- package/dist/neutral/Escrow/util/secret/createEscrowIntent.d.ts.map +1 -0
- package/dist/neutral/Escrow/util/secret/findEscrowPartySecretSignatures.d.ts +6 -0
- package/dist/neutral/Escrow/util/secret/findEscrowPartySecretSignatures.d.ts.map +1 -0
- package/dist/neutral/Escrow/util/secret/getEscrowSecret.d.ts.map +1 -0
- package/dist/neutral/Escrow/util/secret/index.d.ts +5 -0
- package/dist/neutral/Escrow/util/secret/index.d.ts.map +1 -0
- package/dist/neutral/Escrow/util/secret/updateEscrowTermsWithSecret.d.ts +16 -0
- package/dist/neutral/Escrow/util/secret/updateEscrowTermsWithSecret.d.ts.map +1 -0
- package/dist/neutral/Escrow/validators/common/ModuleInstanceValidators/moduleInstanceValidators.d.ts +1 -1
- package/dist/neutral/Escrow/validators/common/ModuleInstanceValidators/moduleInstanceValidators.d.ts.map +1 -1
- package/dist/neutral/Escrow/validators/common/SecretValidators/getPartySecretSignedValidator.d.ts +5 -0
- package/dist/neutral/Escrow/validators/common/SecretValidators/getPartySecretSignedValidator.d.ts.map +1 -0
- package/dist/neutral/Escrow/validators/common/SecretValidators/index.d.ts +2 -0
- package/dist/neutral/Escrow/validators/common/SecretValidators/index.d.ts.map +1 -0
- package/dist/neutral/Escrow/validators/common/index.d.ts +1 -0
- package/dist/neutral/Escrow/validators/common/index.d.ts.map +1 -1
- package/dist/neutral/Escrow/validators/escrow/agent.d.ts +1 -1
- package/dist/neutral/Escrow/validators/escrow/agent.d.ts.map +1 -1
- package/dist/neutral/Escrow/validators/escrow/appraisal.d.ts +1 -1
- package/dist/neutral/Escrow/validators/escrow/appraisal.d.ts.map +1 -1
- package/dist/neutral/Escrow/validators/escrow/appraisalAuthorities.d.ts +1 -1
- package/dist/neutral/Escrow/validators/escrow/appraisalAuthorities.d.ts.map +1 -1
- package/dist/neutral/Escrow/validators/escrow/assets.d.ts +1 -1
- package/dist/neutral/Escrow/validators/escrow/assets.d.ts.map +1 -1
- package/dist/neutral/Escrow/validators/escrow/buyer.d.ts +1 -1
- package/dist/neutral/Escrow/validators/escrow/buyer.d.ts.map +1 -1
- package/dist/neutral/Escrow/validators/escrow/buyerSecret.d.ts +1 -1
- package/dist/neutral/Escrow/validators/escrow/buyerSecret.d.ts.map +1 -1
- package/dist/neutral/Escrow/validators/escrow/nbfExp.d.ts +1 -1
- package/dist/neutral/Escrow/validators/escrow/nbfExp.d.ts.map +1 -1
- package/dist/neutral/Escrow/validators/escrow/paymentAuthorities.d.ts +1 -1
- package/dist/neutral/Escrow/validators/escrow/paymentAuthorities.d.ts.map +1 -1
- package/dist/neutral/Escrow/validators/escrow/seller.d.ts +1 -1
- package/dist/neutral/Escrow/validators/escrow/seller.d.ts.map +1 -1
- package/dist/neutral/Escrow/validators/escrow/sellerSecret.d.ts +1 -1
- package/dist/neutral/Escrow/validators/escrow/sellerSecret.d.ts.map +1 -1
- package/dist/neutral/index.mjs +83 -59
- package/dist/neutral/index.mjs.map +1 -1
- package/package.json +4 -2
- package/src/Escrow/Terms/Party.ts +6 -0
- package/src/Escrow/Terms/PartySecret.ts +6 -0
- package/src/Escrow/{Terms.ts → Terms/Terms.ts} +1 -1
- package/src/Escrow/Terms/index.ts +3 -0
- package/src/Escrow/index.ts +2 -3
- package/src/Escrow/util/index.ts +1 -0
- package/src/Escrow/{createEscrowIntent.ts → util/secret/createEscrowIntent.ts} +1 -13
- package/src/Escrow/util/secret/findEscrowPartySecretSignatures.ts +47 -0
- package/src/Escrow/util/secret/index.ts +4 -0
- package/src/Escrow/util/secret/updateEscrowTermsWithSecret.ts +37 -0
- package/src/Escrow/validators/common/ModuleInstanceValidators/moduleInstanceValidators.ts +1 -1
- package/src/Escrow/validators/common/SecretValidators/getPartySecretSignedValidator.ts +48 -0
- package/src/Escrow/validators/common/SecretValidators/index.ts +1 -0
- package/src/Escrow/validators/common/index.ts +1 -0
- package/src/Escrow/validators/escrow/agent.ts +1 -1
- package/src/Escrow/validators/escrow/appraisal.ts +2 -2
- package/src/Escrow/validators/escrow/appraisalAuthorities.ts +1 -1
- package/src/Escrow/validators/escrow/assets.ts +1 -1
- package/src/Escrow/validators/escrow/buyer.ts +1 -1
- package/src/Escrow/validators/escrow/buyerSecret.ts +3 -30
- package/src/Escrow/validators/escrow/nbfExp.ts +1 -1
- package/src/Escrow/validators/escrow/paymentAuthorities.ts +1 -1
- package/src/Escrow/validators/escrow/seller.ts +1 -1
- package/src/Escrow/validators/escrow/sellerSecret.ts +3 -30
- package/dist/neutral/Escrow/Terms.d.ts.map +0 -1
- package/dist/neutral/Escrow/createEscrowIntent.d.ts.map +0 -1
- package/dist/neutral/Escrow/getEscrowSecret.d.ts.map +0 -1
- /package/dist/neutral/Escrow/{Terms.d.ts → Terms/Terms.d.ts} +0 -0
- /package/dist/neutral/Escrow/{getEscrowSecret.d.ts → util/secret/getEscrowSecret.d.ts} +0 -0
- /package/src/Escrow/{getEscrowSecret.ts → util/secret/getEscrowSecret.ts} +0 -0
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { AccountInstance } from '@xyo-network/account-model'
|
|
2
|
+
import { BoundWitnessBuilder } from '@xyo-network/boundwitness-builder'
|
|
3
|
+
import type { IdPayload } from '@xyo-network/id-payload-plugin'
|
|
4
|
+
import { PayloadBuilder } from '@xyo-network/payload-builder'
|
|
5
|
+
|
|
6
|
+
import type {
|
|
7
|
+
EscrowParty, EscrowPartySecret, EscrowTerms,
|
|
8
|
+
} from '../../Terms/index.ts'
|
|
9
|
+
import { getEscrowSecret } from './getEscrowSecret.ts'
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Creates an escrow intent (for a buyer or seller) using the supplied secret
|
|
13
|
+
* @param terms The payload describing the terms for the escrow
|
|
14
|
+
* @param escrowParty The party in the escrow transaction
|
|
15
|
+
* @param account The account(s) to create the escrow intent with
|
|
16
|
+
* @param secret The secret for the escrow principal party to use for the escrow. If
|
|
17
|
+
* not provided, a cryptographically random secret will be generated.
|
|
18
|
+
* @returns The escrow intent
|
|
19
|
+
*/
|
|
20
|
+
export const updateEscrowTermsWithSecret = async (
|
|
21
|
+
terms: EscrowTerms,
|
|
22
|
+
escrowParty: EscrowParty,
|
|
23
|
+
account: AccountInstance | AccountInstance[],
|
|
24
|
+
secret?: IdPayload,
|
|
25
|
+
) => {
|
|
26
|
+
if (!secret) secret = getEscrowSecret()
|
|
27
|
+
const signers = Array.isArray(account) ? account : [account]
|
|
28
|
+
// Add party addresses to escrow terms
|
|
29
|
+
terms[escrowParty] = signers.map(signer => signer.address)
|
|
30
|
+
// Add secret hash to terms
|
|
31
|
+
const secretType: EscrowPartySecret = escrowParty === 'buyer' ? 'buyerSecret' : 'sellerSecret'
|
|
32
|
+
const secretHash = await PayloadBuilder.dataHash(secret)
|
|
33
|
+
terms[secretType] = secretHash
|
|
34
|
+
// Have the parties sign the secret and terms
|
|
35
|
+
const result = await new BoundWitnessBuilder().signers(signers).payloads([terms, secret]).build()
|
|
36
|
+
return result
|
|
37
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ModuleIdentifier } from '@xyo-network/module-model'
|
|
2
2
|
import type { PayloadValueExpression } from '@xyo-network/payload-model'
|
|
3
3
|
|
|
4
|
-
import type { EscrowTerms } from '../../../Terms.ts'
|
|
4
|
+
import type { EscrowTerms } from '../../../Terms/index.ts'
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Checks if property value of the escrow terms contains one of the valid moduleIdentifiers
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { Hash } from '@xylabs/hex'
|
|
2
|
+
import { BoundWitnessValidator } from '@xyo-network/boundwitness-validator'
|
|
3
|
+
import type {
|
|
4
|
+
AsyncPayloadValidationFunction, Payload, WithMeta,
|
|
5
|
+
} from '@xyo-network/payload-model'
|
|
6
|
+
|
|
7
|
+
import type {
|
|
8
|
+
EscrowParty, EscrowPartySecret, EscrowTerms,
|
|
9
|
+
} from '../../../Terms/index.ts'
|
|
10
|
+
import { findEscrowPartySecretSignatures } from '../../../util/index.ts'
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Returns the log prefix for the party
|
|
14
|
+
* @param party The party
|
|
15
|
+
* @returns The log prefix for the party
|
|
16
|
+
*/
|
|
17
|
+
const getLogPrefix = (party: EscrowParty) => {
|
|
18
|
+
const partySecret: EscrowPartySecret = party === 'seller' ? 'sellerSecret' : 'buyerSecret'
|
|
19
|
+
return `EscrowTerms.${partySecret}`
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Returns a function that validates the escrow terms for the existence of the party secret signed by the party
|
|
24
|
+
* @param dictionary Payload dictionary of the escrow terms
|
|
25
|
+
* @returns A function that validates the escrow terms for the existence of the party secret signed by the party
|
|
26
|
+
*/
|
|
27
|
+
export const getPartySecretSignedValidator = (dictionary: Record<Hash, WithMeta<Payload>>, party: EscrowParty): AsyncPayloadValidationFunction<EscrowTerms> => {
|
|
28
|
+
const partySecret: EscrowPartySecret = party === 'seller' ? 'sellerSecret' : 'buyerSecret'
|
|
29
|
+
return async (terms: EscrowTerms): Promise<boolean> => {
|
|
30
|
+
// Party-signed party secret BWs
|
|
31
|
+
const buyerSecretBWs = findEscrowPartySecretSignatures(terms, dictionary, party)
|
|
32
|
+
|
|
33
|
+
// If there are no BWs, return false
|
|
34
|
+
if (buyerSecretBWs.length === 0) {
|
|
35
|
+
console.log(`${getLogPrefix(party)}: No BoundWitnesses supplied for ${partySecret}: ${terms[partySecret]}`)
|
|
36
|
+
return false
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// Ensure each BW supplied for the party secret is valid
|
|
40
|
+
const errors = await Promise.all(buyerSecretBWs.map(bw => new BoundWitnessValidator(bw).validate()))
|
|
41
|
+
const validBoundWitnesses = errors.every(errors => errors.length === 0)
|
|
42
|
+
if (!validBoundWitnesses) {
|
|
43
|
+
console.log(`${getLogPrefix(party)}: Invalid BoundWitnesses supplied for ${partySecret}: ${terms[partySecret]}`)
|
|
44
|
+
return false
|
|
45
|
+
}
|
|
46
|
+
return true
|
|
47
|
+
}
|
|
48
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './getPartySecretSignedValidator.ts'
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ModuleIdentifier } from '@xyo-network/module-model'
|
|
2
2
|
import type { SyncPayloadValidationFunction } from '@xyo-network/payload-model'
|
|
3
3
|
|
|
4
|
-
import type { EscrowTerms } from '../../Terms.ts'
|
|
4
|
+
import type { EscrowTerms } from '../../Terms/index.ts'
|
|
5
5
|
import { moduleIdentifiersContainsOneOf } from '../common/index.ts'
|
|
6
6
|
|
|
7
7
|
const name = 'EscrowTerms.escrowAgent'
|
|
@@ -8,7 +8,7 @@ import type {
|
|
|
8
8
|
Payload, SyncPayloadValidationFunction, WithMeta, WithSources,
|
|
9
9
|
} from '@xyo-network/payload-model'
|
|
10
10
|
|
|
11
|
-
import type { EscrowTerms } from '../../Terms.ts'
|
|
11
|
+
import type { EscrowTerms } from '../../Terms/index.ts'
|
|
12
12
|
import { validateWithinWindow } from '../common/index.ts'
|
|
13
13
|
|
|
14
14
|
const name = 'EscrowTerms.appraisal'
|
|
@@ -110,7 +110,7 @@ export const getAppraisalsForAllAssetsValidator = (dictionary: Record<Hash, With
|
|
|
110
110
|
const validateEstimate = (estimate: WithSources<HashLeaseEstimate>, exp: number): boolean => {
|
|
111
111
|
if (!validateWithinWindow(estimate, exp)) return false
|
|
112
112
|
if (estimate.currency !== 'USD') return false
|
|
113
|
-
if (estimate.price
|
|
113
|
+
if (estimate.price < 0) return false
|
|
114
114
|
return true
|
|
115
115
|
}
|
|
116
116
|
|
|
@@ -2,7 +2,7 @@ import { asAddress } from '@xylabs/hex'
|
|
|
2
2
|
import type { ModuleIdentifier } from '@xyo-network/module-model'
|
|
3
3
|
import type { SyncPayloadValidationFunction } from '@xyo-network/payload-model'
|
|
4
4
|
|
|
5
|
-
import type { EscrowTerms } from '../../Terms.ts'
|
|
5
|
+
import type { EscrowTerms } from '../../Terms/index.ts'
|
|
6
6
|
import { moduleIdentifiersContainsAllOf } from '../common/index.ts'
|
|
7
7
|
|
|
8
8
|
const name = 'EscrowTerms.appraisalAuthorities'
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { asAddress } from '@xylabs/hex'
|
|
2
2
|
import type { SyncPayloadValidationFunction } from '@xyo-network/payload-model'
|
|
3
3
|
|
|
4
|
-
import type { EscrowTerms } from '../../Terms.ts'
|
|
4
|
+
import type { EscrowTerms } from '../../Terms/index.ts'
|
|
5
5
|
|
|
6
6
|
const name = 'EscrowTerms.buyer'
|
|
7
7
|
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { assertEx } from '@xylabs/assert'
|
|
2
2
|
import type { Hash } from '@xylabs/hex'
|
|
3
|
-
import { isBoundWitnessWithMeta } from '@xyo-network/boundwitness-model'
|
|
4
|
-
import { BoundWitnessValidator } from '@xyo-network/boundwitness-validator'
|
|
5
3
|
import type {
|
|
6
4
|
AsyncPayloadValidationFunction, Payload, SyncPayloadValidationFunction, WithMeta,
|
|
7
5
|
} from '@xyo-network/payload-model'
|
|
8
6
|
|
|
9
|
-
import type { EscrowTerms } from '../../Terms.ts'
|
|
7
|
+
import type { EscrowTerms } from '../../Terms/index.ts'
|
|
8
|
+
import { getPartySecretSignedValidator } from '../common/index.ts'
|
|
10
9
|
|
|
11
10
|
const name = 'EscrowTerms.buyerSecret'
|
|
12
11
|
|
|
@@ -46,31 +45,5 @@ export const getBuyerSecretSuppliedValidator = (dictionary: Record<Hash, WithMet
|
|
|
46
45
|
* @returns A function that validates the escrow terms for the existence of the buyerSecret signed by the buyer
|
|
47
46
|
*/
|
|
48
47
|
export const getBuyerSecretSignedValidator = (dictionary: Record<Hash, WithMeta<Payload>>): AsyncPayloadValidationFunction<EscrowTerms> => {
|
|
49
|
-
return
|
|
50
|
-
const buyer = assertEx(terms.buyer, () => `${name}: No buyer: ${terms.buyer}`)
|
|
51
|
-
const buyerSecret = assertEx(terms.buyerSecret, () => `${name}: No buyerSecret: ${terms.buyerSecret}`)
|
|
52
|
-
// Buyer-signed buyer secrets
|
|
53
|
-
const buyerSecretBWs = Object.values(dictionary)
|
|
54
|
-
// Find all BoundWitnesses
|
|
55
|
-
.filter(isBoundWitnessWithMeta)
|
|
56
|
-
// That contain the buyer secret
|
|
57
|
-
.filter(bw => bw.payload_hashes.includes(buyerSecret))
|
|
58
|
-
// That are signed by all the buyers
|
|
59
|
-
.filter(bw => buyer.every(buyerAddress => bw.addresses.includes(buyerAddress)))
|
|
60
|
-
|
|
61
|
-
// If there are no buyerSecret BWs, return false
|
|
62
|
-
if (buyerSecretBWs.length === 0) {
|
|
63
|
-
console.log(`${name}: No BoundWitnesses supplied for buyerSecret: ${buyerSecret}`)
|
|
64
|
-
return false
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
// Ensure each BW supplied for the buyerSecret is valid
|
|
68
|
-
const errors = await Promise.all(buyerSecretBWs.map(bw => new BoundWitnessValidator(bw).validate()))
|
|
69
|
-
const validBoundWitnesses = errors.every(errors => errors.length === 0)
|
|
70
|
-
if (!validBoundWitnesses) {
|
|
71
|
-
console.log(`${name}: Invalid BoundWitnesses supplied for buyerSecret: ${buyerSecret}`)
|
|
72
|
-
return false
|
|
73
|
-
}
|
|
74
|
-
return true
|
|
75
|
-
}
|
|
48
|
+
return getPartySecretSignedValidator(dictionary, 'buyer')
|
|
76
49
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { SyncPayloadValidationFunction } from '@xyo-network/payload-model'
|
|
2
2
|
|
|
3
|
-
import type { EscrowTerms } from '../../Terms.ts'
|
|
3
|
+
import type { EscrowTerms } from '../../Terms/index.ts'
|
|
4
4
|
|
|
5
5
|
export const getNbfExpValidator = (now: number, minRequiredDuration: number): SyncPayloadValidationFunction<EscrowTerms> => {
|
|
6
6
|
const minExp = now + minRequiredDuration
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ModuleIdentifier } from '@xyo-network/module-model'
|
|
2
2
|
import type { SyncPayloadValidationFunction } from '@xyo-network/payload-model'
|
|
3
3
|
|
|
4
|
-
import type { EscrowTerms } from '../../Terms.ts'
|
|
4
|
+
import type { EscrowTerms } from '../../Terms/index.ts'
|
|
5
5
|
import { moduleIdentifiersContainsAllOf } from '../common/index.ts'
|
|
6
6
|
|
|
7
7
|
const name = 'EscrowTerms.paymentAuthorities'
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { asAddress } from '@xylabs/hex'
|
|
2
2
|
import type { SyncPayloadValidationFunction } from '@xyo-network/payload-model'
|
|
3
3
|
|
|
4
|
-
import type { EscrowTerms } from '../../Terms.ts'
|
|
4
|
+
import type { EscrowTerms } from '../../Terms/index.ts'
|
|
5
5
|
|
|
6
6
|
const name = 'EscrowTerms.seller'
|
|
7
7
|
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { assertEx } from '@xylabs/assert'
|
|
2
2
|
import type { Hash } from '@xylabs/hex'
|
|
3
|
-
import { isBoundWitnessWithMeta } from '@xyo-network/boundwitness-model'
|
|
4
|
-
import { BoundWitnessValidator } from '@xyo-network/boundwitness-validator'
|
|
5
3
|
import type {
|
|
6
4
|
AsyncPayloadValidationFunction, Payload, SyncPayloadValidationFunction, WithMeta,
|
|
7
5
|
} from '@xyo-network/payload-model'
|
|
8
6
|
|
|
9
|
-
import type { EscrowTerms } from '../../Terms.ts'
|
|
7
|
+
import type { EscrowTerms } from '../../Terms/index.ts'
|
|
8
|
+
import { getPartySecretSignedValidator } from '../common/index.ts'
|
|
10
9
|
|
|
11
10
|
const name = 'EscrowTerms.sellerSecret'
|
|
12
11
|
|
|
@@ -46,31 +45,5 @@ export const getSellerSecretSuppliedValidator = (dictionary: Record<Hash, WithMe
|
|
|
46
45
|
* @returns A function that validates the escrow terms for the existence of the sellerSecret signed by the seller
|
|
47
46
|
*/
|
|
48
47
|
export const getSellerSecretSignedValidator = (dictionary: Record<Hash, WithMeta<Payload>>): AsyncPayloadValidationFunction<EscrowTerms> => {
|
|
49
|
-
return
|
|
50
|
-
const seller = assertEx(terms.seller, () => `${name}: No seller: ${terms.seller}`)
|
|
51
|
-
const sellerSecret = assertEx(terms.sellerSecret, () => `${name}: No sellerSecret: ${terms.sellerSecret}`)
|
|
52
|
-
// Seller-signed seller secrets
|
|
53
|
-
const sellerSecretBWs = Object.values(dictionary)
|
|
54
|
-
// Find all BoundWitnesses
|
|
55
|
-
.filter(isBoundWitnessWithMeta)
|
|
56
|
-
// That contain the seller secret
|
|
57
|
-
.filter(bw => bw.payload_hashes.includes(sellerSecret))
|
|
58
|
-
// That are signed by all the sellers
|
|
59
|
-
.filter(bw => seller.every(sellerAddress => bw.addresses.includes(sellerAddress)))
|
|
60
|
-
|
|
61
|
-
// If there are no sellerSecret BWs, return false
|
|
62
|
-
if (sellerSecretBWs.length === 0) {
|
|
63
|
-
console.log(`${name}: No BoundWitnesses supplied for sellerSecret: ${sellerSecret}`)
|
|
64
|
-
return false
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
// Ensure each BW supplied for the sellerSecret is valid
|
|
68
|
-
const errors = await Promise.all(sellerSecretBWs.map(bw => new BoundWitnessValidator(bw).validate()))
|
|
69
|
-
const validBoundWitnesses = errors.every(errors => errors.length === 0)
|
|
70
|
-
if (!validBoundWitnesses) {
|
|
71
|
-
console.log(`${name}: Invalid BoundWitnesses supplied for sellerSecret: ${sellerSecret}`)
|
|
72
|
-
return false
|
|
73
|
-
}
|
|
74
|
-
return true
|
|
75
|
-
}
|
|
48
|
+
return getPartySecretSignedValidator(dictionary, 'seller')
|
|
76
49
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Terms.d.ts","sourceRoot":"","sources":["../../../src/Escrow/Terms.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;AAChD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAA;AAOzD,eAAO,MAAM,iBAAiB,4BAAmC,CAAA;AACjE,MAAM,MAAM,iBAAiB,GAAG,OAAO,iBAAiB,CAAA;AAGxD,MAAM,WAAW,iBAAiB;IAIhC,oBAAoB,EAAE,OAAO,EAAE,CAAA;IAI/B,UAAU,EAAE,IAAI,EAAE,CAAA;IAIlB,MAAM,EAAE,IAAI,EAAE,CAAA;IAId,KAAK,EAAE,OAAO,EAAE,CAAA;IAIhB,WAAW,EAAE,IAAI,CAAA;IAIjB,SAAS,EAAE,IAAI,EAAE,CAAA;IAIjB,WAAW,EAAE,OAAO,CAAA;IAIpB,GAAG,EAAE,MAAM,CAAA;IAIX,GAAG,EAAE,MAAM,CAAA;IAIX,kBAAkB,EAAE,OAAO,EAAE,CAAA;IAI7B,MAAM,EAAE,OAAO,EAAE,CAAA;IAIjB,YAAY,EAAE,IAAI,CAAA;CACnB;AAKD,MAAM,MAAM,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC,iBAAiB,CAAC,EAAE,iBAAiB,CAAC,CAAA;AAKhF,eAAO,MAAM,aAAa;;CAAwD,CAAA;AAKlF,eAAO,MAAM,wBAAwB;;EAAmE,CAAA;AAKxG,eAAO,MAAM,qBAAqB;;EAAgE,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createEscrowIntent.d.ts","sourceRoot":"","sources":["../../../src/Escrow/createEscrowIntent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAA;AAEjE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAA;AAE/D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAS7C,eAAO,MAAM,kBAAkB,UAAiB,WAAW,EAAE,WAAW,eAAe;;;;;;;;;;;MAGtF,CAAA;AASD,eAAO,MAAM,4BAA4B,UAAiB,WAAW,UAAU,SAAS,WAAW,eAAe;;;;;;;;;;;MAGjH,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getEscrowSecret.d.ts","sourceRoot":"","sources":["../../../src/Escrow/getEscrowSecret.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAA;AAO/D,eAAO,MAAM,eAAe,QAAO,SAElC,CAAA"}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|