How to use the blockstack/lib/encryption.decryptECIES function in blockstack

To help you get started, we’ve selected a few blockstack examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jehunter5811 / graphite-blockstack / src / components / messages / SingleConversation.js View on Github external
.then((file) => {
      console.log("Shared file: " + file);
      // console.log("Shared messages: " + JSON.parse(decryptECIES(privateKey, JSON.parse(file))));
      console.log("fetched!");

      this.setState({ tempMessages: JSON.parse(decryptECIES(privateKey, JSON.parse(file))) });
      let temp = this.state.tempMessages;
      this.setState({ sharedMessages: temp.messages});
      this.setState({ combinedMessages: [...this.state.myMessages, ...this.state.sharedMessages] });
      this.setState({ loading: "hide", show: "" });
      this.scrollToBottom();
    })
    .catch((error) => {
github Graphite-Docs / graphite / src / components / journalism / EditorAdmin.js View on Github external
.then((fileContents) => {
       if(fileContents) {
         console.log(JSON.parse(decryptECIES(privateKey, JSON.parse(fileContents))));
         this.setState({
           team: JSON.parse(decryptECIES(privateKey, JSON.parse(fileContents))).team,
           integrations: JSON.parse(decryptECIES(privateKey, JSON.parse(fileContents))).team,
           editorView: JSON.parse(decryptECIES(privateKey, JSON.parse(fileContents))).editorView,
           editorName: JSON.parse(decryptECIES(privateKey, JSON.parse(fileContents))).editorName,
           editorRoles: JSON.parse(decryptECIES(privateKey, JSON.parse(fileContents))).editorRoles,
           editorPermissions: JSON.parse(decryptECIES(privateKey, JSON.parse(fileContents))).editorPermissions,
           editorIntegrations: JSON.parse(decryptECIES(privateKey, JSON.parse(fileContents))).editorIntegrations,
           editorPublish: JSON.parse(decryptECIES(privateKey, JSON.parse(fileContents))).editorPublish,
           journoView: JSON.parse(decryptECIES(privateKey, JSON.parse(fileContents))).journoView,
           journoName: JSON.parse(decryptECIES(privateKey, JSON.parse(fileContents))).journoName,
           journoRoles: JSON.parse(decryptECIES(privateKey, JSON.parse(fileContents))).journoRoles,
           journoPermissions: JSON.parse(decryptECIES(privateKey, JSON.parse(fileContents))).journoPermissions,
           journoIntegrations: JSON.parse(decryptECIES(privateKey, JSON.parse(fileContents))).journoIntegrations,
           journoPublish: JSON.parse(decryptECIES(privateKey, JSON.parse(fileContents))).journoPublish,
           accountSettings: JSON.parse(decryptECIES(privateKey, JSON.parse(fileContents))).accountSettings,
           lastUpdated: JSON.parse(decryptECIES(privateKey, JSON.parse(fileContents))).lastUpdated
         })
       } else {
         this.setState({
           team: [],
           integrations: [],
           editorView: false,
           editorRoles: false,
           editorPermissions: false,
           editorIntegrations: false,
           editorPublish: false,
           journoView: false,
github Graphite-Docs / graphite / web / src / components / sheets / SharedSheetsCollection.js View on Github external
.then((fileContents) => {
         lookupProfile(this.state.user, "https://core.blockstack.org/v1/names")
           .then((profile) => {
             let image = profile.image;
             console.log(profile);
             if(profile.image){
               this.setState({img: image[0].contentUrl})
             } else {
               this.setState({ img: avatarFallbackImage })
             }
           })
           .catch((error) => {
             console.log('could not resolve profile')
           })
          this.setState({ shareFile: JSON.parse(decryptECIES(privateKey, JSON.parse(fileContents))), loading: false })
          console.log("loaded");
          this.save();
       })
        .catch(error => {
github jehunter5811 / graphite-blockstack / src / components / documents / SharedCollection.js View on Github external
.then((fileContents) => {
       let privateKey = loadUserData().appPrivateKey;
       console.log(JSON.parse(decryptECIES(privateKey, JSON.parse(fileContents))));
       this.setState({ docs: JSON.parse(decryptECIES(privateKey, JSON.parse(fileContents))) })
       console.log("loaded");
       this.save();
     })
      .catch(error => {
github Graphite-Docs / graphite / src / components / documents / TestDoc.js View on Github external
client.getFile('updated.txt').then(file => {
      if(file.data !=null) {
        this.setState({ remoteUpdated: decryptECIES(privateKey, JSON.parse(file.data)) });
      }
    });
  })
github Graphite-Docs / graphite / src / components / journalism / SingleJournoDoc.js View on Github external
.then((fileContents) => {
        this.setState({ loading: "hide"})
        let privateKey = loadUserData().appPrivateKey;
        if(JSON.parse(decryptECIES(privateKey, JSON.parse(fileContents))).length > 0) {
          this.setState({ totalPosts: JSON.parse(decryptECIES(privateKey, JSON.parse(fileContents))), loading: "hide" })
        } else {
          this.setState({ totalPosts: [], loading: "hide" })
        }
      })
      .then(() => {
github Graphite-Docs / graphite / src / components / documents / SingleDoc--NEW.js View on Github external
client.getFile('wordCount.txt').then(file => {
      if(file.data != null) {
        this.setState({ remoteWords: decryptECIES(privateKey, JSON.parse(file.data)) });
      }
    });
github Graphite-Docs / graphite / src / components / documents / TestDoc.js View on Github external
client.getFile('content.txt').then(file => {
      if(file.data !=null) {
        this.setState({ remoteContent: decryptECIES(privateKey, JSON.parse(file.data)) });
      }
    });
    client.getFile('wordCount.txt').then(file => {
github jehunter5811 / graphite-blockstack / src / components / messages / Conversations.js View on Github external
.then((file) => {
          this.setState({ tempMessages: JSON.parse(decryptECIES(privateKey, JSON.parse(file))) });
          let temp = this.state.tempMessages;
          if(this.state.newCount < 1) {
            this.setState({ newCount: temp.messages.length })
            this.setState({ sharedMessages: temp.messages});
          } else {
            if(this.state.newCount < temp.messages.length) {
              let newMessageCount = temp.messages.length - this.state.newCount;
              this.setState({ sharedMessages: temp.messages});
              this.setState({ newCount: this.state.newCount + newMessageCount })
              var audio = new Audio('https://notificationsounds.com/soundfiles/0fcbc61acd0479dc77e3cccc0f5ffca7/file-sounds-1078-case-closed.mp3');
              audio.play();
              if(document.hidden){
                this.changeFavicon();
              }
            } else {
              this.setState({ newCount: this.state.newCount});
github blockstack-radiks / kanstack / src / blockstack-db / dexie.js View on Github external
const decryptObject = (encrypted, privateKey, indexes) => {
  const decrypted = Object.assign({}, encrypted)
  for (const key in encrypted) {
    if (encrypted.hasOwnProperty(key) && indexes.indexOf(key) === -1) {
      const value = encrypted[key]
      decrypted[key] = stringToValue(decryptECIES(privateKey, value))
    }
  }
  return decrypted
}