Rust implementation of PRECIS Framework: Preparation, Enforcement, and Comparison of Internationalized Strings in Application Protocols

Overview

Rust PRECIS Framework libray

PRECIS Framework: Preparation, Enforcement, and Comparison of Internationalized Strings in Application Protocols as described in rfc8264

This workspace implements the next crates:

precis-tools

This crate contains all the tools and parsers to generate PRECIS tables from the Unicode Character Database (UCD)[https://unicode.org]. This crate is only used to generate code required by precis-core and precis-profiles. It contains the main dependencies in order to download UCD files, parse them and generate Rust code.

precis-core

The core library of the PRECIS Framework. The base string classes IdentifierClass and FreeFormClass are implemented here as defined in rfc8264. This crate provides the APIs required for profiles to be implemented. You mostly won't require this crate unless you are implementing a new profile.

precis-profiles

This crate implements the next PRECIS profiles:

  • rfc8265. Preparation, Enforcement, and Comparison of Internationalized Strings Representing Usernames and Passwords.
  • rfc8266. Preparation, Enforcement, and Comparison of Internationalized Strings Representing Nicknames

PRECIS profiles provides an API that allows application to prepare, enforce and compare internacionalized strings.

Example

use precis_core::Error;
use precis_core::profile::Profile;
use precis_profiles::OpaqueString;
use std::borrow::Cow;

// create OpaqueString profile
let profile = OpaqueString::new();

// prepare string
assert_eq!(profile.prepare("I'm Guybrush Threepwood, Mighty Pirate ☠"),
    Ok(Cow::from("I'm Guybrush Threepwood, Mighty Pirate ☠")));

// enforce string
assert_eq!(profile.enforce("Look behind you, a three-headed monkey!🐒"),
    Ok(Cow::from("Look behind you, a three-headed monkey!🐒")));

// compare strings
assert_eq!(profile.compare("That’s the second biggest 🐵 I’ve ever seen!",
    "That’s the second biggest 🐵 I’ve ever seen!"), Ok(true));

If you find yourself continuously creating and destroying profiles to perform any of the operation described for internationalized string. You can make use of the PrecisFastInvocation trait. Profiles implementing this crate will allow you to prepare, enforce or compare string without having to instantiate a specific profile. Profiles usually use a static instance allocated with lazy_static

Example

extern crate precis_profiles;

use precis_core::profile::PrecisFastInvocation;
use precis_profiles::Nickname;
use std::borrow::Cow;

fn main() {
   assert_eq!(Nickname::prepare("Guybrush Threepwood"),
     Ok(Cow::from("Guybrush Threepwood")));
   assert_eq!(Nickname::enforce("   Guybrush     Threepwood  "),
     Ok(Cow::from("Guybrush Threepwood")));
   assert_eq!(Nickname::compare("Guybrush   Threepwood  ",
     "guybrush threepwood"), Ok(true));
}

crates.io

You can use this package in your project by adding the following to your Cargo.toml:

[dependencies]
precis-profiles = "0.1.0"

Known limitations

PRECIS recommends using toLowerCase() operation as defined in the Unicode Standard Unicode. This implementation uses the one provided by Rust standard library to_lowercase. This operation performs an unconditional mapping without tailoring. That is, the conversion is independent of context and language.

You might also like...
A versatile and efficient proxy framework with nice features suitable for various use cases.

A versatile and efficient proxy framework with nice features suitable for various use cases.

Astar Network is an interoperable blockchain based the Substrate framework and the hub for dApps within the Polkadot Ecosystem
Astar Network is an interoperable blockchain based the Substrate framework and the hub for dApps within the Polkadot Ecosystem

Astar Network is an interoperable blockchain based the Substrate framework and the hub for dApps within the Polkadot Ecosystem. With Astar Network and

Actor framework for Rust.

Actix Actor framework for Rust Documentation User Guide API Documentation API Documentation (master branch) Features Async and sync actors Actor commu

rpcx microservice framework in Rust

rpcx-rs Rust library for rpcx rpc/microservice framework. Use the simplest style to explore Rust function as cross-platform rpc services. If you can w

Implementing Bendersnatch curve using Arkwork's framework in Rust.

This is a reference implementation of Bendersnatch curve using Arkwork's framework in Rust. The spec of the curve is available here. There was also a Python reference implementation here.

High performance I/O framework written by Rust inspired by Netty
High performance I/O framework written by Rust inspired by Netty

Introduction Retty is a High performance I/O framework written by Rust inspired by Netty 基于mio的IO多路复用高并发、高性能网络通信开发框架 Feature Rayon 线程池包装 EventLoop / E

A simple message based networking library for the bevy framework

Spicy Networking for Bevy bevy_spicy_networking is a solution to the "How do I connect multiple clients to a single server" problem in your bevy games

Fullstack development framework for UTXO-based dapps on Nervos Network

Trampoline-rs The framework for building powerful dApps on the number one UTXO chain, Nervos Network CKB. This is an early-stage, currently very incom

Drpc-Correct, high performance, robust, easy use Remote invocation framework
Drpc-Correct, high performance, robust, easy use Remote invocation framework

Drpc - Correct, high performance, robust, easy use Remote invocation framework

Releases(v.0.1.4)
Owner
Santiago Carot-Nemesio
Santiago Carot-Nemesio
Hotwire allows you to study network traffic of a few popular protocols in a simple way

Hotwire Hotwire is a gtk GUI application that leverages the wireshark and tshark infrastructure to capture traffic and explore the contents of tcpdump

null 194 Dec 30, 2022
An end-to-end encrypted, anonymous IP-hiding, decentralized, audio/video/file sharing/offline messaging multi-device platform built for both communications and application security and performance.

An end-to-end encrypted, anonymous IP-hiding, decentralized, audio/video/file sharing/offline messaging multi-device platform built for both communications and application security and performance.

null 2 Apr 27, 2022
axum-server is a hyper server implementation designed to be used with axum framework.

axum-server axum-server is a hyper server implementation designed to be used with axum framework. Features Conveniently bind to any number of addresse

null 79 Jan 4, 2023
Tiny CLI application in rust to scan ports from a given IP and find how many are open. You can also pass the amount of threads for that scan

Port Scanner A simple multi-threaded port scanner written in Rust. Usage Run the port scanner by providing the target IP address and optional flags. $

nicolas lopes 4 Aug 29, 2023
A Constrained Application Protocol(CoAP) library implemented in Rust.

coap-rs A fast and stable Constrained Application Protocol(CoAP) library implemented in Rust. Features: CoAP core protocol RFC 7252 CoAP Observe optio

Covertness 170 Dec 19, 2022
Easy per application transparent proxy built on cgroup.

cproxy can redirect TCP and UDP traffic made by a program to a proxy, without requiring the program supporting a proxy. Compared to many existi

Xiangru Lian 263 Dec 20, 2022
An application for downloading public domain ebooks from irc.

An application for downloading public domain ebooks from irc. Despite the name it is not to be used for illegal activities and I am in no way responsible for any such use.

null 33 Nov 25, 2022
A metrics collection application for Linux machines. Created for MSCS 710 Project at Marist College.

Linux-Metrics-Collector A metrics collection application for Linux machines. Created for MSCS 710 Project at Marist College. Development Environment S

Christopher Ravosa 2 May 2, 2022
Dns subdomain finding tool, based off of the c application of the same name

dnsmap-rs Tool for brute-forcing/scanning for existing subdomains in a domain. Based on dnsmap c application that is packaged in kali linux. Can query

Tomás Alvarez 3 Oct 19, 2022
Volo is a high-performance and strong-extensibility Rust RPC framework that helps developers build microservices.

Volo is a high-performance and strong-extensibility Rust RPC framework that helps developers build microservices.

CloudWeGo 1.3k Jan 2, 2023