Compare commits
No commits in common. "v0.1.0-develop.41" and "v0.1.0-develop.40" have entirely different histories.
v0.1.0-dev
...
v0.1.0-dev
|
@ -1,5 +1,3 @@
|
|||
# [0.1.0-develop.41](https://git.lumeweb.com/LumeWeb/libs5/compare/v0.1.0-develop.40...v0.1.0-develop.41) (2023-09-02)
|
||||
|
||||
# [0.1.0-develop.40](https://git.lumeweb.com/LumeWeb/libs5/compare/v0.1.0-develop.39...v0.1.0-develop.40) (2023-09-02)
|
||||
|
||||
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"name": "@lumeweb/libs5",
|
||||
"version": "0.1.0-develop.41",
|
||||
"version": "0.1.0-develop.40",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@lumeweb/libs5",
|
||||
"version": "0.1.0-develop.41",
|
||||
"version": "0.1.0-develop.40",
|
||||
"dependencies": {
|
||||
"@noble/curves": "^1.1.0",
|
||||
"@noble/hashes": "^1.3.1",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@lumeweb/libs5",
|
||||
"version": "0.1.0-develop.41",
|
||||
"version": "0.1.0-develop.40",
|
||||
"type": "module",
|
||||
"main": "lib/index.js",
|
||||
"repository": {
|
||||
|
|
|
@ -1,29 +1,40 @@
|
|||
export const CID_TYPES = {
|
||||
RAW: 0x26,
|
||||
METADATA_MEDIA: 0xc5,
|
||||
METADATA_WEBAPP: 0x59,
|
||||
RESOLVER: 0x25,
|
||||
USER_IDENTITY: 0x77,
|
||||
BRIDGE: 0x3a,
|
||||
// format for dynamic encrypted CID
|
||||
// type algo key resolver_type mkey_ed255 pubkey
|
||||
// in entry: encrypt(RAW CID or MEDIA or SOMETHING)
|
||||
export const cidTypeRaw = 0x26;
|
||||
export const cidTypeMetadataMedia = 0xc5;
|
||||
// const cidTypeMetadataFile = 0xc6;
|
||||
export const cidTypeMetadataWebApp = 0x59;
|
||||
export const cidTypeResolver = 0x25;
|
||||
|
||||
/// Used for immutable encrypted files and metadata formats, key can never be re-used
|
||||
///
|
||||
/// Used for file versions in Vup
|
||||
ENCRYPTED_STATIC: 0xae,
|
||||
ENCRYPTED_DYNAMIC: 0xad,
|
||||
};
|
||||
Object.freeze(CID_TYPES);
|
||||
export const cidTypeUserIdentity = 0x77;
|
||||
|
||||
export const REGISTRY_TYPES = {
|
||||
CID: 0x5a,
|
||||
/// Used for encrypted files with update support
|
||||
///
|
||||
/// can point to resolver CID, Stream CID, Directory Metadata or Media Metadata object
|
||||
ENCRYPTED_CID: 0x5e,
|
||||
};
|
||||
export const cidTypeBridge = 0x3a;
|
||||
|
||||
// format for dynamic encrypted CID
|
||||
// type algo key resolver_type mkey_ed255 pubkey
|
||||
// in entry: encrypt(RAW CID or MEDIA or SOMETHING)
|
||||
|
||||
/// Used for immutable encrypted files and metadata formats, key can never be re-used
|
||||
///
|
||||
/// Used for file versions in Vup
|
||||
export const cidTypeEncryptedStatic = 0xae;
|
||||
|
||||
/// Used for encrypted files with update support
|
||||
///
|
||||
/// can point to resolver CID, Stream CID, Directory Metadata or Media Metadata object
|
||||
export const cidTypeEncryptedDynamic = 0xad;
|
||||
|
||||
export const CID_TYPES = [
|
||||
cidTypeRaw,
|
||||
cidTypeMetadataMedia,
|
||||
cidTypeMetadataWebApp,
|
||||
cidTypeResolver,
|
||||
cidTypeUserIdentity,
|
||||
cidTypeBridge,
|
||||
cidTypeEncryptedStatic,
|
||||
cidTypeEncryptedDynamic,
|
||||
];
|
||||
|
||||
export const registryS5CIDByte = 0x5a;
|
||||
export const registryS5EncryptedByte = 0x5e;
|
||||
|
||||
// ! some multicodec bytes
|
||||
// BLAKE3 with default output size of 256 bits
|
||||
|
@ -48,25 +59,23 @@ export const metadataTypeDirectory = 0x04;
|
|||
export const metadataTypeProofs = 0x05;
|
||||
export const metadataTypeUserIdentity = 0x07;
|
||||
|
||||
export const METADATA_TYPES = {
|
||||
MEDIA: 0x02,
|
||||
WEBAPP: 0x03,
|
||||
DIRECTORY: 0x04,
|
||||
PROOF: 0x05,
|
||||
USER_IDENTITY: 0x07,
|
||||
};
|
||||
Object.freeze(METADATA_TYPES);
|
||||
export const METADATA_TYPES = [
|
||||
metadataTypeMedia,
|
||||
metadataTypeWebApp,
|
||||
metadataTypeDirectory,
|
||||
metadataTypeProofs,
|
||||
metadataTypeUserIdentity,
|
||||
];
|
||||
|
||||
export const parentLinkTypeUserIdentity = 1;
|
||||
export const parentLinkTypeBoard = 5;
|
||||
export const parentLinkTypeBridgeUser = 10;
|
||||
|
||||
export const PARENT_LINK_TYPES = {
|
||||
USER_IDENTITY: 1,
|
||||
BOARD: 5,
|
||||
BRIDGE_USER: 10,
|
||||
};
|
||||
Object.freeze(PARENT_LINK_TYPES);
|
||||
export const PARENT_LINK_TYPES = [
|
||||
parentLinkTypeUserIdentity,
|
||||
parentLinkTypeBoard,
|
||||
parentLinkTypeBridgeUser,
|
||||
];
|
||||
|
||||
export const registryMaxDataSize = 64;
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { base64url } from "multiformats/bases/base64";
|
||||
import { base32 } from "multiformats/bases/base32";
|
||||
import { equalBytes } from "@noble/curves/abstract/utils";
|
||||
import { CID_TYPES } from "#constants.js";
|
||||
import { cidTypeBridge } from "#constants.js";
|
||||
|
||||
export class Multihash {
|
||||
fullBytes: Uint8Array;
|
||||
|
@ -35,7 +35,7 @@ export class Multihash {
|
|||
}
|
||||
|
||||
toString(): string {
|
||||
return this.functionType === CID_TYPES.BRIDGE
|
||||
return this.functionType === cidTypeBridge
|
||||
? new TextDecoder().decode(this.fullBytes)
|
||||
: this.toBase64Url();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue