@web3-storage/capabilities
Advanced tools
Comparing version 6.0.1 to 7.0.0
@@ -9,6 +9,8 @@ /** | ||
offer: Schema.Schema<import("@ucanto/interface").Link<unknown, number, number, 0 | 1>, any>; | ||
commitmentProof: Schema.Schema<import("@ucanto/interface").Link<unknown, number, number, 0 | 1>, any>; | ||
size: Schema.NumberSchema<number & import("@ucanto/interface").Phantom<{ | ||
typeof: "integer"; | ||
}>, unknown>; | ||
piece: Schema.StructSchema<{ | ||
link: Schema.Schema<import("@ucanto/interface").Link<unknown, 61697, 4114, 1>, any>; | ||
size: Schema.NumberSchema<number & import("@ucanto/interface").Phantom<{ | ||
typeof: "integer"; | ||
}>, unknown>; | ||
}, any>; | ||
}>>>; | ||
@@ -22,3 +24,3 @@ /** | ||
}>, Schema.InferStruct<{ | ||
commitmentProof: Schema.Schema<import("@ucanto/interface").Link<unknown, number, number, 0 | 1>, any>; | ||
subject: Schema.Schema<import("@ucanto/interface").Link<unknown, number, number, 0 | 1>, any>; | ||
}>>>; | ||
@@ -25,0 +27,0 @@ export { Schema }; |
@@ -7,3 +7,3 @@ /** | ||
}>, Schema.InferStruct<{ | ||
commitmentProof: Schema.Schema<import("@ucanto/interface").Link<unknown, number, number, 0 | 1>, any>; | ||
pieceLink: Schema.Schema<import("@ucanto/interface").Link<unknown, number, number, 0 | 1>, any>; | ||
}>>>; | ||
@@ -10,0 +10,0 @@ export { Schema }; |
{ | ||
"name": "@web3-storage/capabilities", | ||
"version": "6.0.1", | ||
"version": "7.0.0", | ||
"description": "Capabilities provided by web3.storage", | ||
@@ -75,2 +75,3 @@ "homepage": "https://github.com/web3-storage/w3protocol/tree/main/packages/capabilities", | ||
"unicorn/expiring-todo-comments": "off", | ||
"unicorn/numeric-separators-style": "off", | ||
"unicorn/prefer-number-properties": "off", | ||
@@ -77,0 +78,0 @@ "unicorn/prefer-export-from": "off", |
@@ -15,2 +15,11 @@ /** | ||
/** | ||
* @see https://github.com/multiformats/go-multihash/blob/dc3bd6897fcd17f6acd8d4d6ffd2cea3d4d3ebeb/multihash.go#L73 | ||
*/ | ||
const SHA2_256_TRUNC254_PADDED = 0x1012 | ||
/** | ||
* @see https://github.com/ipfs/go-cid/blob/829c826f6be23320846f4b7318aee4d17bf8e094/cid.go#L104 | ||
*/ | ||
const FilCommitmentUnsealed = 0xf101 | ||
/** | ||
* `aggregate/offer` capability allows agent to create an offer to get an aggregate | ||
@@ -33,8 +42,20 @@ * of CARs files in the market to be fetched and stored by a Storage provider. | ||
* Commitment proof for the aggregate being offered. | ||
* https://github.com/filecoin-project/go-state-types/blob/1e6cf0d47cdda75383ef036fc2725d1cf51dbde8/abi/piece.go#L47-L50 | ||
*/ | ||
commitmentProof: Schema.link(), | ||
/** | ||
* Size of the combined CAR files to be offered as aggregate. | ||
*/ | ||
size: Schema.integer(), | ||
piece: Schema.struct({ | ||
/** | ||
* CID of the aggregate piece. | ||
*/ | ||
link: Schema.link({ | ||
code: FilCommitmentUnsealed, | ||
version: 1, | ||
multihash: { | ||
code: SHA2_256_TRUNC254_PADDED, | ||
}, | ||
}), | ||
/** | ||
* Size in nodes. For BLS12-381 (capacity 254 bits), must be >= 16. (16 * 8 = 128) | ||
*/ | ||
size: Schema.integer(), | ||
}), | ||
}), | ||
@@ -46,9 +67,5 @@ derives: (claim, from) => { | ||
and( | ||
checkLink( | ||
claim.nb.commitmentProof, | ||
from.nb.commitmentProof, | ||
'nb.commitmentProof' | ||
) | ||
checkLink(claim.nb.piece.link, from.nb.piece.link, 'nb.piece.link') | ||
) || | ||
and(equal(claim.nb.size, from.nb.size, 'nb.size')) || | ||
and(equal(claim.nb.piece.size, from.nb.piece.size, 'nb.piece.size')) || | ||
ok({}) | ||
@@ -70,3 +87,3 @@ ) | ||
*/ | ||
commitmentProof: Schema.link(), | ||
subject: Schema.link(), | ||
}), | ||
@@ -76,9 +93,3 @@ derives: (claim, from) => { | ||
and(equalWith(claim, from)) || | ||
and( | ||
checkLink( | ||
claim.nb.commitmentProof, | ||
from.nb.commitmentProof, | ||
'nb.commitmentProof' | ||
) | ||
) || | ||
and(checkLink(claim.nb.subject, from.nb.subject, 'nb.subject')) || | ||
ok({}) | ||
@@ -85,0 +96,0 @@ ) |
@@ -24,3 +24,3 @@ /** | ||
*/ | ||
commitmentProof: Schema.link(), | ||
pieceLink: Schema.link(), | ||
}), | ||
@@ -30,9 +30,3 @@ derives: (claim, from) => { | ||
and(equalWith(claim, from)) || | ||
and( | ||
checkLink( | ||
claim.nb.commitmentProof, | ||
from.nb.commitmentProof, | ||
'nb.commitmentProof' | ||
) | ||
) || | ||
and(checkLink(claim.nb.pieceLink, from.nb.pieceLink, 'nb.pieceLink')) || | ||
ok({}) | ||
@@ -39,0 +33,0 @@ ) |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
86907
1909