Compare commits
6 Commits
v0.0.1
...
v0.1.0-dev
Author | SHA1 | Date |
---|---|---|
semantic-release-bot | c354cedc6c | |
Derrick Hammer | 874b61e316 | |
Derrick Hammer | 8a8e50f69b | |
Derrick Hammer | 17d51be71e | |
Derrick Hammer | 2df349311b | |
Derrick Hammer | b907b6f276 |
|
@ -0,0 +1,13 @@
|
||||||
|
name: Build/Publish
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
- develop
|
||||||
|
- develop-*
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
main:
|
||||||
|
uses: lumeweb/github-node-deploy-workflow/.github/workflows/main.yml@master
|
||||||
|
secrets: inherit
|
|
@ -0,0 +1,12 @@
|
||||||
|
{
|
||||||
|
"preset": [
|
||||||
|
"@lumeweb/node-library-preset"
|
||||||
|
],
|
||||||
|
"config": {
|
||||||
|
"tsconfig": {
|
||||||
|
"compilerOptions": {
|
||||||
|
"module": "nodenext"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
# [0.1.0-develop.1](https://git.lumeweb.com/LumeWeb/kernel-s5-client/compare/v0.0.1...v0.1.0-develop.1) (2023-09-01)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* add main to package.json ([17d51be](https://git.lumeweb.com/LumeWeb/kernel-s5-client/commit/17d51be71ea5c4d8aefa61830c9a8a4764310ce7))
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* initial version ([b907b6f](https://git.lumeweb.com/LumeWeb/kernel-s5-client/commit/b907b6f276a35a25519f5c334e4356e80e83b795))
|
2
LICENSE
2
LICENSE
|
@ -1,6 +1,6 @@
|
||||||
MIT License
|
MIT License
|
||||||
|
|
||||||
Copyright (c) 2023 LumeWeb
|
Copyright (c) 2023 Hammer Technologies LLC
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,30 @@
|
||||||
|
{
|
||||||
|
"name": "@lumeweb/kernel-s5-client",
|
||||||
|
"version": "0.1.0-develop.1",
|
||||||
|
"type": "module",
|
||||||
|
"main": "lib/index.js",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "gitea@git.lumeweb.com:LumeWeb/kernel-s5-client.git"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@lumeweb/node-library-preset": "^0.2.7",
|
||||||
|
"presetter": "*"
|
||||||
|
},
|
||||||
|
"readme": "ERROR: No README data found!",
|
||||||
|
"scripts": {
|
||||||
|
"prepare": "presetter bootstrap",
|
||||||
|
"build": "run build",
|
||||||
|
"semantic-release": "semantic-release"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"@lumeweb/libkernel": "0.1.0-develop.36",
|
||||||
|
"@lumeweb/libs5": "^0.1.0-develop.25"
|
||||||
|
},
|
||||||
|
"publishConfig": {
|
||||||
|
"access": "public"
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"lib"
|
||||||
|
]
|
||||||
|
}
|
|
@ -0,0 +1,52 @@
|
||||||
|
import { factory, NetworkClient } from "@lumeweb/libkernel/module";
|
||||||
|
import type { SignedRegistryEntry } from "@lumeweb/libs5";
|
||||||
|
|
||||||
|
export const MODULE =
|
||||||
|
"zduPehBQc2edPXDBsxo9CM6pTnS6bpDx1MBS92GH5wLAqMnErsVKhnobD1";
|
||||||
|
|
||||||
|
export interface RegistryEntry {
|
||||||
|
key: Uint8Array;
|
||||||
|
data: Uint8Array;
|
||||||
|
revision: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class S5Client extends NetworkClient {
|
||||||
|
public async getRegistryEntry(pubkey: Uint8Array | Buffer | string) {
|
||||||
|
return this.callModuleReturn("getRegistryEntry", { pubkey });
|
||||||
|
}
|
||||||
|
|
||||||
|
public async setRegistryEntry({
|
||||||
|
key,
|
||||||
|
data,
|
||||||
|
revision,
|
||||||
|
}: RegistryEntry): Promise<SignedRegistryEntry> {
|
||||||
|
return this.callModuleReturn("setRegistryEntry", { key, data, revision });
|
||||||
|
}
|
||||||
|
|
||||||
|
public registrySubscription(
|
||||||
|
pubkey: Uint8Array,
|
||||||
|
cb: (sre: SignedRegistryEntry) => void,
|
||||||
|
): () => void {
|
||||||
|
let done = false;
|
||||||
|
|
||||||
|
const [end, ret] = this.connectModule(
|
||||||
|
"registrySubscription",
|
||||||
|
{ pubkey },
|
||||||
|
cb,
|
||||||
|
);
|
||||||
|
|
||||||
|
ret.then((ret) => {
|
||||||
|
this.handleError(ret);
|
||||||
|
});
|
||||||
|
|
||||||
|
return () => {
|
||||||
|
if (done) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
done = true;
|
||||||
|
end();
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export const createClient = factory<S5Client>(S5Client, MODULE);
|
Loading…
Reference in New Issue