-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Increased max Verifiable Credential size in Compose DB (#32)
* move ceramic npm-scripts into programmatically call-script file * hotfix * add migrations between composites * prevent duplicates * hotfix * upd manifest, fix vc tests * fix hardcoded definition, prevent duplicates from store migration * bump v * reduce store and old ceramic vcs * update changelog & bump v * add npmignore * add description for ceramic-prepare-vc script * Apply suggestions from code review * Apply suggestions from code review --------- Co-authored-by: Ihor Diachenko <[email protected]>
- Loading branch information
1 parent
dd691a7
commit fff3e19
Showing
17 changed files
with
214 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
{ | ||
"version": "2.0.1" | ||
"version": "2.0.2" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
ceramic-prepare-vc.mjs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
/** | ||
* @name ceramic-prepare-vc | ||
* @description Create composite from graphql model, | ||
* deploy and compile json files | ||
* | ||
* https://developers.ceramic.network/docs/composedb/create-your-composite | ||
*/ | ||
|
||
import path from 'path'; | ||
import fs from 'fs'; | ||
|
||
import { fileURLToPath } from 'url'; | ||
import npm from 'npm-commands'; | ||
|
||
const __filename = fileURLToPath(import.meta.url); | ||
const __dirname = path.dirname(__filename); | ||
|
||
// http://0.0.0.0:7007 || https://ceramic.rarimo.com | ||
const ceramicUrl = process.env.CERAMIC_URL; | ||
const didPK = process.env.DID_PRIVATE_KEY | ||
|
||
// Directory path | ||
const modelsDirPath = './ceramic/models'; | ||
|
||
// Reading directory contents | ||
fs.readdir(modelsDirPath, async (err, files) => { | ||
if (err) { | ||
console.error('Error reading directory:', err); | ||
return; | ||
} | ||
|
||
for (const file of files) { | ||
if (fs.statSync(path.join(modelsDirPath, file)).isFile()) { | ||
console.log('\n\n==========================================================\n\n'); | ||
console.log('PREPARE VC FOR:', file); | ||
|
||
const modelFile = path.join( | ||
__dirname, | ||
`./ceramic/models/${file}`, | ||
); | ||
|
||
const modelFileName = path.basename(`./ceramic/models/${modelFile}`, '.graphql'); | ||
|
||
const compositeOutput = path.join( | ||
__dirname, | ||
`./ceramic/composites/${modelFileName}.json`, | ||
); | ||
|
||
const runtimeOutput = path.join( | ||
__dirname, | ||
`./ceramic/composites/${modelFileName}-runtime.json`, | ||
); | ||
|
||
await npm().arguments({ | ||
['ceramic-url']: ceramicUrl, | ||
['output']: compositeOutput, | ||
['did-private-key']: didPK, | ||
}).runAsync(`composedb composite:create ${modelFile}`); | ||
|
||
await npm().arguments({ | ||
['ceramic-url']: ceramicUrl, | ||
['did-private-key']: didPK, | ||
}).runAsync(`composedb composite:deploy ${compositeOutput}`); | ||
|
||
await npm().arguments({ | ||
['ceramic-url']: ceramicUrl, | ||
}).runAsync(`composedb composite:compile ${compositeOutput} ${runtimeOutput}`); | ||
} | ||
} | ||
}); |
1 change: 1 addition & 0 deletions
1
packages/snap/ceramic/composites/VerifiableCredentialsV2-runtime.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"models":{"VerifiableCredential":{"interface":false,"implements":[],"id":"kjzl6hvfrbw6c5j1vrqei8a3h06om20x4qj8fj84ku46oew5b0yv9h6gyzwd2t4","accountRelation":{"type":"list"}}},"objects":{"VerifiableCredential":{"data":{"type":"string","required":true},"claimId":{"type":"string","required":true,"indexed":true},"ownerDid":{"type":"string","required":true,"indexed":true},"queryHash":{"type":"string","required":true,"indexed":true}}},"enums":{},"accountData":{"verifiableCredentialList":{"type":"connection","name":"VerifiableCredential"}}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"version":"1.1","models":{"kjzl6hvfrbw6c5j1vrqei8a3h06om20x4qj8fj84ku46oew5b0yv9h6gyzwd2t4":[{"jws":{"payload":"AXESIJ3BF8Q_1bYO8VuaK8GI5BbkQmxJ73zD-xykLspGo9pz","signatures":[{"signature":"vIKvgfCZ3ZdZAiiZtbViRwtGhK4yniFhsf9lbxTyg1LTY6K7699bdieQoggcYTWs_KoP19xU95gy5JNu7yQOCg","protected":"eyJhbGciOiJFZERTQSIsImtpZCI6ImRpZDprZXk6ejZNa2o2Tmt2Q1I0R0ZGU0pwWkxkNnZZb2FZVlJGTWtIcW1oVGd5MUhuTDVQSjJiI3o2TWtqNk5rdkNSNEdGRlNKcFpMZDZ2WW9hWVZSRk1rSHFtaFRneTFIbkw1UEoyYiJ9"}],"link":"bafyreie5yel4ip6vwyhpcw42fpayrzaw4rbgysppptb7whfef3feni62om"},"linkedBlock":"omRkYXRhqWRuYW1ldFZlcmlmaWFibGVDcmVkZW50aWFsZXZpZXdzoGZzY2hlbWGlZHR5cGVmb2JqZWN0ZyRzY2hlbWF4LGh0dHBzOi8vanNvbi1zY2hlbWEub3JnL2RyYWZ0LzIwMjAtMTIvc2NoZW1haHJlcXVpcmVkhGhvd25lckRpZGRkYXRhaXF1ZXJ5SGFzaGdjbGFpbUlkanByb3BlcnRpZXOkZGRhdGGiZHR5cGVmc3RyaW5naW1heExlbmd0aBoAD0JAZ2NsYWltSWSiZHR5cGVmc3RyaW5naW1heExlbmd0aBkH0Ghvd25lckRpZKJkdHlwZWZzdHJpbmdpbWF4TGVuZ3RoGQfQaXF1ZXJ5SGFzaKJkdHlwZWZzdHJpbmdpbWF4TGVuZ3RoGQfQdGFkZGl0aW9uYWxQcm9wZXJ0aWVz9Gd2ZXJzaW9uYzIuMGlpbnRlcmZhY2X0aXJlbGF0aW9uc6BqaW1wbGVtZW50c4BrZGVzY3JpcHRpb254NEEgbW9kZWwgZm9yIHN0b3JpbmcgZW5jcnlwdGVkIHZlcmlmaWFibGUgY3JlZGVudGlhbHNvYWNjb3VudFJlbGF0aW9uoWR0eXBlZGxpc3RmaGVhZGVyo2NzZXBlbW9kZWxlbW9kZWxSzgEEAXFxCwAJaG1vZGVsLXYxa2NvbnRyb2xsZXJzgXg4ZGlkOmtleTp6Nk1rajZOa3ZDUjRHRkZTSnBaTGQ2dllvYVlWUkZNa0hxbWhUZ3kxSG5MNVBKMmI="}]},"indices":{"kjzl6hvfrbw6c5j1vrqei8a3h06om20x4qj8fj84ku46oew5b0yv9h6gyzwd2t4":[{"fields":[{"path":["queryHash"]}]},{"fields":[{"path":["claimId"]}]},{"fields":[{"path":["ownerDid"]}]}]},"aliases":{"kjzl6hvfrbw6c5j1vrqei8a3h06om20x4qj8fj84ku46oew5b0yv9h6gyzwd2t4":"VerifiableCredential"},"views":{"account":{},"root":{},"models":{"kjzl6hvfrbw6c5j1vrqei8a3h06om20x4qj8fj84ku46oew5b0yv9h6gyzwd2t4":{}}},"commonEmbeds":[]} |
13 changes: 13 additions & 0 deletions
13
packages/snap/ceramic/models/VerifiableCredentialsV2.graphql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
type VerifiableCredential @createModel( | ||
description: "A model for storing encrypted verifiable credentials", | ||
accountRelation: LIST | ||
) | ||
@createIndex(fields: [{ path: "queryHash" }]) | ||
@createIndex(fields: [{ path: "claimId" }]) | ||
@createIndex(fields: [{ path: "ownerDid" }]) | ||
{ | ||
ownerDid: String! @string(maxLength: 2000) | ||
data: String! @string(maxLength: 1000000) | ||
queryHash: String! @string(maxLength: 2000) | ||
claimId: String! @string(maxLength: 2000) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.