Skip to content

Instantly share code, notes, and snippets.

@Jviejo
Created March 10, 2023 16:17
Show Gist options
  • Save Jviejo/a0593a51e856b0c236bda6bb9b2fccc3 to your computer and use it in GitHub Desktop.
Save Jviejo/a0593a51e856b0c236bda6bb9b2fccc3 to your computer and use it in GitHub Desktop.
import '@hyperledger/aries-askar-nodejs'
import { ariesAskar, LogLevel, Store, StoreKeyMethod } from '@hyperledger/aries-askar-shared'
const getRawKey = () => "9Lgah8ykGoxDNLxoEBKRFxrdV9JCU98w6jXz4xp3Z7kP" || Store.generateRawKey(Buffer.from('00000000000000000000000000000My1'))
console.log(getRawKey())
export const testStoreUri = 'postgres://postgres:postgres@localhost:5432/postgres' || 'sqlite://:memory:'
export const setupWallet = async () => {
const key = getRawKey()
return await Store.provision({
recreate: true,
uri: testStoreUri,
keyMethod: StoreKeyMethod.Raw,
passKey: key,
})
}
export const openWallet = async (profile) => {
const key = getRawKey()
return await Store.open({
uri: testStoreUri,
keyMethod: StoreKeyMethod.Raw,
passKey: key,
profile: "profile2"
})
}
(async () => {
const wallet = await openWallet("profile2");
// wallet.createProfile("profile2")
const sesion = await wallet.openSession()
await sesion.insert({
category: "category",
name: "name43",
value: "valor1",
tags: {
tag1: "tag1",
tag2: "tag1",
"~tag3": "tag311"
}
})
})()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment