We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
We build a new KeychainProgram that extends Program and can be used by devs to handle keys for them.
How might this be implemented?
import { Keychain } from '@peerbit/keychain' class KeychainDB extends Program implements Keychain, EncryptionProvider ? { @field({type: Documents<Key>}} keys: Documents<Key> async open() { await this.keys.open({ encryption: new EncryptionProvider(this) }} // create a encryption provider from 'this' because 'this' implements Keychain interface } async addKey(key: Key) { return this.keys.put(key, { encryption: { specific encryption options }} } }
... And how could we possibly use it?
import { KeychainDB } from '@peerbit/keychain' class MySpecialDBAndKeychain extends Program { @field({type: KeychainProgram}} keychain: KeychainProgram @field({type: Posts}} posts: Posts async open() { await this.keychain.open() await this.posts.open( { encryption: this.keychain.encryption } ) // use custom encryption provider (layer 1) } async createPost(content: string) { return this.posts.put(new Post(content)) } }
And then the Posts Document can use the passed encryption and decryption provider to store encrypted data.
Posts
The text was updated successfully, but these errors were encountered:
Successfully merging a pull request may close this issue.
We build a new KeychainProgram that extends Program and can be used by devs to handle keys for them.
How might this be implemented?
... And how could we possibly use it?
And then the
Posts
Document can use the passed encryption and decryption provider to store encrypted data.The text was updated successfully, but these errors were encountered: