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

@web3-storage/access

Package Overview
Dependencies
Maintainers
7
Versions
85
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@web3-storage/access - npm Package Compare versions

Comparing version 12.0.2 to 13.0.0

2

dist/src/agent-data.d.ts

@@ -31,3 +31,3 @@ /**

meta: import("./types").AgentMeta;
principal: EdSigner.Signer<`did:key:${string}`, EdSigner.UCAN.SigAlg>;
principal: EdSigner.Signer<`did:key:${string}`, EdSigner.Crypto.SigAlg>;
spaces: Map<`did:${string}:${string}`, import("./types").SpaceMeta>;

@@ -34,0 +34,0 @@ delegations: Map<string, {

/**
* @typedef {import('./types').Service} Service
* @typedef {import('@ucanto/interface').Receipt<any, any>} Receipt
*/

@@ -194,4 +195,32 @@ /**

delegate(options: import('./types').DelegationOptions): Promise<Client.Delegation<Client.Capabilities>>;
invokeAndExecute<A extends Client.Ability, R extends Client.URI<`${string}:`>, C extends Client.Caveats>(cap: Client.TheCapabilityParser<Client.CapabilityMatch<A, R, C>>, options: import("./types").InvokeOptions<A, R, Client.TheCapabilityParser<Client.CapabilityMatch<A, R, C>>>): Promise<Client.InferServiceInvocationReturn<Client.InferCapability<Client.ParsedCapability<A, R, C> & Client.Capability<Client.Ability, `${string}:${string}`, unknown>>, import("./types").Service>>;
/**
* Invoke and execute the given capability on the Access service connection
*
* ```js
*
* await agent.invokeAndExecute(Space.recover, {
* nb: {
* identity: 'mailto: email@gmail.com',
* },
* })
*
* // sugar for
* const recoverInvocation = await agent.invoke(Space.recover, {
* nb: {
* identity: 'mailto: email@gmail.com',
* },
* })
*
* await recoverInvocation.execute(agent.connection)
* ```
*
* @template {Ucanto.Ability} A
* @template {Ucanto.URI} R
* @template {Ucanto.Caveats} C
* @param {Ucanto.TheCapabilityParser<Ucanto.CapabilityMatch<A, R, C>>} cap
* @param {import('./types').InvokeOptions<A, R, Ucanto.TheCapabilityParser<Ucanto.CapabilityMatch<A, R, C>>>} options
* @returns {Promise<Ucanto.InferReceipt<Ucanto.Capability<A, R, C>, import('./types').Service>>}
*/
invokeAndExecute<A extends Client.Ability, R extends Client.URI<`${string}:`>, C extends Client.Caveats>(cap: Client.TheCapabilityParser<Client.CapabilityMatch<A, R, C>>, options: import("./types").InvokeOptions<A, R, Client.TheCapabilityParser<Client.CapabilityMatch<A, R, C>>>): Promise<Client.InferReceipt<Client.Capability<A, R, C>, import("./types").Service>>;
/**
* Execute invocations on the agent's connection

@@ -215,3 +244,3 @@ *

*/
execute<C_1 extends Client.Capability<Client.Ability, `${string}:${string}`, any>, I extends Client.Transport.Tuple<Client.ServiceInvocation<C_1, import("./types").Service>>>(...invocations: I): Client.Await<Client.InferServiceInvocations<I, import("./types").Service>>;
execute<C_1 extends Client.Capability<Client.Ability, `${string}:${string}`, any>, I extends Client.Transport.Tuple<Client.ServiceInvocation<C_1, import("./types").Service>>>(...invocations: I): Client.Await<Client.InferReceipts<I, import("./types").Service>>;
/**

@@ -251,4 +280,4 @@ * Creates an invocation for the given capability with Agent's proofs, service, issuer and space.

*/
getSpaceInfo(space?: Client.URI<"did:"> | undefined): Promise<import("./types").SpaceInfoResult & {
error?: undefined;
getSpaceInfo(space?: Client.URI<"did:"> | undefined): Promise<import("./types").SpaceRecord | {
did: `did:key:${string}`;
}>;

@@ -258,2 +287,3 @@ #private;

export type Service = import('./types').Service;
export type Receipt = import('@ucanto/interface').Receipt<any, any>;
import * as Ucanto from "@ucanto/interface";

@@ -260,0 +290,0 @@ import * as Client from "@ucanto/client/src/lib.js";

@@ -8,3 +8,2 @@ import * as Ucanto from '@ucanto/interface';

export interface SpaceUnknown extends Ucanto.Failure {
error: true;
message: string;

@@ -11,0 +10,0 @@ name: 'SpaceUnknown';

@@ -1,3 +0,2 @@

import type { Capabilities, ConnectionView, Fact, Failure, Phantom, Principal, RequestEncoder, Resource, ResponseDecoder, ServiceMethod, URI, InferInvokedCapability, CapabilityParser, Match, Ability, UnknownMatch, Delegation, DID, Signer, SignerArchive, SigAlg, Caveats, TheCapabilityParser, CapabilityMatch } from '@ucanto/interface';
import * as Ucanto from '@ucanto/interface';
import type { Capabilities, ConnectionView, Fact, Failure, Phantom, Principal, RequestEncoder, Resource, ResponseDecoder, ServiceMethod, URI, InferInvokedCapability, CapabilityParser, Match, Ability, UnknownMatch, Delegation, DID, DIDKey, Signer, SignerArchive, SigAlg, Caveats, Unit, ToString } from '@ucanto/interface';
import type { Abilities, SpaceInfo, SpaceRecover, SpaceRecoverValidation, VoucherClaim, VoucherRedeem, Top, AccessAuthorize, AccessAuthorizeSuccess, AccessDelegate, AccessDelegateFailure, AccessDelegateSuccess, AccessClaim, AccessClaimSuccess, AccessClaimFailure, ProviderAdd, ProviderAddSuccess, ProviderAddFailure, AccessConfirm, AccessConfirmSuccess, AccessConfirmFailure } from '@web3-storage/capabilities/types';

@@ -14,6 +13,6 @@ import type { SetRequired } from 'type-fest';

export interface SpaceTable {
did: URI<'did:'>;
agent: URI<'did:'>;
did: DIDKey;
agent: DID;
email: string;
product: URI<`${string}:`>;
product: URI;
inserted_at: Generated<Date>;

@@ -32,3 +31,3 @@ updated_at: ColumnType<Date, never, Date>;

export interface AccountTable {
did: URI<'did:'>;
did: DID<'mailto'>;
inserted_at: Generated<Date>;

@@ -56,8 +55,8 @@ updated_at: ColumnType<Date, never, Date>;

voucher: {
claim: ServiceMethod<VoucherClaim, EncodedDelegation<[VoucherRedeem]> | undefined, Failure>;
redeem: ServiceMethod<VoucherRedeem, void, Failure>;
claim: ServiceMethod<VoucherClaim, EncodedDelegation<[VoucherRedeem]> | '', Failure>;
redeem: ServiceMethod<VoucherRedeem, Unit, Failure>;
};
space: {
info: ServiceMethod<SpaceInfo, SpaceInfoResult, Failure | SpaceUnknown>;
'recover-validation': ServiceMethod<SpaceRecoverValidation, EncodedDelegation<[SpaceRecover]> | undefined, Failure>;
'recover-validation': ServiceMethod<SpaceRecoverValidation, ToString<URL> | '', Failure>;
recover: ServiceMethod<SpaceRecover, Array<EncodedDelegation<[Top]>>, Failure>;

@@ -232,3 +231,2 @@ };

export type BytesDelegation<C extends Capabilities = Capabilities> = Uint8Array & Phantom<Delegation<C>>;
export type InvokeAndExecute = <A extends Ability, R extends URI, C extends Ucanto.Caveats>(cap: TheCapabilityParser<CapabilityMatch<A, R, C>>, options: InvokeOptions<A, R, TheCapabilityParser<CapabilityMatch<A, R, C>>>) => Promise<Ucanto.InferServiceInvocationReturn<Ucanto.InferInvokedCapability<Ucanto.TheCapabilityParser<Ucanto.CapabilityMatch<A, R, C>>>, import('./types').Service>>;
//# sourceMappingURL=types.d.ts.map
{
"name": "@web3-storage/access",
"version": "12.0.2",
"version": "13.0.0",
"description": "w3access client",

@@ -52,10 +52,10 @@ "homepage": "https://github.com/web3-storage/w3-protocol/tree/main/packages/access-client",

"dependencies": {
"@ipld/car": "^5.1.0",
"@ipld/dag-ucan": "^3.2.0",
"@ucanto/client": "^5.1.0",
"@ucanto/core": "^5.2.0",
"@ucanto/interface": "^6.2.0",
"@ucanto/principal": "^5.1.0",
"@ucanto/transport": "^5.1.1",
"@ucanto/validator": "^6.1.0",
"@ipld/car": "^5.1.1",
"@ipld/dag-ucan": "^3.3.2",
"@ucanto/client": "^7.0.1",
"@ucanto/core": "^7.0.1",
"@ucanto/interface": "^7.0.1",
"@ucanto/principal": "^7.0.0",
"@ucanto/transport": "^7.0.3",
"@ucanto/validator": "^7.0.0",
"bigint-mod-arith": "^3.1.2",

@@ -75,4 +75,4 @@ "conf": "10.2.0",

"zod": "^3.20.2",
"@web3-storage/capabilities": "^4.0.1",
"@web3-storage/did-mailto": "^1.0.0"
"@web3-storage/capabilities": "^5.0.0",
"@web3-storage/did-mailto": "^2.0.0"
},

@@ -87,3 +87,3 @@ "devDependencies": {

"@types/ws": "^8.5.4",
"@ucanto/server": "^6.1.0",
"@ucanto/server": "^7.0.2",
"assert": "^2.0.0",

@@ -148,2 +148,3 @@ "hd-scripts": "^4.0.0",

"build": "tsc --build",
"check": "tsc --build",
"test": "pnpm -r run build && npm run test:node && npm run test:browser",

@@ -150,0 +151,0 @@ "test:node": "mocha 'test/**/!(*.browser).test.js' -n experimental-vm-modules -n no-warnings",

@@ -30,4 +30,4 @@ import { addSpacesFromDelegations, Agent as AccessAgent } from './agent.js'

})
if (res?.error) {
throw res
if (res?.out.error) {
throw res.out.error
}

@@ -54,6 +54,6 @@ }

})
if (res.error) {
throw res
if (res.out.error) {
throw res.out.error
}
const delegations = Object.values(res.delegations).flatMap((bytes) =>
const delegations = Object.values(res.out.ok.delegations).flatMap((bytes) =>
bytesToDelegations(bytes)

@@ -88,4 +88,4 @@ )

})
if (result.error) {
throw result
if (result.out.error) {
throw result.out.error
}

@@ -127,4 +127,4 @@ }

})
if (res.error) throw res
const claims = Object.values(res.delegations).flatMap((d) =>
if (res.out.error) throw res.out.error
const claims = Object.values(res.out.ok.delegations).flatMap((d) =>
bytesToDelegations(d)

@@ -333,4 +333,4 @@ )

)
if (delegateSpaceAccessResult.error) {
throw delegateSpaceAccessResult
if (delegateSpaceAccessResult.out.error) {
throw delegateSpaceAccessResult.out.error
}

@@ -337,0 +337,0 @@ spaceMeta.isRegistered = true

@@ -7,3 +7,2 @@ /* eslint-disable max-depth */

import * as CAR from '@ucanto/transport/car'
import * as CBOR from '@ucanto/transport/cbor'
import * as HTTP from '@ucanto/transport/http'

@@ -51,2 +50,3 @@ import * as ucanto from '@ucanto/core'

* @typedef {import('./types').Service} Service
* @typedef {import('@ucanto/interface').Receipt<any, any>} Receipt
*/

@@ -74,4 +74,3 @@

id: options.principal ?? PRINCIPAL,
encoder: CAR,
decoder: CBOR,
codec: CAR.outbound,
channel:

@@ -348,3 +347,3 @@ options.channel ??

if (inv && inv.error) {
if (inv && inv.out.error) {
throw new Error('Recover validation failed', { cause: inv })

@@ -366,3 +365,3 @@ }

if (recoverInv && recoverInv.error) {
if (recoverInv.out.error) {
throw new Error('Spaces recover failed', { cause: recoverInv })

@@ -372,3 +371,3 @@ }

const dels = []
for (const del of recoverInv) {
for (const del of recoverInv.out.ok) {
dels.push(stringToDelegation(del))

@@ -476,3 +475,3 @@ }

if (inv && inv.error) {
if (inv && inv.out.error) {
throw new Error('Voucher claim failed', { cause: inv })

@@ -512,3 +511,3 @@ }

if (accInv && accInv.error) {
if (accInv && accInv.out.error) {
throw new Error('Space registration failed', { cause: accInv })

@@ -597,3 +596,2 @@ }

*
* @type {import('./types').InvokeAndExecute}
* @template {Ucanto.Ability} A

@@ -604,12 +602,8 @@ * @template {Ucanto.URI} R

* @param {import('./types').InvokeOptions<A, R, Ucanto.TheCapabilityParser<Ucanto.CapabilityMatch<A, R, C>>>} options
* @returns {Promise<Ucanto.InferReceipt<Ucanto.Capability<A, R, C>, import('./types').Service>>}
*/
async invokeAndExecute(cap, options) {
const inv = await this.invoke(cap, options)
// @ts-ignore
const out = inv.execute(this.connection)
return /** @type {Promise<Ucanto.InferServiceInvocationReturn<Ucanto.InferInvokedCapability<Ucanto.TheCapabilityParser<Ucanto.CapabilityMatch<A, R, C>>>, import('./types').Service>>} */ (
out
)
const out = inv.execute(/** @type {*} */ (this.connection))
return /** @type {*} */ (out)
}

@@ -725,7 +719,7 @@

if (inv.error) {
throw inv
if (inv.out.error) {
throw inv.out.error
}
return inv
return inv.out.ok
}

@@ -732,0 +726,0 @@ }

@@ -9,5 +9,4 @@ import * as Ucanto from '@ucanto/interface'

export interface SpaceUnknown extends Ucanto.Failure {
error: true
message: string
name: 'SpaceUnknown'
}

@@ -21,2 +21,3 @@ /* eslint-disable @typescript-eslint/indent */

DID,
DIDKey,
Signer,

@@ -26,6 +27,5 @@ SignerArchive,

Caveats,
TheCapabilityParser,
CapabilityMatch,
Unit,
ToString,
} from '@ucanto/interface'
import * as Ucanto from '@ucanto/interface'

@@ -69,6 +69,6 @@ import type {

export interface SpaceTable {
did: URI<'did:'>
agent: URI<'did:'>
did: DIDKey
agent: DID
email: string
product: URI<`${string}:`>
product: URI
inserted_at: Generated<Date>

@@ -93,3 +93,3 @@ updated_at: ColumnType<Date, never, Date>

export interface AccountTable {
did: URI<'did:'>
did: DID<'mailto'>
inserted_at: Generated<Date>

@@ -130,6 +130,6 @@ updated_at: ColumnType<Date, never, Date>

VoucherClaim,
EncodedDelegation<[VoucherRedeem]> | undefined,
EncodedDelegation<[VoucherRedeem]> | '',
Failure
>
redeem: ServiceMethod<VoucherRedeem, void, Failure>
redeem: ServiceMethod<VoucherRedeem, Unit, Failure>
}

@@ -140,3 +140,3 @@ space: {

SpaceRecoverValidation,
EncodedDelegation<[SpaceRecover]> | undefined,
ToString<URL> | '',
Failure

@@ -343,17 +343,1 @@ >

Uint8Array & Phantom<Delegation<C>>
export type InvokeAndExecute = <
A extends Ability,
R extends URI,
C extends Ucanto.Caveats
>(
cap: TheCapabilityParser<CapabilityMatch<A, R, C>>,
options: InvokeOptions<A, R, TheCapabilityParser<CapabilityMatch<A, R, C>>>
) => Promise<
Ucanto.InferServiceInvocationReturn<
Ucanto.InferInvokedCapability<
Ucanto.TheCapabilityParser<Ucanto.CapabilityMatch<A, R, C>>
>,
import('./types').Service
>
>

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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