{"_id":"@did.coop/wallet-attached-storage","_rev":"3-0309b8e499f9625621793201309ad333","name":"@did.coop/wallet-attached-storage","dist-tags":{"latest":"0.4.0"},"versions":{"0.1.0":{"name":"@did.coop/wallet-attached-storage","version":"0.1.0","keywords":["wallet","storage"],"author":{"url":"https://github.com/did-coop/","name":"DID.coop"},"license":"MIT","_id":"@did.coop/wallet-attached-storage@0.1.0","maintainers":[{"name":"gobengo","email":"bengoering@gmail.com"}],"homepage":"https://github.com/did-coop/wallet-attached-storage","bugs":{"url":"https://github.com/did-coop/wallet-attached-storage/issues"},"dist":{"shasum":"f869f2614fca59ecf3505dbc59ff61b8952f7d64","tarball":"https://registry.npmjs.org/@did.coop/wallet-attached-storage/-/wallet-attached-storage-0.1.0.tgz","fileCount":20,"integrity":"sha512-Y83xpoIaS7fpjl++kEfHukCh/33mp2hiMeJDodQ5kjjpsa3IWrYz6b28J4Kkc5g52M3laeQj8+x6zoCqiIV8xA==","signatures":[{"sig":"MEQCIGzPMYOm3+H0lYWeKvoiLLZSsJQz9OH2ku9PyCct5F2bAiBVyEKm7wBi3IOTozF3aryuxKFrP9tHNyhhfWNFyaITrA==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":13979},"main":"dist/index.js","mocha":{"spec":"test/**/*.ts","require":"ts-node/register","extension":["ts"]},"types":"dist/esm/index.d.ts","module":"dist/esm/index.js","browser":"dist/esm/index.js","engines":{"node":">=18.0"},"gitHead":"db02de511bdda8150a5c0efabcb80bd2adbd8ce1","scripts":{"lint":"ts-standard --fix --project tsconfig.spec.json src/**/*.ts test/**/*.ts","test":"npm run lint && npm run test-node && npm run test-karma","build":"npm run clear && tsc -d && tsc -p tsconfig.esm.json","clear":"rimraf dist/*","prepare":"npm run build","rebuild":"npm run clear && npm run build","test-node":"cross-env NODE_ENV=test TS_NODE_PROJECT=tsconfig.spec.json TS_NODE_COMPILER_OPTIONS='{\"module\": \"commonjs\" }' mocha -r ts-node/register --project tsconfig.spec.json --extensions 'ts' 'test/*.ts'","test-karma":"karma start"},"_npmUser":{"name":"gobengo","email":"bengoering@gmail.com"},"repository":{"url":"git+https://github.com/did-coop/wallet-attached-storage.git","type":"git"},"workspaces":{"packages":[".","fetch-client"]},"_npmVersion":"10.9.2","description":"A Typescript/Javascript isomorphic library template, for use in the browser, Node.js, and React Native.","directories":{},"ts-standard":{"ignore":["dist"]},"_nodeVersion":"22.9.0","dependencies":{"@wallet.storage/fetch-client":"*"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"chai":"^4.3.7","karma":"^6.4.2","mocha":"^10.2.0","rimraf":"^6.0.1","ts-node":"^10.9.1","cross-env":"^7.0.3","karma-chai":"^0.1.0","typescript":"^5.2.2","@types/chai":"^5.0.1","@types/node":"^22.10.7","karma-mocha":"^2.0.1","ts-standard":"^12.0.2","@types/mocha":"^10.0.10","karma-typescript":"^5.5.4","karma-mocha-reporter":"^2.2.5","karma-chrome-launcher":"^3.2.0","karma-sourcemap-loader":"^0.4.0"},"_npmOperationalInternal":{"tmp":"tmp/wallet-attached-storage_0.1.0_1744215106622_0.7920016711835831","host":"s3://npm-registry-packages-npm-production"}},"0.4.0":{"name":"@did.coop/wallet-attached-storage","description":"A Typescript/Javascript isomorphic library template, for use in the browser, Node.js, and React Native.","version":"0.4.0","scripts":{"build":"npm run clear && tsc -d && tsc -p tsconfig.esm.json","clear":"rimraf dist/*","lint":"ts-standard --fix --project tsconfig.spec.json src/**/*.ts test/**/*.ts","prepare":"npm run build","rebuild":"npm run clear && npm run build","test":"npm run lint && npm run test-node && npm run test-karma","test-karma":"karma start","test-node":"cross-env NODE_ENV=test TS_NODE_PROJECT=tsconfig.spec.json TS_NODE_COMPILER_OPTIONS='{\"module\": \"commonjs\" }' mocha -r ts-node/register --project tsconfig.spec.json --extensions 'ts' 'test/*.ts'"},"main":"dist/index.js","module":"dist/esm/index.js","browser":"dist/esm/index.js","types":"dist/esm/index.d.ts","exports":{".":{"types":"./dist/esm/index.d.ts","default":"./dist/esm/index.js"}},"dependencies":{"@wallet.storage/fetch-client":"*"},"devDependencies":{"@types/chai":"^5.0.1","@types/mocha":"^10.0.10","@types/node":"^22.10.7","chai":"^4.3.7","cross-env":"^7.0.3","karma":"^6.4.2","karma-chai":"^0.1.0","karma-chrome-launcher":"^3.2.0","karma-mocha":"^2.0.1","karma-mocha-reporter":"^2.2.5","karma-sourcemap-loader":"^0.4.0","karma-typescript":"^5.5.4","mocha":"^10.2.0","rimraf":"^6.0.1","ts-node":"^10.9.1","ts-standard":"^12.0.2","typescript":"^5.2.2"},"publishConfig":{"access":"public"},"mocha":{"require":"ts-node/register","extension":["ts"],"spec":"test/**/*.ts"},"ts-standard":{"ignore":["dist"]},"keywords":["wallet","storage"],"engines":{"node":">=18.0"},"author":{"name":"DID.coop","url":"https://github.com/did-coop/"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/did-coop/wallet-attached-storage.git"},"homepage":"https://github.com/did-coop/wallet-attached-storage","bugs":{"url":"https://github.com/did-coop/wallet-attached-storage/issues"},"workspaces":{"packages":[".","fetch-client"]},"_id":"@did.coop/wallet-attached-storage@0.4.0","gitHead":"c4beff415254f094ec695c33321ddaefd7dffc31","_nodeVersion":"22.13.1","_npmVersion":"11.0.0","dist":{"integrity":"sha512-zkvm4o2JmIfId0UizA3+L9ttO/CKMwn7UUwZ+l4zKAbJr1IG/JFyQ87TOMmDSUY4bkKa/rKLXviXctNAeqcZ5A==","shasum":"b67483654fae4ea1918c31e776012a8daca7cfad","tarball":"https://registry.npmjs.org/@did.coop/wallet-attached-storage/-/wallet-attached-storage-0.4.0.tgz","fileCount":20,"unpackedSize":14242,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQCDVgw0tLA2/7NpBJo4zJyGfuYv7j0PNi0FN/jT+ch+ZgIhAKXgIU1Pq2DgWG24sbP3mZ40B5DR4Xw2zJ5axuqYkMIh"}]},"_npmUser":{"name":"codenamedmitri","email":"dzagidulin@gmail.com"},"directories":{},"maintainers":[{"name":"gobengo","email":"bengoering@gmail.com"},{"name":"codenamedmitri","email":"dzagidulin@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/wallet-attached-storage_0.4.0_1747324500656_0.36197720907956477"},"_hasShrinkwrap":false}},"time":{"created":"2025-04-09T16:11:46.528Z","modified":"2025-05-15T15:55:01.000Z","0.1.0":"2025-04-09T16:11:46.916Z","0.4.0":"2025-05-15T15:55:00.817Z"},"bugs":{"url":"https://github.com/did-coop/wallet-attached-storage/issues"},"author":{"name":"DID.coop","url":"https://github.com/did-coop/"},"license":"MIT","homepage":"https://github.com/did-coop/wallet-attached-storage","keywords":["wallet","storage"],"repository":{"type":"git","url":"git+https://github.com/did-coop/wallet-attached-storage.git"},"description":"A Typescript/Javascript isomorphic library template, for use in the browser, Node.js, and React Native.","maintainers":[{"name":"gobengo","email":"bengoering@gmail.com"},{"name":"codenamedmitri","email":"dzagidulin@gmail.com"}],"readme":"# Wallet Attached Storage Client _(@did.coop/wallet-attached-storage)_\n\n[![Build status](https://img.shields.io/github/actions/workflow/status/did-coop/wallet-attached-storage/main.yml?branch=main)](https://github.com/did-coop/wallet-attached-storage/actions?query=workflow%3A%22Node.js+CI%22)\n[![NPM Version](https://img.shields.io/npm/v/@did.coop/wallet-attached-storage.svg)](https://npm.im/@did.coop/wallet-attached-storage)\n\n> A Wallet Attached Storage Javascript/TypeScript client for Node, browser and React Native.\n\n## Table of Contents\n\n- [Background](#background)\n- [Security](#security)\n- [Install](#install)\n- [Usage](#usage)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Background\n\nSee in progress spec: https://wallet.storage/spec\n\n### App Identity and Key Management\n\nTo use Wallet Attached Storage (to provision data spaces, to create collections,\nand to read and write resources), the application or service using this client\nwill need its own cryptographically provable identity (in the form of a\n[DID](https://w3c.github.io/did-core/)).\n\nAt minimum, this means that the app or service using this client will need to\ncreate and manage its own public-private key pair. The challenges and security\nconsiderations of cryptographic key management are beyond the scope of this\nusage document, but roughly:\n\n* For in browser **client-only Single Page Applications** (SPAs), the app's\n  identity is ephemeral -- essentially a key pair will be generated for each\n  new user session, and stored in the browser.\n\n* For traditional **server side web applications**, it is recommended that the\n  app's DID and key pairs are managed securely, on the server side, preferably\n  using an HSM (Hardware Security Module).\n\n* For **mobile apps**, key pairs may be generated during setup, and can take\n  advantage of the mobile operating system's keychain and encrypted app storage.\n\n## Security\n\nTBD\n\n## Install\n\n- Node.js 18+ is recommended.\n\n### NPM\n\nTo install via NPM:\n\n```\nnpm install @did.coop/wallet-attached-storage\n```\n\n### Development\n\nTo install locally (for development):\n\n```\ngit clone https://github.com/did-coop/wallet-attached-storage.git\ncd wallet-attached-storage\nnpm install\n```\n\n## Usage\n\nThis client assumes:\n\n* a remote Wallet Attached Storage server is available\n* the app is able to create and store a public-private key pair, see the\n  [App Identity and Key Management](#app-identity-and-key-management) section\n  for more details.\n\nExample key pair generation (for an in-browser SPA), for persistence in local\nstorage.\n\n```ts\nimport { Ed25519Signer } from '@did.coop/did-key-ed25519'\n\nconst appDidSigner = await Ed25519Signer.generate()\n```\n\nExample storing and loading:\n\n```ts\n// Serialize to JSON for storage\nconst exportedKeyPair = appDidSigner.toJSON()\nlocalStorage.setItem('app-DID', JSON.stringify(exportedKeyPair))\n\n// Load from storage and turn back into a DID Signer\nconst loadedKeyPair = localStorage.getItem('app-DID')\nconst appDidSigner = Ed25519Signer.fromJSON(loadedKeyPair)\n```\n\nCreate a Wallet Attached Storage Client, connect it to a remote url:\n\n```ts\nimport { WalletStorage } from '@did.coop/wallet-attached-storage'\n\nconst url = 'https://data.pub' // load this from config\n\nlet storage\ntry {\n  storage = WalletStorage.connect({ url, signer: appDidSigner })\n} catch (e) {\n  console.error('Error connecting:', e)\n  throw e\n}\n```\n\nNow you can read and write resources to and from collections:\n\n```ts\n// Create a reference to the Credentials collection (note that no API calls are\n//   made yet)\nconst credentials = storage.collection('credentials')\n\n// Iterate through the collection, fetch the resources\nfor await (const resource of credentials) {\n  const response = await resource.get()\n  const vc = await response.json()\n  console.log(JSON.stringify(vc, null, 2))\n}\n\n// Upload a VC\nawait credentials.resource().put(\n  new Blob(JSON.stringify(vc), { type: 'application/vc' })\n)\n\n// Upload Evidence / Documents\nawait storage.collection('documents')\n  .resource().put(getDocumentBlob())\n```\n\n## Contribute\n\nPRs accepted.\n\nIf editing the Readme, please conform to the\n[standard-readme](https://github.com/RichardLitt/standard-readme) specification.\n\n## License\n\n[MIT License](LICENSE.md) © 2025 DID.coop.\n","readmeFilename":"README.md"}