-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
new: ops-helper/apiImpl/* to involve bluesky lib during ops.
- Loading branch information
Showing
6 changed files
with
70 additions
and
1 deletion.
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 |
---|---|---|
|
@@ -4,3 +4,5 @@ data/** | |
certs/** | ||
config/**secret** | ||
**/__pycache__ | ||
**/node_modules/** | ||
**/package-lock.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
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,38 @@ | ||
#!/usr/bin/env ts-node | ||
|
||
import * as plc_ from '@did-plc/lib' | ||
import { Secp256k1Keypair } from '@atproto/crypto' | ||
import yargs from 'yargs' | ||
|
||
// based on atproto/packages/dev-env/util.ts | ||
const createDidOnPlc = async (opts: any): Promise<any> => | ||
{ | ||
const { handle, pds, plc, signingKeyHex } = opts | ||
const key = await Secp256k1Keypair.import(signingKeyHex) | ||
|
||
const did = await new plc_.Client(plc).createDid({ | ||
signingKey: key.did(), | ||
rotationKeys: [key.did()], | ||
handle, | ||
signer: key, | ||
pds | ||
}) | ||
|
||
return { handle, did } | ||
} | ||
|
||
const main = async (ops: any) => { | ||
const rtn = await createDidOnPlc(opt) | ||
console.log(JSON.stringify(rtn)) | ||
} | ||
|
||
const opt = yargs(process.argv.slice(2)).options({ | ||
plc: { type: 'string', description: 'PLC URL'}, | ||
handle: { type: 'string', description: 'handle name'}, | ||
signingKeyHex: { type: 'string', description: 'signing key in hex string'}, | ||
pds: { type: 'string', description: 'PDS URL', default: 'pds.invalid' }, | ||
tls: { type: 'string', description: 'ignore TLS verification(NODE_TLS_REJECT_UNAUTHORIZED)', default: '0'} | ||
}).parseSync() | ||
|
||
process.env['NODE_TLS_REJECT_UNAUTHORIZED']=opt.tls | ||
main(opt) |
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,29 @@ | ||
{ | ||
"name": "bluesky-ops", | ||
"version": "1.0.0", | ||
"description": "implementing ops aginst bluesky, including self-hosting blusky", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"keywords": [ | ||
"ops", | ||
"actuation", | ||
"bluesky", | ||
"self-hosting" | ||
], | ||
"author": "[email protected]", | ||
"license": "MIT", | ||
"homepage": "https://github.com/itaru2622/bluesky-selfhost-env#readme", | ||
"engines": { | ||
"node": ">=18.0.0" | ||
}, | ||
"dependencies": { | ||
"@atproto/api": "*", | ||
"@atproto/crypto": "*", | ||
"@did-plc/lib": "*", | ||
"@types/yargs": "*", | ||
"ts-node": "*", | ||
"yargs": "*" | ||
} | ||
} |
File renamed without changes.
File renamed without changes.