-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ca53986
commit e535a40
Showing
2 changed files
with
163 additions
and
102 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
{ | ||
"@context": [ | ||
"https://www.w3.org/ns/did/v1", | ||
"https://w3id.org/security/v2", | ||
"https://w3id.org/security/suites/secp256k1recovery-2020/v2", | ||
"https://w3id.org/security/suites/ed25519-2018/v1" | ||
], | ||
"id": "did:web:identity.foundation", | ||
"verificationMethod": [ | ||
{ | ||
"id": "did:web:identity.foundation#04d63533b05fd69cd05843d41d5cf35ef1461f08ec8f80ea33bc5750751ca2b6a5fa5c1b7ec78d10cb785cac20bdf91a681ac0a7f47cccdf010b4b2a20f9db1e78", | ||
"type": "EcdsaSecp256k1VerificationKey2019", | ||
"controller": "did:web:identity.foundation", | ||
"publicKeyHex": "04d63533b05fd69cd05843d41d5cf35ef1461f08ec8f80ea33bc5750751ca2b6a5fa5c1b7ec78d10cb785cac20bdf91a681ac0a7f47cccdf010b4b2a20f9db1e78" | ||
}, | ||
{ | ||
"id": "did:web:identity.foundation#6e6b416461e001f17961bbb0df763ed46cd9dcb64a2f37ade0f85579520de5f9", | ||
"type": "Ed25519VerificationKey2018", | ||
"controller": "did:web:identity.foundation", | ||
"publicKeyBase58": "8S2hqHB2PjNSdDgsULTEqjXx2n3zF32fjGabbDJocGyv" | ||
} | ||
], | ||
"authentication": [ | ||
"did:web:identity.foundation#04d63533b05fd69cd05843d41d5cf35ef1461f08ec8f80ea33bc5750751ca2b6a5fa5c1b7ec78d10cb785cac20bdf91a681ac0a7f47cccdf010b4b2a20f9db1e78", | ||
"did:web:identity.foundation#6e6b416461e001f17961bbb0df763ed46cd9dcb64a2f37ade0f85579520de5f9" | ||
], | ||
"assertionMethod": [ | ||
"did:web:identity.foundation#04d63533b05fd69cd05843d41d5cf35ef1461f08ec8f80ea33bc5750751ca2b6a5fa5c1b7ec78d10cb785cac20bdf91a681ac0a7f47cccdf010b4b2a20f9db1e78", | ||
"did:web:identity.foundation#6e6b416461e001f17961bbb0df763ed46cd9dcb64a2f37ade0f85579520de5f9" | ||
], | ||
"keyAgreement": [ | ||
"did:web:identity.foundation#6e6b416461e001f17961bbb0df763ed46cd9dcb64a2f37ade0f85579520de5f9" | ||
], | ||
"service": [] | ||
} |
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,142 +1,168 @@ | ||
const gulp = require('gulp'); | ||
const concat = require('gulp-concat'); | ||
const uglify = require('gulp-uglify'); | ||
const nunjucksRender = require('gulp-nunjucks-render'); | ||
const axios = require('axios'); | ||
const gulp = require("gulp"); | ||
const concat = require("gulp-concat"); | ||
const uglify = require("gulp-uglify"); | ||
const nunjucksRender = require("gulp-nunjucks-render"); | ||
const axios = require("axios"); | ||
|
||
const { Transform } = require('stream'); | ||
const File = require('vinyl'); | ||
const { existsSync } = require('fs'); | ||
const { Transform } = require("stream"); | ||
const File = require("vinyl"); | ||
const { existsSync } = require("fs"); | ||
|
||
var assets = { | ||
js: [ | ||
'docs/js/jquery-3.2.1.min.js', | ||
'docs/js/jquery-migrate-3.0.0.min.js', | ||
'docs/plugins/bootstrap/js/popper.min.js', | ||
'docs/plugins/bootstrap/js/bootstrap.min.js', | ||
'docs/js/custom.js' | ||
] | ||
"docs/js/jquery-3.2.1.min.js", | ||
"docs/js/jquery-migrate-3.0.0.min.js", | ||
"docs/plugins/bootstrap/js/popper.min.js", | ||
"docs/plugins/bootstrap/js/bootstrap.min.js", | ||
"docs/js/custom.js", | ||
], | ||
}; | ||
|
||
var structure = { | ||
'index': [ | ||
'index.html' | ||
], | ||
'events': [ | ||
'index.html' | ||
], | ||
'education': [ | ||
'index.html' | ||
index: ["index.html"], | ||
events: ["index.html"], | ||
education: ["index.html"], | ||
schemas: ["index.html"], | ||
"working-groups": [ | ||
"identifiers-discovery.html", | ||
"storage-compute.html", | ||
"claims-credentials.html", | ||
"authentication.html", | ||
"did-comm.html", | ||
"sidetree.html", | ||
"secure-data-storage.html", | ||
], | ||
'schemas': [ | ||
'index.html' | ||
], | ||
'working-groups': [ | ||
'identifiers-discovery.html', | ||
'storage-compute.html', | ||
'claims-credentials.html', | ||
'authentication.html', | ||
'did-comm.html', | ||
'sidetree.html', | ||
'secure-data-storage.html' | ||
] | ||
}; | ||
|
||
var compiledRepos = null; | ||
const repoTopics = { | ||
'wg-auth': 1, | ||
'wg-cc': 1, | ||
'wg-id': 1, | ||
'wg-sc': 1, | ||
'wg-didcomm': 1, | ||
'wg-crypto': 1, | ||
'wg-keri': 1, | ||
'wg-sidetree': 1, | ||
'wg-ws': 1 | ||
} | ||
"wg-auth": 1, | ||
"wg-cc": 1, | ||
"wg-id": 1, | ||
"wg-sc": 1, | ||
"wg-didcomm": 1, | ||
"wg-crypto": 1, | ||
"wg-keri": 1, | ||
"wg-sidetree": 1, | ||
"wg-ws": 1, | ||
}; | ||
|
||
async function iterateRepos(fn, page = 1) { | ||
return axios.get(`https://api.github.com/users/decentralized-identity/repos?type=public&per_page=100&page=${page || 1}`, { | ||
headers: { Accept: 'application/vnd.github.mercy-preview+json' } | ||
}).then(response => { | ||
let repos = response.data; | ||
if (repos && repos.length) { | ||
fn(repos); | ||
if (repos.length === 100) { | ||
return iterateRepos(fn, ++page); | ||
return axios | ||
.get( | ||
`https://api.github.com/users/decentralized-identity/repos?type=public&per_page=100&page=${ | ||
page || 1 | ||
}`, | ||
{ | ||
headers: { Accept: "application/vnd.github.mercy-preview+json" }, | ||
} | ||
) | ||
.then((response) => { | ||
let repos = response.data; | ||
if (repos && repos.length) { | ||
fn(repos); | ||
if (repos.length === 100) { | ||
return iterateRepos(fn, ++page); | ||
} | ||
} | ||
} | ||
}).catch(e => console.log(e)) | ||
}) | ||
.catch((e) => console.log(e)); | ||
} | ||
|
||
async function compileRepos() { | ||
if (compiledRepos) return compiledRepos; | ||
compiledRepos = {}; | ||
try { | ||
await iterateRepos(repos => { | ||
repos.forEach(repo => { | ||
if (repo.topics) repo.topics.forEach(topic => { | ||
if (repoTopics[topic]) { | ||
let list = compiledRepos[topic] || (compiledRepos[topic] = []); | ||
list.push(repo); | ||
} | ||
}) | ||
await iterateRepos((repos) => { | ||
repos.forEach((repo) => { | ||
if (repo.topics) | ||
repo.topics.forEach((topic) => { | ||
if (repoTopics[topic]) { | ||
let list = compiledRepos[topic] || (compiledRepos[topic] = []); | ||
list.push(repo); | ||
} | ||
}); | ||
}); | ||
}) | ||
}); | ||
return compiledRepos; | ||
} catch (error) { | ||
return compiledRepos; | ||
} | ||
}; | ||
} | ||
|
||
const repoCompilation = compileRepos(); | ||
|
||
gulp.task('assets', function() { | ||
return gulp.src(assets.js) | ||
gulp.task("assets", function () { | ||
return gulp | ||
.src(assets.js) | ||
.pipe(uglify()) | ||
.pipe(concat('base.js')) | ||
.pipe(gulp.dest('docs/js')); | ||
.pipe(concat("base.js")) | ||
.pipe(gulp.dest("docs/js")); | ||
}); | ||
|
||
gulp.task('assetsCopy', () => { | ||
return gulp.src('assets/**') | ||
.pipe(gulp.dest('docs/assets')); | ||
gulp.task("assetsCopy", () => { | ||
return gulp.src("assets/**").pipe(gulp.dest("docs/assets")); | ||
}); | ||
|
||
gulp.task("copyJson", function () { | ||
return gulp.src("did.json").pipe(gulp.dest("docs/.well-known")); | ||
}); | ||
|
||
gulp.task('templates', async () => { | ||
return gulp.src(['templates/pages/**/*.html.njk', 'templates/pages/**/*.html']) | ||
.pipe(nunjucksRender({ | ||
path: ['templates', 'templates/partials', 'templates/pages'], | ||
data: { | ||
repos: compiledRepos || await compileRepos() | ||
} | ||
}).on('error', (e) => { | ||
console.log(`Error in ${e.fileName ? e.fileName : '(filename not available)'}: ${e.message.toString()}`); | ||
})) | ||
.pipe(new Transform({ | ||
objectMode: true, | ||
|
||
transform(file, enc, callback) { | ||
if (file instanceof File) { | ||
if (file.path.endsWith('.html.html')) { | ||
file.path = file.path.slice(0, -5) | ||
gulp.task("templates", async () => { | ||
return gulp | ||
.src(["templates/pages/**/*.html.njk", "templates/pages/**/*.html"]) | ||
.pipe( | ||
nunjucksRender({ | ||
path: ["templates", "templates/partials", "templates/pages"], | ||
data: { | ||
repos: compiledRepos || (await compileRepos()), | ||
}, | ||
}).on("error", (e) => { | ||
console.log( | ||
`Error in ${ | ||
e.fileName ? e.fileName : "(filename not available)" | ||
}: ${e.message.toString()}` | ||
); | ||
}) | ||
) | ||
.pipe( | ||
new Transform({ | ||
objectMode: true, | ||
|
||
transform(file, enc, callback) { | ||
if (file instanceof File) { | ||
if (file.path.endsWith(".html.html")) { | ||
file.path = file.path.slice(0, -5); | ||
} | ||
callback(null, file); | ||
} else { | ||
console.log(file); | ||
callback( | ||
new Error("Error, unexpected type received in pipe"), | ||
null | ||
); | ||
} | ||
callback(null, file) | ||
} else { | ||
console.log(file); | ||
callback(new Error('Error, unexpected type received in pipe'), null) | ||
} | ||
} | ||
})) | ||
.pipe(gulp.dest('./docs')) | ||
|
||
}, | ||
}) | ||
) | ||
.pipe(gulp.dest("./docs")); | ||
}); | ||
|
||
gulp.task('repoCompilation', (done) => { | ||
repoCompilation.then(z => done()) | ||
gulp.task("repoCompilation", (done) => { | ||
repoCompilation.then((z) => done()); | ||
}); | ||
|
||
gulp.task('build', gulp.series('repoCompilation', gulp.parallel('assets', 'assetsCopy', 'templates'))); | ||
|
||
gulp.task('watch', () => gulp.watch(['templates/**/*', 'docs/js/**/*', '!docs/js/base.js'], gulp.parallel('build'))); | ||
gulp.task( | ||
"build", | ||
gulp.series( | ||
"repoCompilation", | ||
gulp.parallel("assets", "assetsCopy", "templates", "copyJson") | ||
) | ||
); | ||
|
||
gulp.task("watch", () => | ||
gulp.watch( | ||
["templates/**/*", "docs/js/**/*", "!docs/js/base.js"], | ||
gulp.parallel("build") | ||
) | ||
); |