Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@web3-storage/capabilities

Package Overview
Dependencies
Maintainers
5
Versions
62
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@web3-storage/capabilities - npm Package Compare versions

Comparing version 17.1.1 to 17.2.0

9

dist/src/blob.d.ts

@@ -58,4 +58,13 @@ /**

}>>>;
/**
* Capability can be used to get the stored Blob from the (memory)
* space identified by `with` field.
*/
export const get: import("@ucanto/interface").TheCapabilityParser<import("@ucanto/interface").CapabilityMatch<"space/blob/get/0/1", `did:key:${string}` & `did:${string}` & import("@ucanto/interface").Phantom<{
protocol: "did:";
}>, Schema.InferStruct<{
digest: Schema.Schema<Uint8Array, unknown>;
}>>>;
export { Schema };
import { Schema } from '@ucanto/validator';
//# sourceMappingURL=blob.d.ts.map

@@ -381,2 +381,3 @@ import type { TupleToUnion } from 'type-fest';

export type BlobList = InferInvokedCapability<typeof BlobCaps.list>;
export type BlobGet = InferInvokedCapability<typeof BlobCaps.get>;
export type ServiceBlob = InferInvokedCapability<typeof W3sBlobCaps.blob>;

@@ -410,2 +411,10 @@ export type BlobAllocate = InferInvokedCapability<typeof W3sBlobCaps.allocate>;

export type BlobListFailure = Ucanto.Failure;
export interface BlobGetSuccess {
blob: {
digest: Uint8Array;
size: number;
};
cause: UnknownLink;
}
export type BlobGetFailure = Ucanto.Failure;
export interface BlobAllocateSuccess {

@@ -660,2 +669,3 @@ size: number;

BlobList['can'],
BlobGet['can'],
ServiceBlob['can'],

@@ -662,0 +672,0 @@ BlobAllocate['can'],

2

package.json
{
"name": "@web3-storage/capabilities",
"version": "17.1.1",
"version": "17.2.0",
"description": "UCAN Capabilities provided by web3.storage",

@@ -5,0 +5,0 @@ "homepage": "https://web3.storage",

@@ -140,4 +140,39 @@ /**

/**
* Capability can be used to get the stored Blob from the (memory)
* space identified by `with` field.
*/
export const get = capability({
can: 'space/blob/get/0/1',
/**
* DID of the (memory) space where Blob is stored.
*/
with: SpaceDID,
nb: Schema.struct({
/**
* A multihash digest of the blob payload bytes, uniquely identifying blob.
*/
digest: Schema.bytes(),
}),
derives: (claimed, delegated) => {
if (claimed.with !== delegated.with) {
return fail(
`Expected 'with: "${delegated.with}"' instead got '${claimed.with}'`
)
} else if (
delegated.nb.digest &&
!equals(delegated.nb.digest, claimed.nb.digest)
) {
return fail(
`Link ${
claimed.nb.digest ? `${claimed.nb.digest}` : ''
} violates imposed ${delegated.nb.digest} constraint.`
)
}
return ok({})
},
})
// ⚠️ We export imports here so they are not omitted in generated typedefs
// @see https://github.com/microsoft/TypeScript/issues/51548
export { Schema }

@@ -505,2 +505,3 @@ import type { TupleToUnion } from 'type-fest'

export type BlobList = InferInvokedCapability<typeof BlobCaps.list>
export type BlobGet = InferInvokedCapability<typeof BlobCaps.get>
export type ServiceBlob = InferInvokedCapability<typeof W3sBlobCaps.blob>

@@ -554,2 +555,11 @@ export type BlobAllocate = InferInvokedCapability<typeof W3sBlobCaps.allocate>

// Blob get
export interface BlobGetSuccess {
blob: { digest: Uint8Array; size: number }
cause: UnknownLink
}
// TODO: make types more specific
export type BlobGetFailure = Ucanto.Failure
// Blob allocate

@@ -907,2 +917,3 @@ export interface BlobAllocateSuccess {

BlobList['can'],
BlobGet['can'],
ServiceBlob['can'],

@@ -909,0 +920,0 @@ BlobAllocate['can'],

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc