-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TypeError: signer is not a function in BlossomClient.getUploadAuth() #2
Comments
I don't know what BlossomClientRef.value refers to but there are two if your using async function signer(event) {
return await window.nostr.signEvent(event);
}
const client = new BlossomClient('https://nstore.nostrver.se/', signer)
// this will try to call signer to sign an auth event
client.uploadBlob(file)
// or
client.uploadBlob(file, customAuth) If your using the static method const auth = {...}
const signed = await window.nostr.signEvent(auth)
await BlossomClient.uploadBlob("https://nstore.nostrver.se/", file, signed) |
In my code It's working now :) Using the uploadBlob() method const uploadAuthEvent = await BlossomClientRef.value.getUploadAuth(file, 'Upload ' + file.name)
const resBC = await BlossomClientRef.value.uploadBlob(file, uploadAuthEvent)
// and yes, this also works:
await BlossomClientRef.value.uploadBlob(file) Now works as expected :) NDK + Javascript method (which I prefer) const uploadEventToJSON = await uploadEvent.toNostrEvent() // uploadEvent is a NDKEvent object here
const res = await fetch('https://nstore.nostrver.se/upload', {
method: "PUT",
body: file,
headers: { authorization: "Nostr " + btoa(JSON.stringify(uploadEventToJSON)) },
}); Your example at https://github.com/hzrd149/blossom-server/blob/master/public/index.html also helped me figuring out what I was missing. The update I've just pushed: nostrver-se/nuxstr@83ba928#diff-8b4e022d7b2211fa2207cbe8323e0609c03238efcc9f326aef04cba89175d12f |
When I try to create an upload aut event, the following errors returns:
I'm using
NDK 2.8.1
andblossom-client-sdk
version0.5.1
here in nuxstr trying to upload a blob with a signed upload event: https://nuxstr.nostrver.se/blossomSource code: https://github.com/Sebastix/nuxstr/blob/master/pages/blossom.vue#L42
My browser is Brave and I'm using the nos2x browser extension as a signer.
The code of this logic which return the error is, please have a look at the comments which methods I've tried:
Also the manual way for uploading a blob is not working, a 500 is returned from https://nstore.nostrver.se. What I'm missing out while creating and signing the event? @hzrd149
When I connect the server to https://blossom.hzrd149.com/, everything works as expected when I upload a blob via that client.
The text was updated successfully, but these errors were encountered: