
Research
Malicious npm Packages Impersonate Flashbots SDKs, Targeting Ethereum Wallet Credentials
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
@namaste/kafka-schema-registry-client
Advanced tools
Kafka Avro schema registry client that supports:
npm i --save @namaste/kafka-schema-registry-client
or
yarn add @namaste/kafka-schema-registry-client
const { SchemaRegistry } = require('@namaste/kafka-schema-registry-client');
const connectionConfig = {
url: 'https://my.fake.schema.registry.url:3030',
auth: {
username: 'fakeusername',
password: 'fakepassword',
},
};
const schemaRegistry = new SchemaRegistry(connectionConfig);
Note: Schemas are only published if changed. If schema version has already been published, it is skipped. Note: Published schemas are also cached and set to be used for serialization.
const topicSchemaDefinitions = {
'topic': {
key: {
name: 'testKey',
type: 'string',
namespace: 'registry.test',
},
value: {
name: 'testValue',
type: 'record',
namespace: 'registry.test',
fields: [
{
name: 'text',
type: 'string',
},
{
name: 'newField',
type: ['null', 'string'],
default: null,
},
],
},
}
};
await schemaRegistry.publishSchemas(topicSchemaDefinitions);
Note: Usefull for producers when schemas are not defined locally or should not be automatically published by producer.
Specific schema versions will be fetched and set active.
await schemaRegistry.useSchemas({
'topic_name': {
key: 'latest',
value: '2',
}
});
await schemaRegistry.useSchemas();
await schemaRegistry.useSchemas(['topic_name_1', 'topic_name_2']);
Note: Schemas should be set to be used for serialization by either of two methods described above prior to serialization. Note: Schema version used for serialization is recorded in message headers.
const message = {
key: 'key text',
value: {
text: 'some text',
number: 4,
array: ['test1', 'test2'],
newField: 'more text',
},
partition: 2,
headers: {},
timestamp: '2019-01-01T22:22:22.000Z',
};
const serializedMessage = schemaRegistry.serializeMessage(message, 'topic');
Note: This is optional as schemas that has not been fetched yet are fetched on deserialization attempt.
const topicsToPrefetchSchemasFor = ['topicname'];
await schemaRegistry.fetchLatestSchemas(topicsToPrefetchSchemasFor);
Note: Schema version used for deserialization is defined in message headers.
const deserializedMessage = await schemaRegistry.deserializeMessage(serializedMessage, 'topic');
Creates new instance of schema registry.
connectionConfig
- object that has following shape:url
- schema registry URLauth
- basic auth config, must have:auth.username
auth.password
publishSchemas(topicSchemaDefinitions): Promise<void>
Publishes local shemas to registry and sets them to be used for messages serialization.
topicSchemaDefinitions
- object that has following shape:[topic_name]
:[topic_name].key
- optional. Avro schema definition for message key.[topic_name].value
- optional. Avro schema definition for message value.serializeMessage(message, 'topic'): serializedMessage
Serializes message using key and value schemas for the topic.
Schema versions to be used are defined with either publishSchemas
or useSchemas
methods.
message
- message to be serializedtopic
- topic the message is going to be published toasync useSchemas([topicVersionDefinitions]): Promise<void>
Fetches schema versions for specified topics from registry and sets them to be used for messages serialization.
topicVersionDefinitions
- Optional. Either a string array of topic names or an object that specifies key and value versions:When object, must have following shape:
[topic_name]
:[topic_name].key
- optional. Schema version string. Can be version number or string latest
.[topic_name].value
- optional. Schema version string. Can be version number or string latest
.When array, must list topic names.
Note: If no topicVersionDefinitions are passed to useSchemas
, schema registry will fetch and set as active latest verions for all subjects (keys and values for all topics).
async fetchLatestSchemas(topicsToPrefetchSchemasFor): Promise<void>
Fetches latest schemas for specified topics from registry.
topicsToPrefetchSchemasFor
- array of topic name stringsasync deserializeMessage(serializedMessage, 'topic'): Promise<deserializedMessage>
Deserializes message using key and value schemas for the topic. Schema versions to be used are retreived from message headers.
serializedMessage
- message to be deserializedtopic
- topic the message was published toFAQs
Kafka Schema Registy client.
The npm package @namaste/kafka-schema-registry-client receives a total of 0 weekly downloads. As such, @namaste/kafka-schema-registry-client popularity was classified as not popular.
We found that @namaste/kafka-schema-registry-client demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.