Closed oritwoen closed 5 years ago
Sounds interesting!
What do you think @arweave-kyle ?
Hey @ririen, are we talking about signature generation and verification, or public key encryption and decryption?
Currently the library allows fo signing of arbitrary data
import Arweave from "arweave/web";
const instance = Arweave.init({ protocol: "https", host: "arweave.net",port:443});
await arweave.crypto.sign(jwk, data);
await crypto.verify(publicKey, data, signature);
The typescript definitions for these methods are
sign(jwk: JWKInterface, data: Uint8Array): Promise<Uint8Array>;
verify(
publicModulus: string,
data: Uint8Array,
signature: Uint8Array
): Promise<boolean>;
https://github.com/ArweaveTeam/arweave-js/blob/master/src/common/lib/crypto/crypto-interface.ts
Would you want a different interface for this, or is there a use case it doesn't work well for?
@arweave-kyle Yes, there is a function of signing the data you mentioned. However, for users creating new internet and peramwebs are a little limited. If someone is involved in programming and knows how to do it, he will develop it properly in his own app. However, novice users may have a problem with converting relevant data so that they can be signed appropriately.
What I am aiming at is creating a class that changes the file data from the path automatically and signs it. And then it automatically checks them, determines the format and writes to the path. Currently, the user himself must write functions that change the image / video or other materials to the appropriate formats and then use the signing.
After entering my PR, just give someone the path to the image / video or other material and the library will generate the appropriate signature. I will also decode this signature as a corresponding file on the server / computer itself.
Currently:
After my PR:
Hey @ririen, as the current library already allows for signing of arbitrary data and it sounds like the priory use case for this would be for off-chain purposes, I think it might make sense to create a new library for such a use case.
You could use the library arweave-js library as a dependency in a new library and then you'd only have to implement what's necessary for the use case.
The arweave-js library currently runs in node and browsers, so I think it might get a bit fussy to get a consistent api for browsers and node if its interacting with the file system with lots of assumptions.
Let me know what you're thinking about how to continue.
Thanks!
Hey @ririen -- just doing some housekeeping so I'll close this issue for now as it's inactive. Feel free to reopen if you have any more feedback or questions, thanks!
How do I get the public key from jwt?
As a programmer and a normal person who uses the capabilities of Arweave, I would like to be able to easily sign data, including graphic or video files.
Currently, there is no function that is responsible for just signing the data (at least from what I have noticed) but only signing the transaction.
I suggest creating a special class where it will be possible to sign data in text format as well as files.
Draft example
Create
Read
The way it works
Benefits
Implementation
I'm starting to work on it and PR will appear soon. If someone wants to help me, I will always be grateful for TIP to the addresses below :D I invite you to discussions and suggestions.
ETH:
0xCf44E2Ae6f68a0412D52ABdb6B41A4A59e2E3306
AR:KTcbsn6vg1Ud5ZDSKgbYisc7SVBsalkJprsQtGNjVN8