Skip to content

Commit

Permalink
feat: configurable connection
Browse files Browse the repository at this point in the history
  • Loading branch information
alanshaw committed Mar 21, 2023
1 parent f73f4e4 commit 0ef93a3
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/client/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,15 +94,18 @@ export async function follow ({ issuer, with: resource, proofs, audience }, opti

/**
* @template T
* @param {object} [options]
* @param {import('@ucanto/interface').Principal} [options.servicePrincipal]
* @param {URL} [options.serviceURL]
* @returns {import('@ucanto/interface').ConnectionView<import('../service').Service<T>>}
*/
export function connect () {
export function connect (options) {
return clientConnect({
id: DID.parse(SERVICE_PRINCIPAL),
id: options?.servicePrincipal ?? DID.parse(SERVICE_PRINCIPAL),
encoder: CAR,
decoder: CBOR,
channel: HTTP.open({
url: new URL(SERVICE_URL),
url: options?.serviceURL ?? new URL(SERVICE_URL),
method: 'POST'
})
})
Expand Down

0 comments on commit 0ef93a3

Please sign in to comment.