@web3-storage/access
Advanced tools
Comparing version
@@ -18,6 +18,8 @@ /** | ||
* @param {object} opts | ||
* @param {string} [opts.nonce] - nonce to use for the claim | ||
* @param {boolean} [opts.addProofs] - whether to addProof to access agent | ||
* @returns | ||
*/ | ||
export function claimAccess(access: AccessAgent, audienceOfClaimedDelegations?: `did:${string}:${string}` | undefined, { addProofs }?: { | ||
export function claimAccess(access: AccessAgent, audienceOfClaimedDelegations?: `did:${string}:${string}` | undefined, { addProofs, nonce }?: { | ||
nonce?: string | undefined; | ||
addProofs?: boolean | undefined; | ||
@@ -24,0 +26,0 @@ }): Promise<API.Delegation<API.Capabilities>[]>; |
@@ -38,9 +38,11 @@ import { addSpacesFromDelegations, Agent as AccessAgent } from './agent.js'; | ||
* @param {object} opts | ||
* @param {string} [opts.nonce] - nonce to use for the claim | ||
* @param {boolean} [opts.addProofs] - whether to addProof to access agent | ||
* @returns | ||
*/ | ||
export async function claimAccess(access, audienceOfClaimedDelegations = access.connection.id.did(), { addProofs = false } = {}) { | ||
export async function claimAccess(access, audienceOfClaimedDelegations = access.connection.id.did(), { addProofs = false, nonce } = {}) { | ||
const res = await access.invokeAndExecute(Access.claim, { | ||
audience: access.connection.id, | ||
with: audienceOfClaimedDelegations, | ||
nonce, | ||
}); | ||
@@ -47,0 +49,0 @@ if (res.out.error) { |
@@ -271,4 +271,8 @@ /** | ||
* @param {API.URI<"did:">} [space] | ||
* @param {object} [options] | ||
* @param {string} [options.nonce] | ||
*/ | ||
getSpaceInfo(space?: Client.URI<"did:"> | undefined): Promise<API.SpaceInfoResult>; | ||
getSpaceInfo(space?: Client.URI<"did:"> | undefined, options?: { | ||
nonce?: string | undefined; | ||
} | undefined): Promise<API.SpaceInfoResult>; | ||
#private; | ||
@@ -275,0 +279,0 @@ } |
@@ -501,2 +501,3 @@ import * as Client from '@ucanto/client'; | ||
proofs: [...proofs], | ||
nonce: options.nonce, | ||
}); | ||
@@ -509,4 +510,6 @@ return /** @type {API.IssuedInvocationView<API.InferInvokedCapability<CAP>>} */ (inv); | ||
* @param {API.URI<"did:">} [space] | ||
* @param {object} [options] | ||
* @param {string} [options.nonce] | ||
*/ | ||
async getSpaceInfo(space) { | ||
async getSpaceInfo(space, options) { | ||
const _space = space || this.currentSpace(); | ||
@@ -517,2 +520,3 @@ if (!_space) { | ||
const inv = await this.invokeAndExecute(Capabilities.info, { | ||
...options, | ||
with: _space, | ||
@@ -519,0 +523,0 @@ }); |
{ | ||
"name": "@web3-storage/access", | ||
"version": "19.0.0", | ||
"version": "20.0.0", | ||
"description": "w3access client", | ||
@@ -105,3 +105,3 @@ "homepage": "https://web3.storage", | ||
"@scure/bip39": "^1.2.1", | ||
"@web3-storage/capabilities": "^17.1.0", | ||
"@web3-storage/capabilities": "^17.1.1", | ||
"@web3-storage/did-mailto": "^2.1.0" | ||
@@ -108,0 +108,0 @@ }, |
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
230997
0.24%4009
0.3%